-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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]: Image Builder Container Recipe Resource Does not Update Target Repository Name #39803
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
Hey @clarkhathawayaltview 👋 Thank you for taking the time to raise this! Are you able to supply debug logs (redacted as needed) for whoever picks this up to look into it? Looking at the relevant section of the codebase for that argument, I would suspect that making this type of change would force the resource to be recreated. If that's not happening (and I've not misunderstood what you're reporting), I suspect there may be other factors at play here. |
I don't think we have any debug logs we can supply at this time. The original body of the issue should be sufficient for reproducing it. We tested it several times before we opened the issue to be sure. |
@clarkhathawayaltview the provided sample configuration can't be planned/applied as is (particularly given that your reproduction notes indicated you're using the configuration within a child module). I absolutely understand if you're not able to supply debug logging -- we get that fairly often, and given the sensitive and sometimes transient nature of some of these issues, it's makes sense. That said, we're happy to look into this to see what we can find, you just may wind up getting further questions from whoever picks this up to look into it more. A lingering question I have is whether, when planning, the plan logs indicate that the expected change would be made? |
I doubt that it being a child module is material here. You can probably run this as a root module. Those components can also be replaced with AWS managed components or removed entirely. The variable for the ECR repository name doesn't even need to be a real repository iirc. We heavily rely on this provider so I will be available if there are any more questions. I know that HCP Terraform did indicate that the resource had been updated when I looked at the plan/apply UI. |
Hi @clarkhathawayaltview , hi @justinretzolk. If both of you are fine, I will try to reproduce the scenario with the steps mentioned. Terraform and provider version are $ terraform version
Terraform v1.9.6
on linux_amd64
+ provider registry.terraform.io/hashicorp/aws v5.72.0
Your version of Terraform is out of date! The latest version
is 1.9.8. You can update by downloading from https://www.terraform.io/downloads.html Between the two # Ensure that we have two existing ECR repositories we can use for the test
resource "aws_ecr_repository" "repository_1" {
name = "repository_1"
}
resource "aws_ecr_repository" "repository_2" {
name = "repository_2"
}
resource "aws_imagebuilder_container_recipe" "example" {
name = "example"
version = "1.0.0"
container_type = "DOCKER"
parent_image = "arn:aws:imagebuilder:eu-central-1:aws:image/amazon-linux-2023-x86-latest/x.x.x"
target_repository {
repository_name = aws_ecr_repository.repository_1.name
service = "ECR"
}
component {
component_arn = "arn:aws:imagebuilder:eu-central-1:aws:component/aws-cli-version-2-linux/x.x.x"
}
dockerfile_template_data = <<EOF
FROM {{{ imagebuilder:parentImage }}}
{{{ imagebuilder:environments }}}
{{{ imagebuilder:components }}}
EOF
} First # aws_ecr_repository.repository_1 will be created
+ resource "aws_ecr_repository" "repository_1" {
+ arn = (known after apply)
+ id = (known after apply)
+ image_tag_mutability = "MUTABLE"
+ name = "repository_1"
+ registry_id = (known after apply)
+ repository_url = (known after apply)
+ tags_all = (known after apply)
}
# aws_ecr_repository.repository_2 will be created
+ resource "aws_ecr_repository" "repository_2" {
+ arn = (known after apply)
+ id = (known after apply)
+ image_tag_mutability = "MUTABLE"
+ name = "repository_2"
+ registry_id = (known after apply)
+ repository_url = (known after apply)
+ tags_all = (known after apply)
}
# aws_imagebuilder_container_recipe.example will be created
+ resource "aws_imagebuilder_container_recipe" "example" {
+ arn = (known after apply)
+ container_type = "DOCKER"
+ date_created = (known after apply)
+ dockerfile_template_data = <<-EOT
FROM {{{ imagebuilder:parentImage }}}
{{{ imagebuilder:environments }}}
{{{ imagebuilder:components }}}
EOT
+ encrypted = (known after apply)
+ id = (known after apply)
+ name = "example"
+ owner = (known after apply)
+ parent_image = "arn:aws:imagebuilder:eu-central-1:aws:image/amazon-linux-2023-x86-latest/x.x.x"
+ platform = (known after apply)
+ tags_all = (known after apply)
+ version = "1.0.0"
+ component {
+ component_arn = "arn:aws:imagebuilder:eu-central-1:aws:component/aws-cli-version-2-linux/x.x.x"
}
+ target_repository {
+ repository_name = "repository_1"
+ service = "ECR"
}
}
Plan: 3 to add, 0 to change, 0 to destroy The change has been applied. Then I manually updated one line in the Terraform code # Old
# repository_name = aws_ecr_repository.repository_1.name
# New
repository_name = aws_ecr_repository.repository_2.name Second
The update in the Terraform code triggers a change. Please let me know, if I need to review/ update the approach I took. |
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. |
This functionality has been released in v5.74.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! |
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. |
Terraform Core Version
1.9.6
AWS Provider Version
5.72.0
Affected Resource(s)
aws_imagebuilder_container_recipe
Expected Behavior
When updating the 'repository_name' argument in the 'target_repository' argument configuration block, a standard plan & apply should update the target repository name in AWS for this container recipe.
Actual Behavior
The plan & apply phases are successful but the target repository name in AWS remains unchanged for this container recipe.
Relevant Error/Panic Output Snippet
Terraform Configuration Files
container-recipes.tf:
Steps to Reproduce
ecr-repository-name
. I am using it as part of a child module and am passing the name of an ECR repository resource defined in the root module.ecr-repository-name
that differs from the target repository name in the AWS container recipe created in step 2ecr-repository-name
. I changed this value by passing a string literal from the root module instead of my ECR resource name.Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: