F5Networks / terraform-provider-bigip

Terraform resources that can configure F5 BIG-IP products
https://registry.terraform.io/providers/F5Networks/bigip/latest/docs
Mozilla Public License 2.0
102 stars 117 forks source link

Error: Post 'https:///mgmt/tm/ltm/virtual-address': No Host in Request URL When Creating Virtual Server with BigIP Provider #992

Closed malacration closed 3 weeks ago

malacration commented 3 weeks ago

Environment

Summary

I am encountering an issue while trying to create a virtual service using the bigip_ltm_virtual_server resource in Terraform. The plan application fails with an error indicating that no host is specified in the request URL. This issue persists despite correctly configuring the provider with the required details.

Steps To Reproduce

resource "bigip_ltm_virtual_server" "testeWindson" {
  provider = bigip.f5
  name     = "/Common/testeWindson"
}

The following error is observed in the logs:


Error: Post "https:///mgmt/tm/ltm/virtual-address": http: no Host in request URL

with bigip_ltm_virtual_server.testeWindson,
on main.tf line 19, in resource "bigip_ltm_virtual_server" "testeWindson":
19: resource "bigip_ltm_virtual_server" "testeWindson" {

Expected Behavior

The virtual service should be created successfully without any errors.

Actual Behavior

The "apply" execution fails with the error:

Error: Post "https:///mgmt/tm/ltm/virtual-address": http: no Host in request URL

This indicates that the host information is missing in the request URL, despite being specified in the provider configuration.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

2024-06-11T17:24:33.590Z [INFO]  backend/local: apply calling Apply
2024-06-11T17:24:33.590Z [DEBUG] Building and walking apply graph for NormalMode plan
2024-06-11T17:24:33.591Z [DEBUG] Resource state not found for node "bigip_ltm_virtual_address.testeWindson", instance bigip_ltm_virtual_address.testeWindson
2024-06-11T17:24:33.591Z [DEBUG] ProviderTransformer: "bigip_ltm_virtual_address.testeWindson (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/f5networks/bigip"]
2024-06-11T17:24:33.591Z [DEBUG] ProviderTransformer: "bigip_ltm_virtual_address.testeWindson" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/f5networks/bigip"]
2024-06-11T17:24:33.591Z [DEBUG] pruning unused provider["registry.terraform.io/f5networks/bigip"].f5
2024-06-11T17:24:33.591Z [DEBUG] ReferenceTransformer: "bigip_ltm_virtual_address.testeWindson (expand)" references: []
2024-06-11T17:24:33.591Z [DEBUG] ReferenceTransformer: "bigip_ltm_virtual_address.testeWindson" references: []
2024-06-11T17:24:33.591Z [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/f5networks/bigip\"]" references: []
2024-06-11T17:24:33.591Z [DEBUG] Starting graph walk: walkApply
2024-06-11T17:24:33.591Z [DEBUG] created provider logger: level=debug
2024-06-11T17:24:33.591Z [INFO]  provider: configuring client automatic mTLS
2024-06-11T17:24:33.595Z [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/f5networks/bigip/1.20.2/linux_amd64/terraform-provider-bigip_v1.20.2 args=[".terraform/providers/registry.terraform.io/f5networks/bigip/1.20.2/linux_amd64/terraform-provider-bigip_v1.20.2"]
2024-06-11T17:24:33.596Z [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/f5networks/bigip/1.20.2/linux_amd64/terraform-provider-bigip_v1.20.2 pid=48
2024-06-11T17:24:33.596Z [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/f5networks/bigip/1.20.2/linux_amd64/terraform-provider-bigip_v1.20.2
2024-06-11T17:24:33.599Z [INFO]  provider.terraform-provider-bigip_v1.20.2: configuring server automatic mTLS: timestamp=2024-06-11T17:24:33.599Z
2024-06-11T17:24:33.610Z [DEBUG] provider: using plugin: version=5
2024-06-11T17:24:33.610Z [DEBUG] provider.terraform-provider-bigip_v1.20.2: plugin address: address=/tmp/plugin2005954369 network=unix timestamp=2024-06-11T17:24:33.610Z
2024-06-11T17:24:33.626Z [WARN]  ValidateProviderConfig from "provider[\"registry.terraform.io/f5networks/bigip\"]" changed the config value, but that value is unused
2024-06-11T17:24:33.626Z [INFO]  provider.terraform-provider-bigip_v1.20.2: Initializing BigIP connection: timestamp=2024-06-11T17:24:33.626Z
2024-06-11T17:24:33.628Z [WARN]  Provider "registry.terraform.io/f5networks/bigip" produced an invalid plan for bigip_ltm_virtual_address.testeWindson, but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .advertize_route: planned value cty.StringVal("disabled") for a non-computed attribute
      - .arp: planned value cty.True for a non-computed attribute
      - .icmp_echo: planned value cty.StringVal("enabled") for a non-computed attribute
      - .traffic_group: planned value cty.StringVal("/Common/traffic-group-1") for a non-computed attribute
      - .auto_delete: planned value cty.True for a non-computed attribute
      - .conn_limit: planned value cty.NumberIntVal(0) for a non-computed attribute
      - .enabled: planned value cty.True for a non-computed attribute
bigip_ltm_virtual_address.testeWindson: Creating...
2024-06-11T17:24:33.628Z [INFO]  Starting apply for bigip_ltm_virtual_address.testeWindson
2024-06-11T17:24:33.628Z [DEBUG] bigip_ltm_virtual_address.testeWindson: applying the planned Create change
2024-06-11T17:24:33.629Z [INFO]  provider.terraform-provider-bigip_v1.20.2: Creating virtual address /Common/testeWindson: timestamp=2024-06-11T17:24:33.629Z
2024-06-11T17:24:33.629Z [ERROR] provider.terraform-provider-bigip_v1.20.2: Response contains error diagnostic: tf_resource_type=bigip_ltm_virtual_address @caller=github.com/hashicorp/terraform-plugin-go@v0.14.3/tfprotov5/internal/diag/diagnostics.go:55 tf_provider_addr=provider diagnostic_severity=ERROR diagnostic_summary="Post \"https:///mgmt/tm/ltm/virtual-address\": http: no Host in request URL" tf_proto_version=5.3 tf_req_id=36b04b8d-dd15-4c33-53e2-8391265529c1 tf_rpc=ApplyResourceChange @module=sdk.proto diagnostic_detail="" timestamp=2024-06-11T17:24:33.629Z
2024-06-11T17:24:33.639Z [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2024-06-11T17:24:33.639Z [ERROR] vertex "bigip_ltm_virtual_address.testeWindson" error: Post "https:///mgmt/tm/ltm/virtual-address": http: no Host in request URL
╷
│ Error: Post "https:///mgmt/tm/ltm/virtual-address": http: no Host in request URL
│ 
│   with bigip_ltm_virtual_address.testeWindson,
│   on main.tf line 19, in resource "bigip_ltm_virtual_address" "testeWindson":
│   19: resource "bigip_ltm_virtual_address" "testeWindson" {
│ 
╵
2024-06-11T17:24:33.643Z [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-06-11T17:24:33.644Z [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/f5networks/bigip/1.20.2/linux_amd64/terraform-provider-bigip_v1.20.2 pid=48
2024-06-11T17:24:33.644Z [DEBUG] provider: plugin exited
malacration commented 3 weeks ago

I found the problem! When an alias was declared in the provider and I created a resource without informing the provider with the alias, this error occurred!