-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Feature Request: [Destroy|Plan|Apply] by specifying the file #9939
Comments
Hi @MisaKondo, Terraform doesn't support exactly what you expected here, but you can get a similar result using the
Note that targets are resource-oriented rather than file-oriented. Terraform generally doesn't operate on individual files, but rather just treats an entire directory as a single configuration. The |
@apparentlymart
|
terraform state list is a great way to see all the modules that are available as targets for terraform plan -target=module.name. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Terraform Version
Affected Resource(s)
No specific resource. This issue with Terraform's core.
Terraform Configuration Files
Debug Output
MisaKondo-no-iMac% terraform destroy Terraform/gcp_instances.tf Error loading config: configuration path must be a directory: Terraform/gcp_instances.tf MisaKondo-no-iMac% git rm Terraform/gcp_instances.tf rm 'Terraform/gcp_instances.tf' MisaKondo-no-iMac% terraform plan Terraform Refreshing Terraform state in-memory prior to plan... The refreshed state will be used to calculate this plan, but will not be persisted to local or remote state storage. google_compute_instance.development: Refreshing state... (ID: development) google_compute_network.remote: Refreshing state... (ID: remote) google_compute_subnetwork.development: Refreshing state... (ID: us-east1/development) The Terraform execution plan has been generated and is shown below. Resources are shown in alphabetical order for quick scanning. Green resources will be created (or destroyed and then created if an existing resource exists), yellow resources are being changed in-place, and red resources will be destroyed. Cyan entries are data sources to be read. Note: You didn't specify an "-out" parameter to save this plan, so when "apply" is called, Terraform can't guarantee this is what will execute. - google_compute_instance.development Plan: 0 to add, 0 to change, 1 to destroy. MisaKondo-no-iMac% git commit -m 'remove instance setting(for destory'
Expected Behavior
I expected,
terraform destroy #{target_file}
is destroy #{target_file} resource.Actual Behavior
But, destroy|plan|apply COMMAND no support file. Only directory.
I want to delete specific file resource.
Steps to Reproduce
git clone -b set_gcp_environments git@github.com:MisaKondo/remote_machine.git && cd remote_machine
terraform apply Terraform
terraform destroy Terraform/gcp_instances.tf
rm Terraform/gcp_instances.tf
Terraform apply Terraform
References
The text was updated successfully, but these errors were encountered: