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]: Changing repository_name argument of aws_codecommit_repository resource forces unnecessary replacement #32161

Closed
Michagogo opened this issue Jun 22, 2023 · 3 comments · Fixed by #32207
Labels
bug Addresses a defect in current functionality. service/codecommit Issues and PRs that pertain to the codecommit service.
Milestone

Comments

@Michagogo
Copy link
Contributor

Michagogo commented Jun 22, 2023

Terraform Core Version

1.5.1, 1.4.2

AWS Provider Version

5.4.0, 4.55.0

Affected Resource(s)

aws_codecommit_repository

Expected Behavior

When changing the repository_name argument, the repository name should be updated in-place, without anything else changing besides the attributes derived from the name (Git access URIs, ARN, etc.).

The provider should call the UpdateRepositoryName action on the CodeCommit API, which is also exposed by the Go SDK.

ForceNew should be omitted at https://github.com/hashicorp/terraform-provider-aws/blob/main/internal/service/codecommit/repository.go#L38, a function resourceUpdateRepositoryName should exist calling the aforementioned function in the SDK, and resourceRepositoryUpdate at https://github.com/hashicorp/terraform-provider-aws/blob/main/internal/service/codecommit/repository.go#L143 should call said function in the event of a name change.

Actual Behavior

Changing the repository name forces the resource to be replaced unnecessarily. Changing a repository name is an action supported by the service. However, that action isn't implemented by the provider, and instead that argument in the schema has ForceNew set.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_codecommit_repository" "test" {
    repository_name = "test-repo-to-rename"
}

Steps to Reproduce

  1. Create file attached above
  2. terraform init
  3. terraform apply -auto-approve
  4. Modify line 2 of the configuration file, e.g. sed -i 's/to-/post-/' main.tf
  5. terraform plan
  6. Observe aws_codecommit_repository.test must be replaced and # forces replacement next to repository_name

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

https://docs.aws.amazon.com/codecommit/latest/APIReference/API_UpdateRepositoryName.html

https://docs.aws.amazon.com/sdk-for-go/api/service/codecommit/#CodeCommit.UpdateRepositoryName

https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-change-repository.html

Would you like to implement a fix?

No (Well, I'd like to, seems simple enough, but my knowledge of Go is unfortunately nonexistent)

@Michagogo Michagogo added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Jun 22, 2023
@github-actions github-actions bot added the service/codecommit Issues and PRs that pertain to the codecommit service. label Jun 22, 2023
@github-actions
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.

@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Jun 22, 2023
@Michagogo Michagogo changed the title [Bug]: Changing repository_name argument to aws_codecommit_repository resource forces replacement [Bug]: Changing repository_name argument of aws_codecommit_repository resource forces replacement Jun 22, 2023
@Michagogo Michagogo changed the title [Bug]: Changing repository_name argument of aws_codecommit_repository resource forces replacement [Bug]: Changing repository_name argument of aws_codecommit_repository resource forces unnecessary replacement Jun 22, 2023
@github-actions github-actions bot added this to the v5.22.0 milestone Oct 13, 2023
@github-actions
Copy link

This functionality has been released in v5.22.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 20, 2023
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/codecommit Issues and PRs that pertain to the codecommit service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants