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]: aws_batch_job_definition tag broken when no existing tags #38053

Closed
james-flwls opened this issue Jun 20, 2024 · 8 comments · Fixed by #39797
Closed

[Bug]: aws_batch_job_definition tag broken when no existing tags #38053

james-flwls opened this issue Jun 20, 2024 · 8 comments · Fixed by #39797
Labels
bug Addresses a defect in current functionality. service/batch Issues and PRs that pertain to the batch service. tags Pertains to resource tagging.
Milestone

Comments

@james-flwls
Copy link

james-flwls commented Jun 20, 2024

Terraform Core Version

v1.8.5

AWS Provider Version

v5.54.1

Affected Resource(s)

  • aws_batch_job_definition

Expected Behavior

Any tags are reflected in AWS

Actual Behavior

Tags are only added if there is at least one tag in AWS for the batch definition

Relevant Error/Panic Output Snippet

The plan / apply looks correct but not reflected in AWS

Terraform Configuration Files

resource "aws_batch_job_definition" "main" {

  name                  = var.container_name
  type                  = "container"
  platform_capabilities = [var.platformCapabilities]
  container_properties  = jsonencode(local.container_definition_without_null)
  propagate_tags        = true
  tags = {
    Environment = var.environment
    Namespace   = var.namespace
    Project     = var.project
    Service     = var.app
    Team        = "development"
  }
}

Steps to Reproduce

Running a plan / apply when there are no existsing tags

~ revision                   = 7 -> (known after apply)
 ~ tags                       = {
    "Environment" = "dev"
  + "Namespace"   = "main"
    "Project"     = "xxxx"
  + "Service"     = "xxxx"
  + "Team"        = "development"
}
~ tags_all                   = {
  + "Environment" = "dev"
  + "ManagedBy"   = "terraform"
  + "Namespace"   = "main"
  + "Owner"       = "xxxx"
  + "Project"     = "xxxx"
  + "Role"        = "batch"
  + "Service"     = "xxxx"
  + "SourcePath"  = "xxxx"
  + "Team"        = "development"

tags-missing

AWS is missing all tags including from tags_all

If I then create a manual tag in AWS Environment = foo

Running plan / apply

~ revision                   = 8 -> (known after apply)
~ tags                      = {
    ~ "Environment" = "foo" -> "dev"          <------- detects the change
    + "Namespace"   = "main"
      "Project"     = "xxxx"
    + "Service"     = "xxxx"
    + "Team"        = "development"
  }
~ tags_all                   = {
    ~ "Environment" = "foo" -> "dev"
    + "ManagedBy"   = "terraform"
    + "Namespace"   = "main"
    + "Owner"       = "xxxx"
    + "Project"     = "xxxxx"
    + "Role"        = "batch"
    + "Service"     = "xxxx"
    + "SourcePath"  = "xxxxx"
    + "Team"        = "development"
  }
  # (8 unchanged attributes hidden)
}

tags-present

All tags are now present correctly

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No

@james-flwls james-flwls added the bug Addresses a defect in current functionality. label Jun 20, 2024
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/batch Issues and PRs that pertain to the batch service. label Jun 20, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Jun 20, 2024
@james-flwls
Copy link
Author

So it seems that the problem happens when the new definition becomes active. The old definition has the correct tags.

@andrewmwilson
Copy link

I think this is a duplicate of #37254

@james-flwls
Copy link
Author

Possibly a duplicate - its a bit unclear on that ticket if its the same. It implies its related to tags_all and not having any tags on the resource. It is a tag issue on aws_batch_job_definition so likely to be related

@justinretzolk justinretzolk added tags Pertains to resource tagging. and removed needs-triage Waiting for first response or review from a maintainer. labels Jun 27, 2024
@james-flwls
Copy link
Author

james-flwls commented Sep 16, 2024

Is there any idea if this bug will be picked up - would be good to get a fix in as we can't propogate tags at the moment

Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v5.73.0 milestone Oct 21, 2024
Copy link

This functionality has been released in v5.73.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/batch Issues and PRs that pertain to the batch service. tags Pertains to resource tagging.
Projects
None yet
3 participants