Current Terraform Version
Terraform v0.13.0-rc1
Use-cases
List IPs of droplets just created using a module with count
.
Am unsure how to access the IPs once created using the module. I tried various different splat syntax from previous versions and receive empty tuple
errors when trying to access the module.example-prod
resource. Is this the right way to access this information?
Attempted Solutions
Full git repo.
Snippets for troubleshooting…
# infra/prod/main.tf
module "example-prod" {
source = "../../modules/droplet"
count = 2
droplet_name = "tf-prod-${count.index + 1}"
droplet_image = var.droplet_image
droplet_size = var.droplet_size_1vcpu_1gb
do_region = var.do_region
ssh_keys = var.do_ssh_keys
}
The module:
# modules/droplet/main.tf
resource "digitalocean_droplet" "droplet" {
name = var.droplet_name
image = var.droplet_image
size = var.droplet_size
region = var.do_region
ssh_keys = var.ssh_keys
}
Receive error thus:
on main.tf line 13, in output "droplet_ips":
13: value = module.example-prod[*].digitalocean_droplet.droplet.ipv4_address
This object does not have an attribute named "digitalocean_droplet".
1 post - 1 participant