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

Issue #3407 aws_ssm_association handles updates incorrectly #5537

Merged
merged 5 commits into from
Aug 30, 2018

Conversation

danlaramay
Copy link

Fixes #3407

Changes proposed in this pull request:

  • Fixed Typo: Corrected Assoscation to Assocation
  • resourceAwsSsmAssocationUpdate needs to pass everything to AWS because the AWS API creates a new version of the association rather than updating it in-place. I updated the function to check for any changes and update everything if there are.

Output from acceptance testing:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSSSMAssociation'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -run=TestAccAWSSSMAssociation -timeout 120m
=== RUN   TestAccAWSSSMAssociation_basic
--- PASS: TestAccAWSSSMAssociation_basic (146.89s)
=== RUN   TestAccAWSSSMAssociation_withTargets
--- PASS: TestAccAWSSSMAssociation_withTargets (38.64s)
=== RUN   TestAccAWSSSMAssociation_withParameters
--- PASS: TestAccAWSSSMAssociation_withParameters (26.51s)
=== RUN   TestAccAWSSSMAssociation_withAssociationName
--- PASS: TestAccAWSSSMAssociation_withAssociationName (25.49s)
=== RUN   TestAccAWSSSMAssociation_withDocumentVersion
--- PASS: TestAccAWSSSMAssociation_withDocumentVersion (16.49s)
=== RUN   TestAccAWSSSMAssociation_withOutputLocation
--- PASS: TestAccAWSSSMAssociation_withOutputLocation (68.60s)
=== RUN   TestAccAWSSSMAssociation_withScheduleExpression
--- PASS: TestAccAWSSSMAssociation_withScheduleExpression (25.53s)
PASS
ok  	github.com/dpldb/terraform-provider-aws/aws	348.188s
...

@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Aug 13, 2018
@ajjl
Copy link

ajjl commented Aug 13, 2018

I am encountering the same issue. Thanks for addressing this.

@bflad bflad added bug Addresses a defect in current functionality. service/ssm Issues and PRs that pertain to the ssm service. labels Aug 13, 2018
@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Aug 14, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this, @dpldb! Left one minor code cleanup note but more importantly, are you able to write an acceptance test that fails against master and succeeds with this pull request? We would like to verify the fix as necessary and prevent regressions in the future. Please reach out if you need help with that or do not have time to implement. Thanks!


associationInput := &ssm.UpdateAssociationInput{
AssociationId: aws.String(d.Get("association_id").(string)),
}

// AWS creates a new version every time the association is updated, so everything should be passed in the update.

hasChanges := false
Copy link
Contributor

Choose a reason for hiding this comment

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

The resourceAwsSsmAssociationUpdate function is not performing any other API calls beyond UpdateAssociation so all the hasChanges logic can be removed 👍

Copy link
Author

Choose a reason for hiding this comment

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

Good point. I'll get rid of this.

@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label Aug 16, 2018
@danlaramay
Copy link
Author

@bflad Thanks for the code review and quick response. Happy to help. I'll take a look at the acceptance test.

@bflad bflad added this to the v1.34.0 milestone Aug 30, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @dpldb! Since its been two weeks and this is a bug fix, I have added an acceptance test that covers this behavior and refactored out the hasChanges variable in the update function so we can ship this. 🚀

--- PASS: TestAccAWSSSMAssociation_withDocumentVersion (23.27s)
--- PASS: TestAccAWSSSMAssociation_withAssociationNameAndScheduleExpression (26.62s)
--- PASS: TestAccAWSSSMAssociation_withScheduleExpression (28.05s)
--- PASS: TestAccAWSSSMAssociation_withParameters (29.40s)
--- PASS: TestAccAWSSSMAssociation_withAssociationName (32.30s)
--- PASS: TestAccAWSSSMAssociation_withTargets (47.62s)
--- PASS: TestAccAWSSSMAssociation_withOutputLocation (68.47s)
--- PASS: TestAccAWSSSMAssociation_basic (132.95s)

@bflad bflad merged commit 03a3357 into hashicorp:master Aug 30, 2018
bflad added a commit that referenced this pull request Aug 30, 2018
@danlaramay
Copy link
Author

Thanks @bflad

@bflad
Copy link
Contributor

bflad commented Aug 30, 2018

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

@ghost
Copy link

ghost commented Apr 3, 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 3, 2020
@breathingdust breathingdust removed the waiting-response Maintainers are waiting on response from community or contributor. label Sep 17, 2021
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/ssm Issues and PRs that pertain to the ssm service. size/M Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws_ssm_parameter with association name seems to interfere with parameters and vice versa
4 participants