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 DoesNotExistException for missing Maintenance Window Target #16451

Closed
kevinkupski opened this issue Nov 26, 2020 · 3 comments · Fixed by #16478
Closed

AWS SSM DoesNotExistException for missing Maintenance Window Target #16451

kevinkupski opened this issue Nov 26, 2020 · 3 comments · Fixed by #16478
Labels
bug Addresses a defect in current functionality. service/ssm Issues and PRs that pertain to the ssm service.
Milestone

Comments

@kevinkupski
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 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
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v0.13.5
+ provider registry.terraform.io/hashicorp/aws v3.16.0

Affected Resource(s)

  • aws_ssm_maintenance_window_target

Terraform Configuration Files

resource "aws_ssm_maintenance_window" "default" {
  cutoff   = 1
  duration = 3
  name     = "default"
  schedule = "cron(0 0 2 ? * * *)"
}

resource "aws_ssm_maintenance_window_target" "default" {
  window_id     = aws_ssm_maintenance_window.default.id
  name          = "default-target"
  description   = "Default maintenance window target"
  resource_type = "INSTANCE"

  targets {
    key    = "tag:SystemManagement"
    values = ["default"]
  }
}

Debug Output

Panic Output

Error: DoesNotExistException: Maintenance window mw-XXXX does not exist

Expected Behavior

After deleting all resources in our AWS Account via aws-nuke, I'd like to refresh the Terraform state to remove the deleted resources from the state as well. I expect that after running terraform refresh my state should be updated.

Actual Behavior

terraform refresh errors with Error: DoesNotExistException: Maintenance window mw-XXXX does not exist. This seems to be caused by the aws_ssm_maintenance_window_target resource. When I manually remove it from the state via terraform state rm aws_ssm_maintenance_window.default and then run the refresh again, everything works fine.

Steps to Reproduce

  1. terraform apply
  2. Delete the resource via AWS cli, aws-nuke or via the Developer Console.
  3. terraform refresh

Important Factoids

Nothing I know of.

References

Looks similar to the following issues:

@ghost ghost added the service/ssm Issues and PRs that pertain to the ssm service. label Nov 26, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Nov 26, 2020
@DrFaust92 DrFaust92 added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Nov 28, 2020
@bflad bflad added this to the v3.20.0 milestone Dec 2, 2020
@bflad
Copy link
Contributor

bflad commented Dec 2, 2020

The fix for this has been merged and will release with version 3.20.0 of the Terraform AWS Provider. Thank you to @DrFaust92 for the implementation. 👍

@ghost
Copy link

ghost commented Dec 3, 2020

This has been released in version 3.20.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 Jan 1, 2021

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 as resolved and limited conversation to collaborators Jan 1, 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants