main.tf
resource "local_file" "pet" {
filename = var.filename[count.index]
count = length(var.filename)
content = "file created"
}
output "pets" {
value = local_file.pet
sensitive = true
}
variable "filename" {
default = [
"/home/admin/udemy-terraform/dogs.txt",
"/home/admin/udemy-terraform/cats.txt",
]
}
terraform output
╷
│ Warning: No outputs found
│
│ The state file either has no outputs defined, or all the defined outputs
│ are empty. Please define an output in your configuration with the output
│ keyword and run terraform refresh
for it to become available. If you are
│ using interpolation, please verify the interpolated value is not empty.
│ You can use the terraform console
command to assist.
Tried terraform refresh…Didn’t work. Tried terraform init again, didn’t work.
Why am I not getting the output values?