Skip to content

Commit 9f9545b

Browse files
author
rahul-infra
committed
feat!: updated providers in acm module.
formatted terraform file.
1 parent 8d911e9 commit 9f9545b

File tree

6 files changed

+23
-26
lines changed

6 files changed

+23
-26
lines changed

examples/complete/main.tf

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
provider "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

516
locals {
617
task_definition_network_mode = "awsvpc"
@@ -25,6 +36,11 @@ locals {
2536
module "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

examples/complete/variables.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,11 @@ variable "domain_name" {
136136
variable "region" {
137137
description = "AWS region to deploy resources"
138138
type = string
139+
default = null
139140
}
140141

141142
variable "route53_assume_role_arn" {
142143
description = "ARN of the cross-account role for Route53 DNS record creation"
143144
type = string
145+
default = null
144146
}

main.tf

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff 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

263247
module "acm" {
264248
source = "./modules/acm"

modules/acm/providers.tf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
terraform {
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
}

variables.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff 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-
209203
variable "route53_assume_role_arn" {
210204
description = "(Optional) ARN of the role to assume for Route53 operations."
211205
type = string

versions.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)