diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 02eedd8..fda9131 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -445,9 +445,10 @@ module "vpc2" { } module "vpc_otheraccount" { - source = "terraform-aws-modules/vpc/aws" + source = "terraform-aws-modules/vpc/aws" + version = "~> 5.0" + provider = aws.second_account - version = "~> 5.0" name = "my-second-account-vpc-for-private-route53-zone" cidr = "172.16.0.0/12" diff --git a/modules/zone-cross-account-vpc-association/main.tf b/modules/zone-cross-account-vpc-association/main.tf index 9f8b160..d33d42c 100644 --- a/modules/zone-cross-account-vpc-association/main.tf +++ b/modules/zone-cross-account-vpc-association/main.tf @@ -1,14 +1,16 @@ resource "aws_route53_vpc_association_authorization" "this" { - provider = aws.r53_owner for_each = { for k, v in var.zone_vpc_associations : k => v if var.create } + + provider = aws.r53_owner zone_id = each.value.zone_id vpc_id = each.value.vpc_id vpc_region = try(each.value.vpc_region, null) } resource "aws_route53_zone_association" "this" { - provider = aws.vpc_owner for_each = aws_route53_vpc_association_authorization.this + + provider = aws.vpc_owner vpc_id = each.value.vpc_id zone_id = each.value.zone_id vpc_region = try(each.value.vpc_region, null) diff --git a/modules/zone-cross-account-vpc-association/versions.tf b/modules/zone-cross-account-vpc-association/versions.tf index 1437fc9..8ddd9da 100644 --- a/modules/zone-cross-account-vpc-association/versions.tf +++ b/modules/zone-cross-account-vpc-association/versions.tf @@ -5,7 +5,7 @@ terraform { aws = { source = "hashicorp/aws" version = ">= 3.56" - configuration_aliases = [ aws.r53_owner, aws.vpc_owner ] + configuration_aliases = [aws.r53_owner, aws.vpc_owner] } } }