You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If an output references a resource attribute that doesn't exist, the output fails silently and doesn't show up in the tfstate file.
In my case, a subnet didn't have auto assign ip turned on, and when an instance was launched there, no output showed up. Here's a simplified test case. You need to disable auto-assign ip in the default subnets for this test case to work. I assume it applies to all calculated attributes / values.
FWIW: referencing variables that don't exist errors on compile. Maybe calculated variables / attributes should dereference as "false" or "" if the data doesn't exist.
provider "aws" {
region = "us-west-2"
}
resource "aws_instance" "test" {
#centos6 community
ami = "ami-81d092b1"
instance_type = "t2.micro"
associate_public_ip_address = false
}
output "test" {
value = "echo ${aws_instance.test.public_ip}"
}
output
$ terraform apply
aws_instance.test: Creating...
ami: "" => "ami-81d092b1"
associate_public_ip_address: "" => "0"
availability_zone: "" => "<computed>"
ebs_block_device.#: "" => "<computed>"
ephemeral_block_device.#: "" => "<computed>"
instance_type: "" => "t2.micro"
key_name: "" => "<computed>"
placement_group: "" => "<computed>"
private_dns: "" => "<computed>"
private_ip: "" => "<computed>"
public_dns: "" => "<computed>"
public_ip: "" => "<computed>"
root_block_device.#: "" => "<computed>"
security_groups.#: "" => "<computed>"
source_dest_check: "" => "1"
subnet_id: "" => "<computed>"
tenancy: "" => "<computed>"
vpc_security_group_ids.#: "" => "<computed>"
aws_instance.test: Creation complete
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
The state of your infrastructure has been saved to the path
below. This state is required to modify and destroy your
infrastructure, so keep it safe. To inspect the complete state
use the `terraform show` command.
State path: terraform.tfstate
$ terraform show
aws_instance.test:
id = i-6ff3b6b6
ami = ami-81d092b1
associate_public_ip_address = false
availability_zone = us-west-2b
ebs_block_device.# = 0
ebs_optimized = false
ephemeral_block_device.# = 0
iam_instance_profile =
instance_type = t2.micro
monitoring = false
private_dns = ip-172-31-25-150.us-west-2.compute.internal
private_ip = 172.31.25.150
public_dns =
root_block_device.# = 1
root_block_device.0.delete_on_termination = false
root_block_device.0.iops = 24
root_block_device.0.volume_size = 8
root_block_device.0.volume_type = gp2
security_groups.# = 0
source_dest_check = true
subnet_id = subnet-b3aa40c4
tags.# = 0
tenancy = default
vpc_security_group_ids.# = 1
vpc_security_group_ids.434905629 = sg-2462e741
$ terraform output
The state file has no outputs defined. Define an output
in your configuration with the `output` directive and re-run
`terraform apply` for it to become available.
The text was updated successfully, but these errors were encountered:
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
ghost
locked and limited conversation to collaborators
Apr 21, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
If an output references a resource attribute that doesn't exist, the output fails silently and doesn't show up in the tfstate file.
In my case, a subnet didn't have auto assign ip turned on, and when an instance was launched there, no output showed up. Here's a simplified test case. You need to disable auto-assign ip in the default subnets for this test case to work. I assume it applies to all calculated attributes / values.
FWIW: referencing variables that don't exist errors on compile. Maybe calculated variables / attributes should dereference as "false" or "" if the data doesn't exist.
output
The text was updated successfully, but these errors were encountered: