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.
Asked: 2023-05-28 06:25:40 +0000
Seen: 1 times
Last updated: May 28 '23