Open dlsniper opened 8 years ago
Please provide minimal example. Also that feature would require knowledge of resource dependencies inside Terraform. For now I've no idea how to extract that from Terraform. Maybe it's simpler to have some configuration file and accept pull-request from users with changes.
Hi @VladRassokhin,
Here's a micro-example:
provider "aws" {
region = "eu-central-1"
}
provider "aws" {
alias = "us-east-1"
region = "us-east-1"
}
resource "aws_ecr_repository" "demo" {
provider = "aws.us-east-1"
name = "demo"
}
resource "aws_ecr_repository_policy" "deployment" { # This should be marked as unused
repository = "${aws_ecr_repository.demo.name}"
policy = <<EOF
// Some policy should be here
EOF
}
In the example above the aws_ecr_repository.demo
resource is going to be used to create a resource whereas the aws_ecr_repository_policy.deployment
is going to be "dangling" (unused).
I can also provide a list of resources that could be considered "used always". And I would really like to help with the plugin however I'm currently in a sever lack of time.
But Terraform will successfully create two resources, right? Then it's impossible to detect how valuable those resources are. At least, it's out of scope of this plugin.
Hello,
It could be useful to see which resources are defined and not used, much like how other languages support this feature for variables (for example).
Thank you!