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]: defaults_tags not always created on batch_job_definition version #38302

Closed
chrisrushtonLN opened this issue Jul 9, 2024 · 5 comments · Fixed by #39797
Closed

[Bug]: defaults_tags not always created on batch_job_definition version #38302

chrisrushtonLN opened this issue Jul 9, 2024 · 5 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

@chrisrushtonLN
Copy link

Terraform Core Version

1.7.5

AWS Provider Version

5.56.1

Affected Resource(s)

aws_batch_job_definition

Expected Behavior

Default tags should be applied on creation of a new batch job definition version. The plan output shows that these should be added to the new revision

# module.batch_jobs["xxx"].aws_batch_job_definition.this will be updated in-place
  ~ resource "aws_batch_job_definition" "this" {
      ~ arn                        = "arn:aws:batch:eu-west-1:xxx:job-definition/xxx:4" -> (known after apply)
      ~ container_properties       = jsonencode(
          ~ {
              ~ mountPoints          = [
                  + {
                      + containerPath = "xxx"
                      + sourceVolume  = "xxx"
                    },
                  + {
                      + containerPath = "xxx"
                      + sourceVolume  = "xxx"
                    },
                  + {
                      + containerPath = "xxx"
                      + sourceVolume  = "xxx"
                    },
                    {
                        containerPath = "xxx"
                        sourceVolume  = "xxx"
                    },
                    # (1 unchanged element hidden)
                ]
              ~ volumes              = [
                  + {
                      + host = {
                          + sourcePath = "xxx"
                        }
                      + name = "xxx"
                    },
                  + {
                      + host = {
                          + sourcePath = "xxx"
                        }
                      + name = "xxx"
                    },
                  + {
                      + host = {
                          + sourcePath = "xxx"
                        }
                      + name = "xxx"
                    },
                    {
                        host = {
                            sourcePath = "xxx"
                        }
                        name = "xxx"
                    },
                    # (1 unchanged element hidden)
                ]
                # (10 unchanged attributes hidden)
            }
        )
        id                              = "arn:aws:batch:eu-west-1:xxx:job-definition/xxx:4"
        name                        = "xxx"
      ~ revision                   = 4 -> (known after apply)
        tags                       = {}
      ~ tags_all                   = {
          + "Environment"   = "xxx"
          + "HostsGroup"    = "xxx"
          + "application"   = "xxx"
          + "lifecycle"     = "xxx"
          + "market"        = "xxx"
          + "owner_email"   = "xxx"
          + "product"       = "xxx"
          + "project"       = "xxx"
          + "support_email" = "xxx"
        }
        # (7 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Actual Behavior

New version is created, but no tags are present at all on the resource. If I run again, it will show the tags_all as additions and will create a new version with the tags. Its very intermittent.

Key information to note: My plan has 100's of batch job definitions in, so it's a fairly big state file if that has any affect.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

xxx

Steps to Reproduce

Mentioned above

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@chrisrushtonLN chrisrushtonLN added the bug Addresses a defect in current functionality. label Jul 9, 2024
Copy link

github-actions bot commented Jul 9, 2024

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 Jul 9, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Jul 9, 2024
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Jul 9, 2024
@chrisrushtonLN
Copy link
Author

Additional Info

I believe the aws_batch_definition resource is showing as changed when it's actually going to create a new version and a new version needs the tags applied to it again.

Example:

The current version of my batch job definition has the tags applied. When I make some changes for a new version the plan output shows no tags changed. I think this is because it's seeing the current tags as applied and think's there's no changes to them?

resource "aws_batch_job_definition" "this" {
      ~ arn                        = "arn:aws:batch:eu-west-1:xxx:job-definition/xxx-liv:5" -> (known after apply)
      ~ container_properties       = jsonencode(
          ~ {
              ~ environment          = [
                  + {
                      + name  = "xxx"
                      + value = "xxx"
                    },
                  + {
                      + name  = "xxx"
                      + value = "xxx"
                    },
                    {
                        name  = "xxx"
                        value = "xxx"
                    },
                  - {
                      - name  = "APP_NAME"
                      - value = "xxx"
                    },
                ]
              ~ mountPoints          = [
                  - {
                      - containerPath = "xxx"
                      - sourceVolume  = "xxx"
                    },
                  - {
                      - containerPath = "xxx"
                      - sourceVolume  = "xxx"
                    },
                  - {
                      - containerPath = "xxx"
                      - sourceVolume  = "xxx"
                    },
                    {
                        containerPath = "xxx"
                        sourceVolume  = "xxx"
                    },
                    # (1 unchanged element hidden)
                ]
              ~ volumes              = [
                  - {
                      - host = {
                          - sourcePath = "xxx"
                        }
                      - name = "xxx"
                    },
                  - {
                      - host = {
                          - sourcePath = "xxx"
                        }
                      - name = "xxx"
                    },
                  - {
                      - host = {
                          - sourcePath = "xxx"
                        }
                      - name = "xxx"
                    },
                    {
                        host = {
                            sourcePath = "xxx"
                        }
                        name = "xxx"
                    },
                    # (1 unchanged element hidden)
                ]
                # (10 unchanged attributes hidden)
            }
        )
        id                         = "arn:aws:batch:eu-west-1:xxx:job-definition/xxx:5"
        name                       = "xxx"
      ~ revision                   = 5 -> (known after apply)
        tags                       = {}
        # (8 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

This means when the new version is created, it has no tags on it. To reiterate I am using the tags_all on the provider.

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