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

[Enhancement]: aws_ec2_serial_console_access deletion should revert back to its initial status #40290

Open
christophetd opened this issue Nov 25, 2024 · 1 comment
Labels
enhancement Requests to existing resources that expand the functionality or scope. needs-triage Waiting for first response or review from a maintainer. service/ec2 Issues and PRs that pertain to the ec2 service.

Comments

@christophetd
Copy link
Contributor

Description

#18503 introduced aws_ec2_serial_console_access to turn on / off EC2 serial console access.

The current behavior on deletion is to disable it: https://github.com/hashicorp/terraform-provider-aws/blob/main/internal/service/ec2/ec2_serial_console_access.go#L83-L94

However, this is problematic in the following case:

  • Before running Terraform: EC2 serial console access is enabled
  • A Terraform apply happens with the aws_ec2_serial_console_access resource with enabled = true
  • A Terraform destroy happens

At this point, the EC2 serial console access should be left to its initial state ("enabled") that was here before Terraform ran.

From an implementation perspective, I'd suggest:

  1. Upon creation of the resource, store the current activation status of EC2 serial console access in the TF state
  2. Upon deletion of the resource, make sure the resulting status matches the initial one

Feedback/thoughts welcome

cc @ewbankkit who worked on the initial PR

Affected Resource(s) and/or Data Source(s)

  • aws_ec2_serial_console_access

Potential Terraform Configuration

No response

References

#18503

Would you like to implement a fix?

Yes

@christophetd christophetd added the enhancement Requests to existing resources that expand the functionality or scope. label Nov 25, 2024
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added service/ec2 Issues and PRs that pertain to the ec2 service. needs-triage Waiting for first response or review from a maintainer. labels Nov 25, 2024
@christophetd christophetd changed the title [Enhancement]: EC2 Serial Console access should [Enhancement]: aws_ec2_serial_console_access deletion should revert back to its initial status Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Requests to existing resources that expand the functionality or scope. needs-triage Waiting for first response or review from a maintainer. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

No branches or pull requests

1 participant