Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, it is possible to execute Terraform only for a particular resource. This can be done by using the -target option followed by the resource name or address. For example, if you want to apply changes only to an AWS EC2 instance resource named "my-instance", you can run the following command:

terraform apply -target=aws_instance.my-instance

This command will apply changes only to the specified instance, leaving all other resources untouched.

Note that using -target can be risky as it can leave your infrastructure in an inconsistent state if not used carefully. It's important to understand the dependencies between resources and the impact of making changes to a single resource. It's recommended to use -target only when absolutely necessary, and as a last resort.