Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Count error with all resource like loadbalancer_id #82

Open
sanchetanparmar opened this issue Feb 22, 2020 · 3 comments
Open

Count error with all resource like loadbalancer_id #82

sanchetanparmar opened this issue Feb 22, 2020 · 3 comments
Assignees

Comments

@sanchetanparmar
Copy link

current terraform code not able to count

getting error with terraform 1.12


Error: Missing resource instance key

  on lb.tf line 42, in resource "azurerm_lb_backend_address_pool" "clients-lb-backend":
  42:   loadbalancer_id = "${var.associate_public_ip == true ? azurerm_lb.clients-public.id : azurerm_lb.clients.id}"

Because azurerm_lb.clients-public has "count" set, its attributes must be
accessed on specific instances.

For example, to correlate with indices of a referring resource, use:
    azurerm_lb.clients-public[count.index]


Error: Missing resource instance key

  on lb.tf line 42, in resource "azurerm_lb_backend_address_pool" "clients-lb-backend":
  42:   loadbalancer_id = "${var.associate_public_ip == true ? azurerm_lb.clients-public.id : azurerm_lb.clients.id}"

Because azurerm_lb.clients has "count" set, its attributes must be accessed on
specific instances.

For example, to correlate with indices of a referring resource, use:
    azurerm_lb.clients[count.index]


Error: Missing resource instance key

  on lb.tf line 53, in resource "azurerm_lb_probe" "clients-httpprobe":
  53:   loadbalancer_id = "${var.associate_public_ip == true ? azurerm_lb.clients-public.id : azurerm_lb.clients.id}"

Because azurerm_lb.clients-public has "count" set, its attributes must be
accessed on specific instances.

For example, to correlate with indices of a referring resource, use:
    azurerm_lb.clients-public[count.index]


Error: Missing resource instance key

  on lb.tf line 53, in resource "azurerm_lb_probe" "clients-httpprobe":
  53:   loadbalancer_id = "${var.associate_public_ip == true ? azurerm_lb.clients-public.id : azurerm_lb.clients.id}"

Because azurerm_lb.clients has "count" set, its attributes must be accessed on
specific instances.

For example, to correlate with indices of a referring resource, use:
    azurerm_lb.clients[count.index]


Error: Missing required argument

  on masters.tf line 50, in resource "azurerm_virtual_machine_scale_set" "master-nodes":
  50:     ip_configuration {

The argument "primary" is required, but no definition was found.


Error: Missing resource instance key

  on single-node.tf line 57, in resource "azurerm_virtual_machine" "single-node":
  57:   network_interface_ids = ["${azurerm_network_interface.single-node.id}"]

Because azurerm_network_interface.single-node has "count" set, its attributes
must be accessed on specific instances.

For example, to correlate with indices of a referring resource, use:
    azurerm_network_interface.single-node[count.index]
@sanchetanparmar
Copy link
Author

terraform plan

Error: failed to render : <template_file>:9,39-59: Unknown variable; There is no variable named "azure_resource_group"., and 11 other diagnostic(s)

  on datas.tf line 1, in data "template_file" "data_userdata_script":
   1: data "template_file" "data_userdata_script" {



Error: failed to render : <template_file>:9,39-59: Unknown variable; There is no variable named "azure_resource_group"., and 11 other diagnostic(s)

  on masters.tf line 1, in data "template_file" "master_userdata_script":
   1: data "template_file" "master_userdata_script" {

@sanchetanparmar
Copy link
Author

count fixed by - "${element(azurerm_lb.clients.*.id, count.index}"
removed xpack and after adding
bootstrap_node = ""
aws_region = ""
cloud_provider = "azure"
masters_count = 1
able to create stack , get DNS and Public IP and username password but not accessible

@josemarcosrf
Copy link

josemarcosrf commented Jun 12, 2020

Same thing was happening to me. Apparently it is related to a a terraform providers bug #5675.

Downgrading to Terraform 1.10 seems to fix the issues.

However the user / pwd access doesn't seem like working for me either. ssh access does work well.

edit:

I managed to manually fix access, accessing via ssh and creating the missing htpwd file missing for nginx.

I'll look at the scripts to try figure out why that happened.

Even with user/pwd access fixed Kibana doesn't seem to connect to Elasticsearch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants