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

Cleanup code for AWS #57

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Cleanup code for AWS #57

wants to merge 1 commit into from

Conversation

pglass
Copy link

@pglass pglass commented Oct 27, 2021

Changes proposed in this PR:

Code we can use to cleanup resources in AWS.

Resources are filtered in a few ways (where possible):

  • Resources whose name contains consul-ecs

  • Resources that contain a build_url tag matching our CircleCI build url https://circleci.com/gh/hashicorp/terraform-aws-consul-ecs/

  • Resources that contain a build_time tag that is old enough

    • There's a new build_time tag added in acceptance test jobs, since some AWS resources do not have created times (like ECS Clusters). And this gives us a consistent way to determine resource age.

How I've tested this PR:

  • Manually setup some resources with the new tags, and ran locally:
$ go run .
2021/10/27 09:57:19 Listing elastic ips
2021/10/27 09:57:19 Listing NAT gateways
2021/10/27 09:57:19 Listing VPCs
2021/10/27 09:57:19 Listing EC2 instances
2021/10/27 09:57:19 Listing ECS clusters
2021/10/27 09:57:19 Listing internet gateways in VPC vpc-0fed33a2425cdf821
2021/10/27 09:57:19 Listing ECS services for cluster=arn:aws:ecs:us-west-2:977604411308:cluster/consul-ecs-et3aRCLL
2021/10/27 09:57:19 Listing subnets for VPC vpc-0fed33a2425cdf821
2021/10/27 09:57:20 Listing security groups for VPC vpc-0fed33a2425cdf821
2021/10/27 09:57:20 Listing route tables for VPC vpc-0fed33a2425cdf821
2021/10/27 09:57:21 main.NatGateway nat-02886e7d998623b64
2021/10/27 09:57:21 main.ElasticIP eipalloc-0cfb382f48b43caf9
2021/10/27 09:57:21 main.EC2Instances [i-058c50ec1c3febd5b i-0b0a9939ed7e06538 i-0f22630f90b050dc5 i-0541da8287312974c]
2021/10/27 09:57:21 main.ECSCluster arn=arn:aws:ecs:us-west-2:977604411308:cluster/consul-ecs-et3aRCLL services=[arn:aws:ecs:us-west-2:977604411308:service/consul-ecs-et3aRCLL/test_server_et3aRCLL arn:aws:ecs:us-west-2:977604411308:service/consul-ecs-et3aRCLL/consul_server_et3aRCLL arn:aws:ecs:us-west-2:977604411308:service/consul-ecs-et3aRCLL/test_client_et3aRCLL]
2021/10/27 09:57:21 main.LogGroup consul-ecs-et3aRCLL
2021/10/27 09:57:21 main.VPC vpc=vpc-0fed33a2425cdf821 igw=igw-0caee38e2da9ecbe5 subnets=[subnet-01e8725681fdd3712 subnet-08e71beda10c92b04 subnet-0be65123220cde755 subnet-0472f94cd0b65cdd6 subnet-0e11625445483060b subnet-079f2f6f86c6787cf] secgroups=[sg-021d3781a2c28ad33] routetables=[rtb-000defd2aba08fcc5 rtb-0102fc731fd9ce60f]

How I expect reviewers to test this PR:

Checklist:

  • Implement Delete/Wait logic
  • Tests added
  • CHANGELOG entry added

@hashicorp-cla
Copy link

hashicorp-cla commented Mar 12, 2022

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes


Paul Glass seems not to be a GitHub user.
You need a GitHub account to be able to sign the CLA. If you already have a GitHub account, please add the email address used for this commit to your account.

Have you signed the CLA already but the status is still pending? Recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants