terraform-ecs-fargate
terraform-ecs-fargate copied to clipboard
Terraform init in env/dev fails with "Duplicate variable definition"
Hello, I'm trying to run terraform init in a clean env/dev folder and am receiving multiple errors due to "Duplicated local value definition".
Terraform version: v0.14.0
Error: Duplicate local value definition
on ssm-parameters.tf line 3, in locals:
3: kms_write_actions = [
4: "kms:CancelKeyDeletion",
5: "kms:CreateAlias",
6: "kms:CreateGrant",
7: "kms:CreateKey",
8: "kms:DeleteAlias",
9: "kms:DeleteImportedKeyMaterial",
10: "kms:DisableKey",
11: "kms:DisableKeyRotation",
12: "kms:EnableKey",
13: "kms:EnableKeyRotation",
14: "kms:Encrypt",
15: "kms:GenerateDataKey",
16: "kms:GenerateDataKeyWithoutPlaintext",
17: "kms:GenerateRandom",
18: "kms:GetKeyPolicy",
19: "kms:GetKeyRotationStatus",
20: "kms:GetParametersForImport",
21: "kms:ImportKeyMaterial",
22: "kms:PutKeyPolicy",
23: "kms:ReEncryptFrom",
24: "kms:ReEncryptTo",
25: "kms:RetireGrant",
26: "kms:RevokeGrant",
27: "kms:ScheduleKeyDeletion",
28: "kms:TagResource",
29: "kms:UntagResource",
30: "kms:UpdateAlias",
31: "kms:UpdateKeyDescription",
32: ]
A local value named "kms_write_actions" was already defined at
secretsmanager.tf:4,3-33,4. Local value names must be unique within a module.
Error: Duplicate local value definition
on ssm-parameters.tf line 35, in locals:
35: kms_read_actions = [
36: "kms:Decrypt",
37: "kms:DescribeKey",
38: "kms:List*",
39: ]
A local value named "kms_read_actions" was already defined at
secretsmanager.tf:36,3-40,4. Local value names must be unique within a module.
Error: Duplicate local value definition
on ssm-parameters.tf line 42, in locals:
42: saml_user_ids = flatten([
43: data.aws_caller_identity.current.user_id,
44: data.aws_caller_identity.current.account_id,
45: formatlist(
46: "%s:%s",
47: data.aws_iam_role.saml_role_ssm.unique_id,
48: var.secrets_saml_users,
49: ),
50: ])
A local value named "saml_user_ids" was already defined at
secretsmanager.tf:65,3-73,5. Local value names must be unique within a module.
Error: Duplicate local value definition
on ssm-parameters.tf line 53, in locals:
53: role_and_saml_ids = flatten([
54: "${aws_iam_role.ecsTaskExecutionRole.unique_id}:*",
55: local.saml_user_ids,
56: ])
A local value named "role_and_saml_ids" was already defined at
secretsmanager.tf:76,3-80,5. Local value names must be unique within a module.
Error: Duplicate variable declaration
on ssm-parameters.tf line 66:
66: variable "secrets_saml_users" {
A variable named "secrets_saml_users" was already declared at
secretsmanager.tf:281,1-30. Variable names must be unique within a module
Im also getting this - Did u figure out what was wrong?
No, unfortunately I did not. I just ended up created the resources I needed by hand.
For future travelers, the easy fix is changing the variable names. Ideally this repo will get updated.