You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following explanation hopefully makes it easy contributing the resources you need to this project. As an example, we go through adding the resource aws_vpc (which is already supported).
In most cases can be left as filterGeneric. Some resources require custom filter methods.
5) Integration tests
Solid testing is necessary, since we don't want this tool to delete resources unexpectedly :-) Integration tests for each resource have its own file; the ones for aws_vpc are in test/vpc_test.go.
The test for each resource is structured as follows:
Create two different resources of aws_vpc (one with ID/tag foo, another with ID/tag bar)
Create a yaml filter for AWSweeper to delete resource with ID/tag foo
Check if resource with ID/tag foo is gone
Check if resource with ID/tag bar hasn't been deleted
The text was updated successfully, but these errors were encountered:
jckuester
changed the title
Guideline: How to add support for AWS resources you need
Guideline: How to add the AWS resources you need to this project
Jul 30, 2018
jckuester
changed the title
Guideline: How to add the AWS resources you need to this project
Guideline: How to add new AWS resources to this project
Nov 2, 2018
jckuester
changed the title
Guideline: How to add new AWS resources to this project
How to add new AWS resources to this project
Nov 2, 2018
jckuester
changed the title
How to add new AWS resources to this project
How to contribute support of new resources to this project
Nov 2, 2018
jckuester
changed the title
How to contribute support of new resources to this project
How to contribute new resources to this project
Nov 2, 2018
jckuester
changed the title
How to contribute new resources to this project
How to contribute support for more resources to this project
Nov 2, 2018
I am closing this issue as the approach to add new resources changed a lot: All code to list resources is planned to be generated via the awsls project, so the generator would be the place if you want to contribute. Deletion happens via the Terraform AWS Provider, so individual functions to delete resources are not needed.
The following explanation hopefully makes it easy contributing the resources you need to this project. As an example, we go through adding the resource
aws_vpc
(which is already supported).1) Add Terraform type ID of the new resource type
Fine the terraform name of the AWS resource type to support (here is a list of all existing resource types) and add it to resource/supported.go.
2) Add function to list resources
Add here a function that lists all resources of the new resource type. For this you need to find the method of the AWS go API to list all VPCs (you find it by looking in the go doc of the AWS API)
Supported resources need to be added to resource/supported.go.
3) Add delete ID
The field name of the ID used by Terraform to delete the resource. For this we actually have to look in the delete method of the AWS provider for the VPC
4) Add custom filter method
In most cases can be left as
filterGeneric
. Some resources require custom filter methods.5) Integration tests
Solid testing is necessary, since we don't want this tool to delete resources unexpectedly :-) Integration tests for each resource have its own file; the ones for
aws_vpc
are in test/vpc_test.go.The test for each resource is structured as follows:
aws_vpc
(one with ID/tag foo, another with ID/tag bar)The text was updated successfully, but these errors were encountered: