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

[ BUG ]: Invalid index in map, if policy with name scheme <project-name>-auth is not provided #8

Open
1 task done
leonsteinhaeuser opened this issue Feb 8, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@leonsteinhaeuser
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

If a policy named with schema ${var.tfc_project}-auth is not provided, the execution failes with error:

Error: Invalid index
on .terraform/modules/aws_tfc_dynamic_credentials/main.tf line 62, in resource "tfe_variable" "tfe_aws_provider_auth_arn":

  value           = module.aws_tfc_dynamic_credentials_iam_roles["${var.tfc_project}-auth"].role_arn

module.aws_tfc_dynamic_credentials_iam_roles is object with 1 attribute "platform-general-purpose-tfc-ses"
var.tfc_project is "platform-general-purpose"
The given key does not identify an element in this collection value.

Expected Behavior

We expect to successfully deploy the policies.

Steps To Reproduce

  1. Configure
module "aws_tfc_dynamic_credentials" {
  source  = "tagesspiegel/dynamic-provider-credentials/aws"
  version = "1.1.1"

  tfc_organization = "Tagesspiegel"
  tfc_project      = local.tfc_project_name

  tfc_workspaces = [
    {
      name_override = "${local.tfc_project_name}-auth"
      workspace     = "*"
      run_phase     = "*"
      policies = [
        {
          Effect = "Allow"
          Action = [
            "iam:*"
          ]
          Resource = "*"
        },
        {
          Effect = "Allow"
          Action = [
            "ses:*"
          ]
          Resource = "*"
        },
      ]
    },
  ]
}
  1. Plan
  2. See error

Relevant log output

No response

Additional context:

No response

@leonsteinhaeuser leonsteinhaeuser added the bug Something isn't working label Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant