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

r/aws_instance - add disable_api_stop argument #25185

Merged
merged 11 commits into from
Jun 18, 2022

Conversation

wedge-jarrad
Copy link
Contributor

@wedge-jarrad wedge-jarrad commented Jun 6, 2022

Implements stop protection for EC2 instances https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html#Using_StopProtection.

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment 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 pull request followers and do not help prioritize the request

Closes #25018

Output from acceptance testing:

$ gmake testacc TESTS='TestAccEC2Instance_disableAPIStop|TestAccEC2Instance.*basic|TestAccEC2LaunchTemplate_basic|TestAccEC2LaunchTemplate_data|TestAccEC2InstanceDataSource_disableApiStopTermination' PKG=ec2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccEC2Instance_disableAPIStop|TestAccEC2Instance.*basic|TestAccEC2LaunchTemplate_basic|TestAccEC2LaunchTemplate_data|TestAccEC2InstanceDataSource_disableApiStopTermination'  -timeout 180m
=== RUN   TestAccEC2InstanceDataSource_basic
=== PAUSE TestAccEC2InstanceDataSource_basic
=== RUN   TestAccEC2InstanceDataSource_disableApiStopTermination
=== PAUSE TestAccEC2InstanceDataSource_disableApiStopTermination
=== RUN   TestAccEC2Instance_basic
=== PAUSE TestAccEC2Instance_basic
=== RUN   TestAccEC2Instance_disableAPIStop
=== PAUSE TestAccEC2Instance_disableAPIStop
=== RUN   TestAccEC2Instance_EBSRootDevice_basic
=== PAUSE TestAccEC2Instance_EBSRootDevice_basic
=== RUN   TestAccEC2Instance_LaunchTemplate_basic
=== PAUSE TestAccEC2Instance_LaunchTemplate_basic
=== RUN   TestAccEC2InstanceTypeDataSource_basic
=== PAUSE TestAccEC2InstanceTypeDataSource_basic
=== RUN   TestAccEC2InstanceTypesDataSource_basic
=== PAUSE TestAccEC2InstanceTypesDataSource_basic
=== RUN   TestAccEC2InstancesDataSource_basic
=== PAUSE TestAccEC2InstancesDataSource_basic
=== RUN   TestAccEC2LaunchTemplate_basic
=== PAUSE TestAccEC2LaunchTemplate_basic
=== RUN   TestAccEC2LaunchTemplate_data
=== PAUSE TestAccEC2LaunchTemplate_data
=== CONT  TestAccEC2InstanceDataSource_basic
=== CONT  TestAccEC2LaunchTemplate_basic
=== CONT  TestAccEC2InstanceTypeDataSource_basic
=== CONT  TestAccEC2Instance_basic
=== CONT  TestAccEC2Instance_disableAPIStop
=== CONT  TestAccEC2Instance_LaunchTemplate_basic
=== CONT  TestAccEC2Instance_EBSRootDevice_basic
=== CONT  TestAccEC2LaunchTemplate_data
=== CONT  TestAccEC2InstanceTypesDataSource_basic
=== CONT  TestAccEC2InstanceDataSource_disableApiStopTermination
=== CONT  TestAccEC2InstancesDataSource_basic
--- PASS: TestAccEC2InstanceTypeDataSource_basic (18.72s)
--- PASS: TestAccEC2InstanceTypesDataSource_basic (23.93s)
--- PASS: TestAccEC2LaunchTemplate_basic (23.93s)
--- PASS: TestAccEC2LaunchTemplate_data (23.96s)
--- PASS: TestAccEC2Instance_EBSRootDevice_basic (71.36s)
--- PASS: TestAccEC2Instance_disableAPIStop (105.45s)
--- PASS: TestAccEC2Instance_LaunchTemplate_basic (108.09s)
--- PASS: TestAccEC2Instance_basic (111.45s)
--- PASS: TestAccEC2InstanceDataSource_basic (128.08s)
--- PASS: TestAccEC2InstanceDataSource_disableApiStopTermination (128.90s)
--- PASS: TestAccEC2InstancesDataSource_basic (339.51s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	339.670s

@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. service/ec2 Issues and PRs that pertain to the ec2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/L Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. labels Jun 6, 2022
@justinretzolk justinretzolk added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Jun 6, 2022
@wedge-jarrad wedge-jarrad changed the title Support disable_api_stop for EC2 instances r/aws_instance - add disable_api_stop argument Jun 8, 2022
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM 🚀.

% make testacc TESTARGS='-run=TestAccEC2Instance_disableAPIStop\|TestAccEC2Instance_basic\|TestAccEC2InstanceDataSource_disableApiStopTermination\|TestAccEC2InstanceDataSource_basic\|TestAccEC2LaunchTemplateDataSource_name\|TestAccEC2LaunchTemplate_basic\|TestAccEC2LaunchTemplate_data' PKG=ec2 ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 3  -run=TestAccEC2Instance_disableAPIStop\|TestAccEC2Instance_basic\|TestAccEC2InstanceDataSource_disableApiStopTermination\|TestAccEC2InstanceDataSource_basic\|TestAccEC2LaunchTemplateDataSource_name\|TestAccEC2LaunchTemplate_basic\|TestAccEC2LaunchTemplate_data -timeout 180m
=== RUN   TestAccEC2InstanceDataSource_basic
=== PAUSE TestAccEC2InstanceDataSource_basic
=== RUN   TestAccEC2InstanceDataSource_disableApiStopTermination
=== PAUSE TestAccEC2InstanceDataSource_disableApiStopTermination
=== RUN   TestAccEC2Instance_basic
=== PAUSE TestAccEC2Instance_basic
=== RUN   TestAccEC2Instance_disableAPIStop
=== PAUSE TestAccEC2Instance_disableAPIStop
=== RUN   TestAccEC2LaunchTemplateDataSource_name
=== PAUSE TestAccEC2LaunchTemplateDataSource_name
=== RUN   TestAccEC2LaunchTemplate_basic
=== PAUSE TestAccEC2LaunchTemplate_basic
=== RUN   TestAccEC2LaunchTemplate_data
=== PAUSE TestAccEC2LaunchTemplate_data
=== CONT  TestAccEC2InstanceDataSource_basic
=== CONT  TestAccEC2LaunchTemplateDataSource_name
=== CONT  TestAccEC2LaunchTemplate_data
--- PASS: TestAccEC2LaunchTemplate_data (18.00s)
=== CONT  TestAccEC2LaunchTemplate_basic
--- PASS: TestAccEC2LaunchTemplate_basic (14.36s)
=== CONT  TestAccEC2Instance_disableAPIStop
--- PASS: TestAccEC2LaunchTemplateDataSource_name (45.59s)
=== CONT  TestAccEC2Instance_basic
--- PASS: TestAccEC2InstanceDataSource_basic (121.58s)
=== CONT  TestAccEC2InstanceDataSource_disableApiStopTermination
--- PASS: TestAccEC2Instance_basic (126.82s)
--- PASS: TestAccEC2Instance_disableAPIStop (161.58s)
--- PASS: TestAccEC2InstanceDataSource_disableApiStopTermination (192.25s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	318.838s

@ewbankkit
Copy link
Contributor

% make semall providerlint golangci-lint
==> Running Semgrep checks locally (must have semgrep installed)...
Scanning 3955 files with 37 go rules.
  100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████|3955/3955 tasks

Some files were skipped or only partially analyzed.
  Scan was limited to files tracked by git.
  Scan skipped: 1613 files matching .semgrepignore patterns
  For a full list of skipped files, run semgrep with the --verbose flag.

Ran 37 rules on 3955 files: 0 findings.
If Semgrep missed a finding, please send us feedback to let us know!
  $ semgrep shouldafound --help
Scanning 3955 files with 107 go rules.
  100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████|3955/3955 tasks

Some files were skipped or only partially analyzed.
  Scan was limited to files tracked by git.
  Scan skipped: 1613 files matching .semgrepignore patterns
  For a full list of skipped files, run semgrep with the --verbose flag.

Ran 107 rules on 3955 files: 0 findings.
If Semgrep missed a finding, please send us feedback to let us know!
  $ semgrep shouldafound --help
Scanning 891 files with 179 go rules.
  100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████|891/891 tasks

Some files were skipped or only partially analyzed.
  Scan was limited to files tracked by git.
  Scan skipped: 1613 files matching .semgrepignore patterns
  For a full list of skipped files, run semgrep with the --verbose flag.

Ran 180 rules on 891 files: 0 findings.
If Semgrep missed a finding, please send us feedback to let us know!
  $ semgrep shouldafound --help
Scanning 883 files with 197 go rules.
  100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████|883/883 tasks

Some files were skipped or only partially analyzed.
  Scan was limited to files tracked by git.
  Scan skipped: 1613 files matching .semgrepignore patterns
  For a full list of skipped files, run semgrep with the --verbose flag.

Ran 201 rules on 883 files: 0 findings.
If Semgrep missed a finding, please send us feedback to let us know!
  $ semgrep shouldafound --help
Scanning 1122 files with 198 go rules.
  100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████|1122/1122 tasks

Some files were skipped or only partially analyzed.
  Scan was limited to files tracked by git.
  Scan skipped: 1613 files matching .semgrepignore patterns
  For a full list of skipped files, run semgrep with the --verbose flag.

Ran 198 rules on 1122 files: 0 findings.
If Semgrep missed a finding, please send us feedback to let us know!
  $ semgrep shouldafound --help
==> Checking source code with providerlint...
==> Checking source code with golangci-lint...

@ewbankkit
Copy link
Contributor

@wedge-jarrad Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 3c1f58b into hashicorp:main Jun 18, 2022
@github-actions github-actions bot added this to the v4.20.0 milestone Jun 18, 2022
drewmullen pushed a commit to ddericco/terraform-provider-aws that referenced this pull request Jun 20, 2022
drewmullen pushed a commit to ddericco/terraform-provider-aws that referenced this pull request Jun 20, 2022
@github-actions
Copy link

This functionality has been released in v4.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. Thank you!

@github-actions
Copy link

I'm going to lock this pull request 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 related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service. size/L Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support disable_api_stop for EC2 instances.
3 participants