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

Force Delete Service Discovery Service #3538

Merged

Conversation

Tremualin
Copy link
Contributor

@Tremualin Tremualin commented Feb 26, 2018

Added an option to force delete the services by removing all the registered instances before deleting the services. Based the PR on the s3 removal code.

Tested only locally (and make test).
This is my first PR for a terraform provider, please let me know if there's anything missing.

Closes #4853.

@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Feb 26, 2018
@bflad bflad added service/servicediscovery Issues and PRs that pertain to the servicediscovery service. enhancement Requests to existing resources that expand the functionality or scope. labels Feb 27, 2018
@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label May 16, 2018
@Tremualin
Copy link
Contributor Author

Please check this PR.

@aeschright aeschright requested a review from a team June 25, 2019 19:24
@ewbankkit
Copy link
Contributor

It looks like this closes #4853.

@mkielar
Copy link
Contributor

mkielar commented Nov 24, 2020

I know I'm just bumping this up, but is there anything that stops this from being merged?
The original issue is now two and a half years old, and there's a working solution. Why not merge it?

@leonsmith
Copy link
Contributor

(This is the 15th oldest unmerged MR)

Guessing some acceptance tests might speed this up getting it merged?

Base automatically changed from master to main January 23, 2021 00:55
@breathingdust breathingdust requested a review from a team as a code owner January 23, 2021 00:55
@ewbankkit ewbankkit force-pushed the force_delete_service_discovery_service branch from 94aa788 to 143da73 Compare August 31, 2021 21:15
@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/S Managed by automation to categorize the size of a PR. and removed size/M Managed by automation to categorize the size of a PR. labels Aug 31, 2021
@github-actions github-actions bot added size/XL Managed by automation to categorize the size of a PR. and removed size/S Managed by automation to categorize the size of a PR. labels Sep 1, 2021
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 🚀.

Commercial
% TEST=./aws SWEEP=us-west-2 SWEEPARGS=-sweep-run=aws_service_discovery_service make sweep 
WARNING: This will destroy infrastructure. Use only in development accounts.
go test ./aws -v -sweep=us-west-2 -sweep-run=aws_service_discovery_service -timeout 60m
2021/09/01 09:18:25 [DEBUG] Running Sweepers for region (us-west-2):
2021/09/01 09:18:25 [DEBUG] Running Sweeper (aws_service_discovery_service) in region (us-west-2)
2021/09/01 09:18:25 [INFO] AWS Auth provider used: "EnvProvider"
2021/09/01 09:18:25 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2021/09/01 09:18:25 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2021/09/01 09:18:26 [DEBUG] Waiting for state to become: [success]
2021/09/01 09:18:27 [INFO] Deregistering Service Discovery Service (srv-jtm4m2mpyzy53nwe) Instance: ewbankkit-instance-1
2021/09/01 09:18:27 [DEBUG] Waiting for state to become: [SUCCESS]
2021/09/01 09:18:28 [TRACE] Waiting 200ms before next try
2021/09/01 09:18:28 [INFO] Deregistering Service Discovery Service (srv-jtm4m2mpyzy53nwe) Instance: ewbankkit-instance-2
2021/09/01 09:18:29 [DEBUG] Waiting for state to become: [SUCCESS]
2021/09/01 09:18:29 [TRACE] Waiting 200ms before next try
2021/09/01 09:18:29 [TRACE] Waiting 400ms before next try
2021/09/01 09:18:30 [DEBUG] Deleting Service Discovery Service: (srv-jtm4m2mpyzy53nwe)
2021/09/01 09:18:31 [DEBUG] Completed Sweeper (aws_service_discovery_service) in region (us-west-2) in 5.370342067s
2021/09/01 09:18:31 Completed Sweepers for region (us-west-2) in 5.370593443s
2021/09/01 09:18:31 Sweeper Tests for region (us-west-2) ran successfully:
	- aws_service_discovery_service
