hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io
Other
43.11k stars 9.58k forks source link

Add feature `plan -depends` #20059

Open eXist-FraGGer opened 5 years ago

eXist-FraGGer commented 5 years ago

Current Terraform Version

Terraform v0.11.11
+ provider.aws v1.56.0

Use-cases

Let's imagine we have a few API's

mobile_api.tf.json

api_mobile

All of these resources has parameter "depends_on": [ "aws_api_gateway_rest_api.api_mobile" ]

management_api.tf.json

api_management

All of this resources has parameter "depends_on": [ "aws_api_gateway_rest_api.api_management" ]

So, I want to have the possibility to update only resources that depend on api_management. I do not want to check the whole infrastructure and -target works only with one specific resource. Now it so long if I have a lot of APIs and other resources.

Proposal

I think that it will be great if I could write: terraform plan -out=terraform.tfplan -depends aws_api_gateway_rest_api.api_management terraform apply terraform.tfplan And terraform plan -out=terraform.tfplan -depends aws_api_gateway_rest_api.api_mobile terraform apply terraform.tfplan

eXist-FraGGer commented 5 years ago

Any answers?