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

provider/aws: add support for group name and path changes with group update function #3237

Merged
merged 4 commits into from
Nov 17, 2015

Conversation

pgray
Copy link
Contributor

@pgray pgray commented Sep 15, 2015

This provides support for updating groups. It removes the need to delete and then recreate the resource.

if err != nil {
if iamerr, ok := err.(awserr.Error); ok && iamerr.Code() == "NoSuchEntity" {
d.SetId("")
return nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a fine thing to do in the Read function, but I don't think this is the best behavior here: if (for some reason) the group gets deleted between the creation of the plan and the application of the plan then this will result in a successful exit but will leave the user with no group resource, even though the config says that the resource should exist. This is confusing, since users will expect the resource to match their config if terraform apply exits without error.

Instead I think it's better to actually fail in this case so we tell the user that it wasn't possible to converge on the settings in the config. If the user then makes a new plan the Read function will detect the resource is gone and the diff will include a create action as expected, allowing Terraform to create a fresh resource.

@apparentlymart
Copy link
Contributor

Thanks for doing this, @graycoder! I left one inline comment which is relatively minor. Once that's resolved we can get this merged. 😄

@pgray
Copy link
Contributor Author

pgray commented Oct 5, 2015

@apparentlymart I believe I've resolved the issue about swallowing NoSuchEntity errors on the group update. Please let me know if my change isn't quite what you had in mind.


request := &iam.GetGroupInput{
GroupName: aws.String(d.Id()),
GroupName: aws.String(name),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems superfluous; name isn't used outside of this iam.GetGroupInput struct.
Does it serve some purpose I don't see?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it made the code clearer.

@catsby
Copy link
Contributor

catsby commented Oct 28, 2015

I left some questions inline, otherwise looks good. Let me know when you get a chance to reply/update, and thanks!

@catsby catsby added the waiting-response An issue/pull request is waiting for a response from the community label Oct 28, 2015
@pgray
Copy link
Contributor Author

pgray commented Nov 17, 2015

@catsby I believe this should be up to date and ready to merge. Please let me know if you have any further questions.

@catsby
Copy link
Contributor

catsby commented Nov 17, 2015

This looks good, thanks!

catsby added a commit that referenced this pull request Nov 17, 2015
provider/aws: add support for group name and path changes with group update function
@catsby catsby merged commit 0bd8b32 into hashicorp:master Nov 17, 2015
bmcustodio pushed a commit to bmcustodio/terraform that referenced this pull request Sep 26, 2017
@ghost
Copy link

ghost commented Apr 30, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 30, 2020
@pgray pgray deleted the group-work branch May 30, 2020 06:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement provider/aws waiting-response An issue/pull request is waiting for a response from the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants