-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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 targets to aws_ssm_association #14246
Conversation
Fixes: #13975 ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSSSMAssociation_' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/05/05 20:32:43 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSSSMAssociation_ -timeout 120m === RUN TestAccAWSSSMAssociation_basic --- PASS: TestAccAWSSSMAssociation_basic (139.13s) === RUN TestAccAWSSSMAssociation_withTargets --- PASS: TestAccAWSSSMAssociation_withTargets (33.19s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 172.343s ```
@stack72 Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, one minor doc nit
* `parameters` - (Optional) Additional parameters to pass to the SSM document. | ||
* `targets` - (Optional) The targets (either instances or tags). Instances are specified using Key=instanceids,Values=instanceid1,instanceid2. Tags are specified using Key=tag name,Values=tag value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a note that only one item is allowed here?
@@ -2085,3 +2086,39 @@ func sliceContainsMap(l []interface{}, m map[string]interface{}) (int, bool) { | |||
|
|||
return -1, false | |||
} | |||
|
|||
func expandAwsSsmTargets(d *schema.ResourceData) []*ssm.Target { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding these here
|
||
return resourceAwsSsmAssociationRead(d, meta) | ||
} | ||
|
||
func resourceAwsSsmAssociationRead(d *schema.ResourceData, meta interface{}) error { | ||
ssmconn := meta.(*AWSClient).ssmconn | ||
|
||
log.Printf("[DEBUG] Reading SSM Assosciation: %s", d.Id()) | ||
log.Printf("[DEBUG] Reading SSM Association: %s", d.Id()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stack72 I'm curious on this - how do you go about going from pre-0.9.5 SSM associations (name+instanceid) to the new ones, short of hand editing the state or deleting them and reassociating |
Hi @nicwise The old ones will still work - if you need to move to the new ones, just change the resource code locally and terraform will destroy and recreate the association Paul |
Odd @stack72 . We didn't change the terraform code at all, just did an Ended up using the command line to find the id's and inject them into the state, then push it back. |
Hi @nicwise Please can you drop some configuration here so that I can try to reproduce? Thanks Paul |
Sorry for the delay. Here's the TF:
and the state
this was failing, saying it didn't have an Sso we looked up the ID using the API, edited the state to include the line above, and 👍 We only had, I think, 9 of these, so it wasn't huge to do by hand. |
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. |
Fixes: #13975