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

Default Tagging in AWS Provider >=v3.38.0 #385

Closed
stuft2 opened this issue Dec 2, 2021 · 2 comments · Fixed by #453
Closed

Default Tagging in AWS Provider >=v3.38.0 #385

stuft2 opened this issue Dec 2, 2021 · 2 comments · Fixed by #453

Comments

@stuft2
Copy link
Contributor

stuft2 commented Dec 2, 2021

While updating dependencies for a project based on our hello-world templates, I ran into this error during a terraform apply:

Error: "tags" are identical to those in the "default_tags" configuration block of the provider: please de-duplicate and try again

In researching this error I ran across an article that described a relatively new feature in the Terraform AWS Provider:

In version 3.38.0 and later of the Terraform AWS Provider, a default_tags argument is available in the provider configuration block. This argument allows for tagging of all resources that currently support the tags argument. It is intended as an alternative to the tedium of applying the same tags repeatedly across all resources.

We defined some default tags as local variables in our template so that we can pass them into resources. With newer versions of the AWS Provider, passing in duplicate or partially duplicate tags into resources causes the plan to fail. We should update this and other hello-world templates to only supply the default tags in the AWS Provider block like so:

locals {
  env = "dev"
}
provider "aws" {
  region = "us-west-2"

  default_tags {
    tags = {
      repo             = "https://github.com/byu-oit/hw-fargate-api"
      data-sensitivity = "public"
      env              = local.env
    }
  }
}

References:

@Gi60s
Copy link

Gi60s commented Dec 6, 2021

Story created and added to the backlog: STRY0060840

@joanna-hugo
Copy link
Contributor

I wrote a PR to fix this problem in this repo (see link above) and it looks like it's already fixed in the other HW template repos

@stuft2 stuft2 linked a pull request Mar 14, 2022 that will close this issue
@GaryGSC GaryGSC closed this as completed May 24, 2022
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

Successfully merging a pull request may close this issue.

4 participants