Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 674 Bytes

terraform-outputs.md

File metadata and controls

27 lines (21 loc) · 674 Bytes

Terraform Outputs

A Terraform output defines a value that is shown to the user when a Terraform apply finishes.

In TypeScript, a Terraform output for an AWS instance public IP can be expressed by TerraformOutput.

const instance = new Instance(this, 'hello', {
  ami: 'ami-abcde123',
  instanceType: 't2.micro'
});

new TerraformOutput(this, 'public_ip', {
    value: instance.publicIp
});

The TerraformOutput synthesizes to the following:

"output": {
    "examplesimplepublicipE5F943EE": {
      "value": "${aws_instance.examplesimpleHelloF6D4983C.public_ip}"
    }
}