File tree Expand file tree Collapse file tree 6 files changed +23
-26
lines changed Expand file tree Collapse file tree 6 files changed +23
-26
lines changed Original file line number Diff line number Diff line change 11provider "aws" {
22 region = " ap-south-1"
33}
4+ provider "aws" {
5+ alias = " cross_account_provider"
6+ region = var. region
7+
8+ dynamic "assume_role" {
9+ for_each = var. route53_assume_role_arn != null ? [1 ] : []
10+ content {
11+ role_arn = var. route53_assume_role_arn
12+ }
13+ }
14+ }
415
516locals {
617 task_definition_network_mode = " awsvpc"
@@ -25,6 +36,11 @@ locals {
2536module "ecs_deployment" {
2637 source = " ../../"
2738
39+ providers = {
40+ aws = aws
41+ aws.cross_account_provider = aws.cross_account_provider
42+ }
43+
2844 cluster_name = var. cluster_name
2945 vpc_id = var. vpc_id
3046
@@ -93,7 +109,6 @@ module "ecs_deployment" {
93109 record_zone_id = data.aws_route53_zone.base_domain.zone_id
94110 }
95111 }
96- region = var. region
97112 # Cross-account role that ACM module will use for Route53 DNS record creation
98113 route53_assume_role_arn = var. route53_assume_role_arn
99114
Original file line number Diff line number Diff line change @@ -136,9 +136,11 @@ variable "domain_name" {
136136variable "region" {
137137 description = " AWS region to deploy resources"
138138 type = string
139+ default = null
139140}
140141
141142variable "route53_assume_role_arn" {
142143 description = " ARN of the cross-account role for Route53 DNS record creation"
143144 type = string
145+ default = null
144146}
Original file line number Diff line number Diff line change @@ -243,22 +243,6 @@ resource "aws_ecs_task_definition" "this" {
243243# ###############################################################################
244244# Amazon Certificates Manager Sub-module
245245# ###############################################################################
246- provider "aws" {
247- region = var. region
248- }
249-
250- # Cross-account provider for Route53
251- provider "aws" {
252- alias = " cross_account_provider"
253- region = var. region
254-
255- dynamic "assume_role" {
256- for_each = var. route53_assume_role_arn != null ? [1 ] : []
257- content {
258- role_arn = var. route53_assume_role_arn
259- }
260- }
261- }
262246
263247module "acm" {
264248 source = " ./modules/acm"
Original file line number Diff line number Diff line change 11terraform {
22 required_providers {
33 aws = {
4- source = " hashicorp/aws"
5- version = " ~> 6.0"
4+ source = " hashicorp/aws"
65 configuration_aliases = [
7- aws,
86 aws.cross_account_provider
97 ]
108 }
Original file line number Diff line number Diff line change @@ -200,12 +200,6 @@ variable "acm_certificates" {
200200 default = {}
201201}
202202
203- variable "region" {
204- description = " (Optional) AWS region to create resources in."
205- type = string
206- default = null
207- }
208-
209203variable "route53_assume_role_arn" {
210204 description = " (Optional) ARN of the role to assume for Route53 operations."
211205 type = string
Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ terraform {
55 aws = {
66 source = " hashicorp/aws"
77 version = " ~> 6.0"
8+
9+ configuration_aliases = [
10+ aws.cross_account_provider
11+ ]
812 }
913 }
1014}
You can’t perform that action at this time.
0 commit comments