Skip to content

Commit 39daca6

Browse files
committed
Update complete example
1 parent f0d08b6 commit 39daca6

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

examples/complete/main.tf

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,16 @@ locals {
2121
}
2222
}
2323

24-
module "secrets_manager" {
25-
for_each = {
26-
BAR = "secret1"
27-
FOO = "secret2"
28-
}
24+
module "postgres" {
25+
source = "../../modules/container-definition"
2926

30-
source = "terraform-aws-modules/secrets-manager/aws"
31-
version = "~> 1.3"
27+
name = "postgres"
28+
image = "postgres:latest"
3229

33-
name_prefix = each.key
34-
secret_string = each.value
30+
secrets = [{
31+
name = "POSTGRES_PASSWORD"
32+
valueFrom = "arn:POSTGRES_PASSWORD"
33+
}]
3534
}
3635

3736
################################################################################
@@ -63,7 +62,7 @@ module "ecs" {
6362
cpu = 1024
6463
memory = 4096
6564

66-
explicit_task_exec_secret_arns = false
65+
explicit_task_exec_secret_arns = true
6766

6867
# Container definition(s)
6968
container_definitions = {
@@ -85,16 +84,10 @@ module "ecs" {
8584
essential = true
8685
image = "public.ecr.aws/aws-containers/ecsdemo-frontend:776fd50"
8786

88-
secrets = [
89-
{
90-
name = "FOO"
91-
valueFrom = module.secrets_manager["FOO"].secret_arn
92-
},
93-
{
94-
name = "BAR"
95-
valueFrom = module.secrets_manager["BAR"].secret_arn
96-
}
97-
]
87+
secrets = [{
88+
name = "BAR"
89+
valueFrom = "arn:BAR"
90+
}]
9891

9992
health_check = {
10093
command = ["CMD-SHELL", "curl -f http://localhost:${local.container_port}/health || exit 1"]
@@ -129,6 +122,8 @@ module "ecs" {
129122
}
130123
memory_reservation = 100
131124
}
125+
126+
postgres = module.postgres.container_definition
132127
}
133128

134129
service_connect_configuration = {

0 commit comments

Comments
 (0)