Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform init in env/dev fails with "Duplicate variable definition" #63

Open
andrewwells opened this issue Dec 6, 2020 · 3 comments
Open

Comments

@andrewwells
Copy link

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
@jamesone
Copy link

Im also getting this - Did u figure out what was wrong?

@andrewwells
Copy link
Author

No, unfortunately I did not. I just ended up created the resources I needed by hand.

@Bhavikpatel576
Copy link

For future travelers, the easy fix is changing the variable names. Ideally this repo will get updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants