F5Networks / terraform-azure-bigip-module

Terraform module for Deploying BIG-IP in azure
Apache License 2.0
10 stars 23 forks source link

Error: local-exec provisioner error #70

Closed difzhao closed 2 weeks ago

difzhao commented 3 months ago

terraform deployment error.txt Hi team,

I got this error while deploying the template. The error detail is attached. It is complaining line 57 in main.tf. Here is the section of the code (which I didn't change).

resource "null_resource" "clusterDO" {

  count = var.instance_count

  provisioner "local-exec" {
    command = "cat > DO_2nic-instance${count.index}.json <<EOL\n ${module.bigip[count.index].onboard_do}\nEOL" <--- Line 57
  }
  provisioner "local-exec" {
    when    = destroy
    command = "rm -rf DO_2nic-instance${count.index}.json"
  }
  depends_on = [module.bigip.onboard_do]
}

I did some googling and I think this is to do with Declarative Onboarding that configures the system settings of the BIGIP. The instance is built successfully. I can SSH to it and browse the GUI. By the way, is there a way to set a password and not use the SSH key for connection? Thanks!

RavinderReddyF5 commented 3 months ago

HI @difzhao , can you provide environment like windows/Linux from where you are running this module? is this easily reproducible.

difzhao commented 3 months ago

HI @difzhao , can you provide environment like windows/Linux from where you are running this module? is this easily reproducible.

Hi Ravinder, it is in the Windows Environment. Let me check my code tomorrow and mask sensitive info then sent it back to you. I did make some modification because that I need to use existing RG, VNET and Subnet. Not sure if any of that is causing this error.

I also have a quick question. The error is about the Declarative Onboarding phase which is for making system level config changes. How does Terraform do it? The F5 Big-IP I am building will not have a public IP address. Does it relay the config through the Azure API somehow? Thanks!

M4nintheB0x commented 2 months ago

The following I used for a 3 Nic setup. See if this works for you.

resource "null_resource" "clusterDO" { count = var.instance_count

provisioner "local-exec" { command = "echo '${jsonencode(module.bigip[count.index].onboard_do)}' | Out-File -Encoding UTF8 DO_3nic-instance${count.index}.json" interpreter = ["PowerShell", "-Command"] }

provisioner "local-exec" { when = destroy command = "Remove-Item -Path DO_3nic-instance${count.index}.json -Force" interpreter = ["PowerShell", "-Command"] }

depends_on = [module.bigip.onboard_do] }

difzhao commented 2 months ago

The following I used for a 3 Nic setup. See if this works for you.

resource "null_resource" "clusterDO" { count = var.instance_count

provisioner "local-exec" { command = "echo '${jsonencode(module.bigip[count.index].onboard_do)}' | Out-File -Encoding UTF8 DO_3nic-instance${count.index}.json" interpreter = ["PowerShell", "-Command"] }

provisioner "local-exec" { when = destroy command = "Remove-Item -Path DO_3nic-instance${count.index}.json -Force" interpreter = ["PowerShell", "-Command"] }

depends_on = [module.bigip.onboard_do] }

Thank you. I am getting some "Failed to load plugin schemas for registry.terraform.io/hashicorp/azurerm... Access is Denied" Terraform error now. I also have to work on other project. Feel free to close this one for now. I will reach out for help after I resolve this error first. Thanks!

RavinderReddyF5 commented 2 weeks ago

Hi @difzhao , closing this issue for now. please open new issue if any issue seen