0% found this document useful (0 votes)
16 views28 pages

Using Input Variables and Outputs Slides

Uploaded by

dpj43784
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views28 pages

Using Input Variables and Outputs Slides

Uploaded by

dpj43784
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

variable "name_label" {}

variable "name_label" {
type = value
description = "string"
default = value
sensitive = true | false
}
variable "billing_tag" {}

variable "aws_region" {
type = string
description = "Region to use for AWS resources"
default = "us-east-1"
sensitive = false
}
variable "aws_region" {
type = string
description = "Region to use for AWS resources"
default = "us-east-1"
}

var.<name_label>

var.aws_region
# List
[1, 2, 3, 4]
["us-east-1", "us-east-2", "us-west-1", "us-west-2"]
[1, "us-east-2", true] # INVALID LIST!

# Map
{
small = "[Link]"
medium = "[Link]"
large = "[Link]"
}
variable "aws_regions" {
type = list(string)
description = "Regions to use for AWS resources"
default = ["us-east-1", "us-east-2", "us-west-1", "us-west-2"]
}

var.<name_label>[<element_number>]
var.aws_regions[0]
variable "aws_instance_sizes" {
type = map(string)
description = "Instance sizes to use in AWS"
default = {
small = "[Link]"
medium = "[Link]"
large = "[Link]"
}
}

var.<name_label>.<key_name> or var.<name_label>["key_name"]
var.aws_instance_sizes.small or var.aws_instance_sizes["small"]
locals {
key = value
}
locals {
instance_prefix = "globo"
common_tags = {
company = "Globomantics"
project = [Link]
billing_code = var.billing_code
}
}
locals {
instance_prefix = "globo"
common_tags = {
company = "Globomantics"
project = [Link]
billing_code = var.billing_code
}
}

local.<key>
local.instance_prefix
local.common_tags.company
output "name_label" {
value = value
description = "string"
sensitive = true | false
}
output "public_dns_hostname" {
value = aws_instance.web_server.public_dns
description = "Public DNS hostname of web server"
}
-
-

You might also like