diff --git a/modules/networking/vpc-endpoints/README.md b/modules/networking/vpc-endpoints/README.md index 2b55ed7..25ccca6 100644 --- a/modules/networking/vpc-endpoints/README.md +++ b/modules/networking/vpc-endpoints/README.md @@ -1,6 +1,4 @@ # vpc-endpoints module -This module uses provider default_tags! - This module deploys VPC endpoints. Automatically, this module performs the following additional tasks diff --git a/modules/networking/vpc-endpoints/main.tf b/modules/networking/vpc-endpoints/main.tf index 7d6dc78..9dc9412 100644 --- a/modules/networking/vpc-endpoints/main.tf +++ b/modules/networking/vpc-endpoints/main.tf @@ -1,5 +1,12 @@ data "aws_region" "this" {} -data aws_default_tags this {} +data "aws_default_tags" "this" { + lifecycle { + postcondition { + condition = length(self.tags) >= 1 + error_message = "Validation failed: Provider default_tags not set." + } + } +} resource "aws_vpc_endpoint" "vpc-interface-ep" { for_each = toset(var.interface-ep-services) diff --git a/modules/networking/vpc-subnet-manual/README.md b/modules/networking/vpc-subnet-manual/README.md index 180904e..3531c49 100644 --- a/modules/networking/vpc-subnet-manual/README.md +++ b/modules/networking/vpc-subnet-manual/README.md @@ -1,6 +1,4 @@ # Overview -This module uses provider default_tags! - This module performs the following tasks: - Create VPC, vpcflow log diff --git a/modules/networking/vpc-subnet-manual/main.tf b/modules/networking/vpc-subnet-manual/main.tf index bac0731..aa55219 100644 --- a/modules/networking/vpc-subnet-manual/main.tf +++ b/modules/networking/vpc-subnet-manual/main.tf @@ -1,10 +1,17 @@ -data aws_caller_identity this {} +data "aws_caller_identity" "this" {} data "aws_availability_zones" "available-az" { state = "available" } -data "aws_default_tags" "this" {} +data "aws_default_tags" "this" { + lifecycle { + postcondition { + condition = length(self.tags) >= 1 + error_message = "Validation failed: Provider default_tags not set." + } + } +} locals { no-az = 2 # hard-coding to 2AZ