github.com/kcburge/terraform@v0.11.12-beta1/terraform/test-fixtures/apply-targeted-module-unrelated-outputs/main.tf (about)

     1  resource "aws_instance" "foo" {}
     2  
     3  module "child1" {
     4    source = "./child1"
     5    instance_id = "${aws_instance.foo.id}"
     6  }
     7  
     8  module "child2" {
     9    source = "./child2"
    10  }
    11  
    12  output "child1_id" {
    13    value = "${module.child1.instance_id}"
    14  }
    15  
    16  output "child1_given_id" {
    17    value = "${module.child1.given_instance_id}"
    18  }
    19  
    20  output "child2_id" {
    21    # This should get updated even though we're targeting specifically
    22    # module.child2, because outputs are implicitly targeted when their
    23    # dependencies are.
    24    value = "${module.child2.instance_id}"
    25  }
    26  
    27  output "all_ids" {
    28    # Here we are intentionally referencing values covering three different scenarios:
    29    # - not targeted and not already in state
    30    # - not targeted and already in state
    31    # - targeted
    32    # This is important because this output must appear in the graph after
    33    # target filtering in case the targeted node changes its value, but we must
    34    # therefore silently ignore the failure that results from trying to
    35    # interpolate the un-targeted, not-in-state node.
    36    value = "${aws_instance.foo.id} ${module.child1.instance_id} ${module.child2.instance_id}"
    37  }