mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-23 23:22:57 -06:00
97acccd3ed
Add `-target=resource` flag to core operations, allowing users to target specific resources in their infrastructure. When `-target` is used, the operation will only apply to that resource and its dependencies. The calculated dependencies are different depending on whether we're running a normal operation or a `terraform destroy`. Generally, "dependencies" refers to ancestors: resources falling _before_ the target in the graph, because their changes are required to accurately act on the target. For destroys, "dependencies" are descendents: those resources which fall _after_ the target. These resources depend on our target, which is going to be destroyed, so they should also be destroyed.
19 lines
345 B
HCL
19 lines
345 B
HCL
resource "aws_vpc" "notme" {}
|
|
|
|
resource "aws_subnet" "notme" {
|
|
vpc_id = "${aws_vpc.notme.id}"
|
|
}
|
|
|
|
resource "aws_instance" "me" {
|
|
subnet_id = "${aws_subnet.notme.id}"
|
|
}
|
|
|
|
resource "aws_instance" "notme" {}
|
|
resource "aws_instance" "metoo" {
|
|
name = "${aws_instance.me.id}"
|
|
}
|
|
|
|
resource "aws_elb" "me" {
|
|
instances = "${aws_instance.me.*.id}"
|
|
}
|