ok  	github.com/terraform-providers/terraform-provider-aws/aws	8.560s
% make testacc TEST=./aws TESTARGS='-run=TestAccAWSServiceDiscoveryService_\|TestAccAWSServiceDiscoveryHttpNamespace_\|TestAccAWSServiceDiscoveryPrivateDnsNamespace_\|TestAccAWSServiceDiscoveryPublicDnsNamespace_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSServiceDiscoveryService_\|TestAccAWSServiceDiscoveryHttpNamespace_\|TestAccAWSServiceDiscoveryPrivateDnsNamespace_\|TestAccAWSServiceDiscoveryPublicDnsNamespace_ -timeout 180m
=== RUN   TestAccAWSServiceDiscoveryHttpNamespace_basic
=== PAUSE TestAccAWSServiceDiscoveryHttpNamespace_basic
=== RUN   TestAccAWSServiceDiscoveryHttpNamespace_disappears
=== PAUSE TestAccAWSServiceDiscoveryHttpNamespace_disappears
=== RUN   TestAccAWSServiceDiscoveryHttpNamespace_Description
=== PAUSE TestAccAWSServiceDiscoveryHttpNamespace_Description
=== RUN   TestAccAWSServiceDiscoveryHttpNamespace_Tags
=== PAUSE TestAccAWSServiceDiscoveryHttpNamespace_Tags
=== RUN   TestAccAWSServiceDiscoveryPrivateDnsNamespace_basic
=== PAUSE TestAccAWSServiceDiscoveryPrivateDnsNamespace_basic
=== RUN   TestAccAWSServiceDiscoveryPrivateDnsNamespace_disappears
=== PAUSE TestAccAWSServiceDiscoveryPrivateDnsNamespace_disappears
=== RUN   TestAccAWSServiceDiscoveryPrivateDnsNamespace_Description
=== PAUSE TestAccAWSServiceDiscoveryPrivateDnsNamespace_Description
=== RUN   TestAccAWSServiceDiscoveryPrivateDnsNamespace_error_Overlap
=== PAUSE TestAccAWSServiceDiscoveryPrivateDnsNamespace_error_Overlap
=== RUN   TestAccAWSServiceDiscoveryPrivateDnsNamespace_Tags
=== PAUSE TestAccAWSServiceDiscoveryPrivateDnsNamespace_Tags
=== RUN   TestAccAWSServiceDiscoveryPublicDnsNamespace_basic
=== PAUSE TestAccAWSServiceDiscoveryPublicDnsNamespace_basic
=== RUN   TestAccAWSServiceDiscoveryPublicDnsNamespace_disappears
=== PAUSE TestAccAWSServiceDiscoveryPublicDnsNamespace_disappears
=== RUN   TestAccAWSServiceDiscoveryPublicDnsNamespace_Description
=== PAUSE TestAccAWSServiceDiscoveryPublicDnsNamespace_Description
=== RUN   TestAccAWSServiceDiscoveryPublicDnsNamespace_Tags
=== PAUSE TestAccAWSServiceDiscoveryPublicDnsNamespace_Tags
=== RUN   TestAccAWSServiceDiscoveryService_private
=== PAUSE TestAccAWSServiceDiscoveryService_private
=== RUN   TestAccAWSServiceDiscoveryService_public
=== PAUSE TestAccAWSServiceDiscoveryService_public
=== RUN   TestAccAWSServiceDiscoveryService_http
=== PAUSE TestAccAWSServiceDiscoveryService_http
=== RUN   TestAccAWSServiceDiscoveryService_disappears
=== PAUSE TestAccAWSServiceDiscoveryService_disappears
=== RUN   TestAccAWSServiceDiscoveryService_Tags
=== PAUSE TestAccAWSServiceDiscoveryService_Tags
=== CONT  TestAccAWSServiceDiscoveryHttpNamespace_basic
=== CONT  TestAccAWSServiceDiscoveryPublicDnsNamespace_disappears
=== CONT  TestAccAWSServiceDiscoveryPrivateDnsNamespace_disappears
=== CONT  TestAccAWSServiceDiscoveryPublicDnsNamespace_basic
=== CONT  TestAccAWSServiceDiscoveryPrivateDnsNamespace_error_Overlap
=== CONT  TestAccAWSServiceDiscoveryPrivateDnsNamespace_Description
=== CONT  TestAccAWSServiceDiscoveryPrivateDnsNamespace_basic
=== CONT  TestAccAWSServiceDiscoveryHttpNamespace_Description
=== CONT  TestAccAWSServiceDiscoveryPrivateDnsNamespace_Tags
=== CONT  TestAccAWSServiceDiscoveryService_http
=== CONT  TestAccAWSServiceDiscoveryService_public
=== CONT  TestAccAWSServiceDiscoveryService_private
=== CONT  TestAccAWSServiceDiscoveryPublicDnsNamespace_Tags
=== CONT  TestAccAWSServiceDiscoveryPublicDnsNamespace_Description
=== CONT  TestAccAWSServiceDiscoveryHttpNamespace_Tags
=== CONT  TestAccAWSServiceDiscoveryService_Tags
=== CONT  TestAccAWSServiceDiscoveryService_disappears
=== CONT  TestAccAWSServiceDiscoveryHttpNamespace_disappears
--- PASS: TestAccAWSServiceDiscoveryHttpNamespace_disappears (93.52s)
--- PASS: TestAccAWSServiceDiscoveryHttpNamespace_basic (99.28s)
--- PASS: TestAccAWSServiceDiscoveryHttpNamespace_Description (99.29s)
--- PASS: TestAccAWSServiceDiscoveryService_http (100.99s)
--- PASS: TestAccAWSServiceDiscoveryService_disappears (109.18s)
--- PASS: TestAccAWSServiceDiscoveryPublicDnsNamespace_disappears (113.93s)
--- PASS: TestAccAWSServiceDiscoveryPublicDnsNamespace_Description (118.59s)
--- PASS: TestAccAWSServiceDiscoveryPublicDnsNamespace_basic (120.48s)
--- PASS: TestAccAWSServiceDiscoveryHttpNamespace_Tags (123.49s)
--- PASS: TestAccAWSServiceDiscoveryService_Tags (126.52s)
--- PASS: TestAccAWSServiceDiscoveryPrivateDnsNamespace_basic (129.26s)
--- PASS: TestAccAWSServiceDiscoveryPrivateDnsNamespace_disappears (133.71s)
--- PASS: TestAccAWSServiceDiscoveryPrivateDnsNamespace_Description (135.99s)
--- PASS: TestAccAWSServiceDiscoveryPublicDnsNamespace_Tags (142.66s)
--- PASS: TestAccAWSServiceDiscoveryService_public (149.10s)
--- PASS: TestAccAWSServiceDiscoveryService_private (161.45s)
--- PASS: TestAccAWSServiceDiscoveryPrivateDnsNamespace_Tags (164.62s)
--- PASS: TestAccAWSServiceDiscoveryPrivateDnsNamespace_error_Overlap (193.97s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	197.309s
GovCloud
% make testacc TEST=./aws TESTARGS='-run=TestAccAWSServiceDiscoveryService_\|TestAccAWSServiceDiscoveryHttpNamespace_\|TestAccAWSServiceDiscoveryPrivateDnsNamespace_\|TestAccAWSServiceDiscoveryPublicDnsNamespace_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSServiceDiscoveryService_\|TestAccAWSServiceDiscoveryHttpNamespace_\|TestAccAWSServiceDiscoveryPrivateDnsNamespace_\|TestAccAWSServiceDiscoveryPublicDnsNamespace_ -timeout 180m
=== RUN   TestAccAWSServiceDiscoveryHttpNamespace_basic
=== PAUSE TestAccAWSServiceDiscoveryHttpNamespace_basic
=== RUN   TestAccAWSServiceDiscoveryHttpNamespace_disappears
=== PAUSE TestAccAWSServiceDiscoveryHttpNamespace_disappears
=== RUN   TestAccAWSServiceDiscoveryHttpNamespace_Description
=== PAUSE TestAccAWSServiceDiscoveryHttpNamespace_Description
=== RUN   TestAccAWSServiceDiscoveryHttpNamespace_Tags
=== PAUSE TestAccAWSServiceDiscoveryHttpNamespace_Tags
=== RUN   TestAccAWSServiceDiscoveryPrivateDnsNamespace_basic
=== PAUSE TestAccAWSServiceDiscoveryPrivateDnsNamespace_basic
=== RUN   TestAccAWSServiceDiscoveryPrivateDnsNamespace_disappears
=== PAUSE TestAccAWSServiceDiscoveryPrivateDnsNamespace_disappears
=== RUN   TestAccAWSServiceDiscoveryPrivateDnsNamespace_Description
=== PAUSE TestAccAWSServiceDiscoveryPrivateDnsNamespace_Description
=== RUN   TestAccAWSServiceDiscoveryPrivateDnsNamespace_error_Overlap
=== PAUSE TestAccAWSServiceDiscoveryPrivateDnsNamespace_error_Overlap
=== RUN   TestAccAWSServiceDiscoveryPrivateDnsNamespace_Tags
=== PAUSE TestAccAWSServiceDiscoveryPrivateDnsNamespace_Tags
=== RUN   TestAccAWSServiceDiscoveryPublicDnsNamespace_basic
=== PAUSE TestAccAWSServiceDiscoveryPublicDnsNamespace_basic
=== RUN   TestAccAWSServiceDiscoveryPublicDnsNamespace_disappears
=== PAUSE TestAccAWSServiceDiscoveryPublicDnsNamespace_disappears
=== RUN   TestAccAWSServiceDiscoveryPublicDnsNamespace_Description
=== PAUSE TestAccAWSServiceDiscoveryPublicDnsNamespace_Description
=== RUN   TestAccAWSServiceDiscoveryPublicDnsNamespace_Tags
=== PAUSE TestAccAWSServiceDiscoveryPublicDnsNamespace_Tags
=== RUN   TestAccAWSServiceDiscoveryService_private
=== PAUSE TestAccAWSServiceDiscoveryService_private
=== RUN   TestAccAWSServiceDiscoveryService_public
=== PAUSE TestAccAWSServiceDiscoveryService_public
=== RUN   TestAccAWSServiceDiscoveryService_http
=== PAUSE TestAccAWSServiceDiscoveryService_http
=== RUN   TestAccAWSServiceDiscoveryService_disappears
=== PAUSE TestAccAWSServiceDiscoveryService_disappears
=== RUN   TestAccAWSServiceDiscoveryService_Tags
=== PAUSE TestAccAWSServiceDiscoveryService_Tags
=== CONT  TestAccAWSServiceDiscoveryHttpNamespace_basic
=== CONT  TestAccAWSServiceDiscoveryPublicDnsNamespace_disappears
=== CONT  TestAccAWSServiceDiscoveryPrivateDnsNamespace_disappears
=== CONT  TestAccAWSServiceDiscoveryPrivateDnsNamespace_Description
=== CONT  TestAccAWSServiceDiscoveryService_http
=== CONT  TestAccAWSServiceDiscoveryService_Tags
=== CONT  TestAccAWSServiceDiscoveryService_private
=== CONT  TestAccAWSServiceDiscoveryService_disappears
=== CONT  TestAccAWSServiceDiscoveryPublicDnsNamespace_Tags
=== CONT  TestAccAWSServiceDiscoveryPublicDnsNamespace_basic
=== CONT  TestAccAWSServiceDiscoveryPublicDnsNamespace_Description
=== CONT  TestAccAWSServiceDiscoveryPrivateDnsNamespace_error_Overlap
=== CONT  TestAccAWSServiceDiscoveryHttpNamespace_Tags
=== CONT  TestAccAWSServiceDiscoveryService_public
=== CONT  TestAccAWSServiceDiscoveryPrivateDnsNamespace_basic
=== CONT  TestAccAWSServiceDiscoveryHttpNamespace_Description
=== CONT  TestAccAWSServiceDiscoveryHttpNamespace_disappears
=== CONT  TestAccAWSServiceDiscoveryPrivateDnsNamespace_Tags
=== CONT  TestAccAWSServiceDiscoveryPublicDnsNamespace_disappears
    provider_test.go:735: skipping tests; partition aws-us-gov does not support servicediscovery service
=== CONT  TestAccAWSServiceDiscoveryHttpNamespace_basic
    provider_test.go:735: skipping tests; partition aws-us-gov does not support servicediscovery service
--- SKIP: TestAccAWSServiceDiscoveryPublicDnsNamespace_disappears (1.45s)
--- SKIP: TestAccAWSServiceDiscoveryHttpNamespace_basic (1.45s)
=== CONT  TestAccAWSServiceDiscoveryPrivateDnsNamespace_disappears
    provider_test.go:735: skipping tests; partition aws-us-gov does not support servicediscovery service
=== CONT  TestAccAWSServiceDiscoveryPublicDnsNamespace_Tags
    provider_test.go:735: skipping tests; partition aws-us-gov does not support servicediscovery service
--- SKIP: TestAccAWSServiceDiscoveryPublicDnsNamespace_Tags (1.45s)
--- SKIP: TestAccAWSServiceDiscoveryPrivateDnsNamespace_disappears (1.45s)
=== CONT  TestAccAWSServiceDiscoveryPrivateDnsNamespace_Description
    provider_test.go:735: skipping tests; partition aws-us-gov does not support servicediscovery service
=== CONT  TestAccAWSServiceDiscoveryPublicDnsNamespace_basic
    provider_test.go:735: skipping tests; partition aws-us-gov does not support servicediscovery service
=== CONT  TestAccAWSServiceDiscoveryService_http
    provider_test.go:735: skipping tests; partition aws-us-gov does not support servicediscovery service
--- SKIP: TestAccAWSServiceDiscoveryPublicDnsNamespace_basic (1.45s)
--- SKIP: TestAccAWSServiceDiscoveryService_http (1.45s)
--- SKIP: TestAccAWSServiceDiscoveryPrivateDnsNamespace_Description (1.45s)
=== CONT  TestAccAWSServiceDiscoveryService_private
    provider_test.go:735: skipping tests; partition aws-us-gov does not support servicediscovery service
=== CONT  TestAccAWSServiceDiscoveryService_disappears
    provider_test.go:735: skipping tests; partition aws-us-gov does not support servicediscovery service
--- SKIP: TestAccAWSServiceDiscoveryService_private (1.45s)
=== CONT  TestAccAWSServiceDiscoveryHttpNamespace_Tags
    provider_test.go:735: skipping tests; partition aws-us-gov does not support servicediscovery service
=== CONT  TestAccAWSServiceDiscoveryPublicDnsNamespace_Description
    provider_test.go:735: skipping tests; partition aws-us-gov does not support servicediscovery service
=== CONT  TestAccAWSServiceDiscoveryPrivateDnsNamespace_error_Overlap
    provider_test.go:735: skipping tests; partition aws-us-gov does not support servicediscovery service
--- SKIP: TestAccAWSServiceDiscoveryService_disappears (1.45s)
--- SKIP: TestAccAWSServiceDiscoveryHttpNamespace_Tags (1.45s)
--- SKIP: TestAccAWSServiceDiscoveryPublicDnsNamespace_Description (1.45s)
--- SKIP: TestAccAWSServiceDiscoveryPrivateDnsNamespace_error_Overlap (1.45s)
=== CONT  TestAccAWSServiceDiscoveryService_public
    provider_test.go:735: skipping tests; partition aws-us-gov does not support servicediscovery service
=== CONT  TestAccAWSServiceDiscoveryService_Tags
    provider_test.go:735: skipping tests; partition aws-us-gov does not support servicediscovery service
=== CONT  TestAccAWSServiceDiscoveryPrivateDnsNamespace_basic
    provider_test.go:735: skipping tests; partition aws-us-gov does not support servicediscovery service
--- SKIP: TestAccAWSServiceDiscoveryService_public (1.45s)
--- SKIP: TestAccAWSServiceDiscoveryPrivateDnsNamespace_basic (1.45s)
--- SKIP: TestAccAWSServiceDiscoveryService_Tags (1.45s)
=== CONT  TestAccAWSServiceDiscoveryHttpNamespace_Description
    provider_test.go:735: skipping tests; partition aws-us-gov does not support servicediscovery service
=== CONT  TestAccAWSServiceDiscoveryHttpNamespace_disappears
    provider_test.go:735: skipping tests; partition aws-us-gov does not support servicediscovery service
--- SKIP: TestAccAWSServiceDiscoveryHttpNamespace_Description (1.45s)
--- SKIP: TestAccAWSServiceDiscoveryHttpNamespace_disappears (1.45s)
=== CONT  TestAccAWSServiceDiscoveryPrivateDnsNamespace_Tags
    provider_test.go:735: skipping tests; partition aws-us-gov does not support servicediscovery service
--- SKIP: TestAccAWSServiceDiscoveryPrivateDnsNamespace_Tags (1.45s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	4.701s

@ewbankkit
Copy link
Contributor

@Tremualin Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit a372e95 into hashicorp:main Sep 1, 2021
@github-actions github-actions bot added this to the v3.57.0 milestone Sep 1, 2021
@github-actions
Copy link

github-actions bot commented Sep 2, 2021

This functionality has been released in v3.57.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 Jun 23, 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/servicediscovery Issues and PRs that pertain to the servicediscovery service. size/XL 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.

ResourceInUse: Service contains registered instances; delete the instances before deleting the service
5 participants