A
A
Anton2020-04-18 09:59:38
Devops
Anton, 2020-04-18 09:59:38

How to fix the config to remove the error A managed resource "openstack_compute_instance_v2" "instance" has not been declared in the root module?

Versions:
terraform version
Terraform v0.12.24
+ provider.openstack v1.26.0

Config:

resource "openstack_compute_keypair_v2" "my-cloud-key" {
  name       = "apatsev-key"
  public_key = file("/home/user/.ssh/id_rsa.pub")
}

resource "openstack_compute_instance_v2" "test" {
  count           = 3
  name            = "zookeper-${count.index}"
  image_name      = "CentOS_7.6_CloudImage_201901"
  flavor_name     = "c2.m8.d40"
  key_pair        = openstack_compute_keypair_v2.my-cloud-key.name
  security_groups = ["any-any"]

  network {
    name = var.network
  }

}

output "ip" {
  value = "${openstack_compute_instance_v2.instance.network.0.fixed_ip_v4}"
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
amkartashov, 2020-04-18
Patsev @chemtech


replace openstack_compute_instance_v2.instance.network.0.fixed_ip_v4
with
openstack_compute_instance_v2.test.network.0.fixed_ip_v4

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question