diff --git a/terraform/environments/analytical-platform-compute/data.tf b/terraform/environments/analytical-platform-compute/data.tf index 05b57e720a9..45bebab654a 100644 --- a/terraform/environments/analytical-platform-compute/data.tf +++ b/terraform/environments/analytical-platform-compute/data.tf @@ -4,6 +4,31 @@ data "aws_ec2_transit_gateway" "pttp" { id = "tgw-026162f1ba39ce704" } +data "aws_ram_resource_share" "moj_tgw" { + resource_owner = "OTHER-ACCOUNTS" + filter { + name = "resourceType" + values = ["ec2:TransitGateway"] + } +} + +data "aws_arn" "moj_tgw" { + arn = data.aws_ram_resource_share.moj_tgw.resource_arns[0] +} + +# TODO: revisit this to unhardcode the tgw ID above +# data "aws_ram_resource_share" "tgw_moj" { +# name = "tgw-moj" +# resource_owner = "OTHER-ACCOUNTS" +# } + +# data "aws_ec2_transit_gateway" "pttp" { +# filter { +# name = "owner-id" +# values = [data.aws_ram_resource_share.tgw_moj.resource_arns] +# } +# } + data "aws_iam_roles" "eks_sso_access_role" { name_regex = "AWSReservedSSO_${local.environment_configuration.eks_sso_access_role}_.*" path_prefix = "/aws-reserved/sso.amazonaws.com/" diff --git a/terraform/environments/analytical-platform-compute/transit-gateway-vpc-attachments.tf b/terraform/environments/analytical-platform-compute/transit-gateway-vpc-attachments.tf index da49e0711ee..e4ce8e9f14e 100644 --- a/terraform/environments/analytical-platform-compute/transit-gateway-vpc-attachments.tf +++ b/terraform/environments/analytical-platform-compute/transit-gateway-vpc-attachments.tf @@ -1,5 +1,8 @@ resource "aws_ec2_transit_gateway_vpc_attachment" "pttp" { - transit_gateway_id = data.aws_ec2_transit_gateway.pttp.id + # transit_gateway_id = data.aws_ec2_transit_gateway.pttp.id + transit_gateway_id = data.aws_arn.moj_tgw.resource vpc_id = module.vpc.vpc_id subnet_ids = module.vpc.private_subnets + + tags = local.tags }