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

aws_ssm_document should be deleted/recreated when it can't be versioned #7516

Closed
jfharden opened this issue Feb 12, 2019 · 3 comments · Fixed by #9313
Closed

aws_ssm_document should be deleted/recreated when it can't be versioned #7516

jfharden opened this issue Feb 12, 2019 · 3 comments · Fixed by #9313
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ssm Issues and PRs that pertain to the ssm service.
Milestone

Comments

@jfharden
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

0.11.11

Affected Resource(s)

  • aws_ssm_document

Terraform Configuration Files

resource "aws_ssm_document" "session_manager_preferences" {
  name            = "SSM-SessionManagerRunShell"
  document_type   = "Session"
  document_format = "JSON"

  content = <<DOC
{
    "schemaVersion": "1.0",
    "description": "Document to hold regional settings for Session Manager",
    "sessionType": "Standard_Stream",
    "inputs": {
        "s3BucketName": "example-bucket",
        "s3KeyPrefix": "example-path/",
        "s3EncryptionEnabled": true
    }
}
DOC
}

Expected Behavior

When the resource has been changed outside terraform, terraform detects the change and changes the document back, given than versioning isn't supported prior to ssm document schema version 2.0 I would expect those to be recreated, not ignored.

Actual Behavior

Terraform ignores the change.

Steps to Reproduce

  1. Delete the SSM-SessionManagerRunShell document that exists by default with aws cli command: aws ssm delete-document --name SSM-SessionManagerRunShell (This is because of a separate issue which isn't relevant here).
  2. Apply the document resource above
  3. In the aws console edit the preferences for session manager sessions and change the bucket prefix (you will also need to deselect cloudwatch logging due to a bug in the aws UI)
  4. Apply the document resource above (and see no changes)
@nywilken nywilken added service/ssm Issues and PRs that pertain to the ssm service. question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. labels Feb 12, 2019
@tracypholmes tracypholmes added enhancement Requests to existing resources that expand the functionality or scope. and removed question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. labels Jun 17, 2019
bflad added a commit that referenced this issue Jul 11, 2019
… state for drift detection

Reference: #7516

Output from acceptance testing:

```
--- PASS: TestAccAWSSSMDocument_params (21.85s)
--- PASS: TestAccAWSSSMDocument_permission_private (21.85s)
--- PASS: TestAccAWSSSMDocument_permission_public (26.31s)
--- PASS: TestAccAWSSSMDocument_permission_batching (36.87s)
--- PASS: TestAccAWSSSMDocument_automation (38.18s)
--- PASS: TestAccAWSSSMDocument_SchemaVersion_1 (41.09s)
--- PASS: TestAccAWSSSMDocument_update (42.55s)
--- PASS: TestAccAWSSSMDocument_DocumentFormat_YAML (44.60s)
--- PASS: TestAccAWSSSMDocument_session (47.62s)
--- PASS: TestAccAWSSSMDocument_permission_change (50.90s)
--- PASS: TestAccAWSSSMDocument_Tags (54.43s)
--- PASS: TestAccAWSSSMDocument_basic (70.90s)
PASS
```
@bflad bflad added this to the v2.19.0 milestone Jul 11, 2019
@bflad
Copy link
Contributor

bflad commented Jul 11, 2019

Hi folks 👋 In #9313, which was just merged for release in Terraform AWS Provider version 2.19.0 later today, we did a few things in this regard:

  • Verified via a new acceptance test that schema version 1.0 SSM Documents do properly update-in-place (maybe there was a previous restriction that is no longer)
  • Ensured that the content argument in the resource is always refreshed into the Terraform state so it appropriately shows out of band changes
  • Added resource import support, which will allow you to assume management of existing SSM Documents (potentially like SSM-SessionManagerRunShell)

These combined should be hopefully cover everything here to ensure the Terraform resource is doing what it should in this case, but if not please feel free to submit further bug reports or feature requests. Thanks!

@bflad
Copy link
Contributor

bflad commented Jul 11, 2019

The above mentioned changes have been released in version 2.19.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 for triage. Thanks!

@ghost
Copy link

ghost commented Nov 2, 2019

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 Nov 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ssm Issues and PRs that pertain to the ssm service.
Projects
None yet
4 participants