Closed harkamals closed 4 years ago
I totally agree. This way, probably, more resources can be supported more easily. I guess, it would be best (like I did in the wipe function), to use the Terraform API in some way for the lookups.
Unfortunately, the approach of using data sources to discover resources does only work for a few resource types. The approach for discovery I am using is via the https://github.com/jckuester/awsls project.
Suggestion to not use aws sdk describe-* API to enumerate instances, instead use output of terraform data lookups. This makes more sense we use terraform to delete resources so why not offload discovery too.
` data "aws_instances" "ec2" { instance_tags { Name = "*" } instance_state_names = ["running", "stopped"] }
output "ec2" { value = "${data.aws_instances.ec2.ids}" } `