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

avi provider is reading and importing resources with a minimal set of attributes #543

Open
itskvad opened this issue May 16, 2023 · 1 comment
Labels

Comments

@itskvad
Copy link

itskvad commented May 16, 2023

Describe the bug

I have imported an existing resource

terraform import avi_healthmonitor.healthcheck-tcp-test healthmonitor-e3f60d20 

tf code for said resource:

resource "avi_healthmonitor" "healthcheck-tcp-test" {
    name = "healthcheck-tcp-test"
    tenant_ref = var.tenant_ref
    receive_timeout = 4
    failed_checks = 2
    send_interval = 10
    successful_checks = 2
    type = "HEALTH_MONITOR_TCP"
    tcp_monitor {
        tcp_half_open        = "false"
    }
}

Import successful!

Now run a terraform plan

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the
following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # avi_healthmonitor.healthcheck-tcp-test will be updated in-place
  ~ resource "avi_healthmonitor" "healthcheck-tcp-test" {
      + failed_checks     = "2"
        id                = "https://xyz"
      + is_federated      = "false"
        name              = "healthcheck-tcp-test"
      + receive_timeout   = "4"
      + send_interval     = "10"
      + successful_checks = "2"
        # (4 unchanged attributes hidden)

      + tcp_monitor {
          + maintenance_response = (known after apply)
          + tcp_half_open        = "false"
          + tcp_request          = (known after apply)
          + tcp_response         = (known after apply)
        }
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Running a terraform plan shows that the resource is going to make changes to the resource, even though the resource is already imported and has the correct values.

Resource values in state after a import:
terraform state show avi_healthmonitor.healthcheck-tcp-test

# avi_healthmonitor.healthcheck-tcp-test:
resource "avi_healthmonitor" "healthcheck-tcp-test" {
id = [https://xyz]
monitor_port = "443"
name = "healthcheck-tcp-test"
tenant_ref = [https://xyz]
type = "HEALTH_MONITOR_TCP"
uuid = "healthmonitor-e3f60d20"
}

The avi provider is reading and importing the resource with a minimal set of attributes.

Reproduction steps

  1. import resource from avi - health monitor in this case
  2. check values of imported resource
    ...

Expected behavior

Import all the existing values that are set in the health monitor. Terraform plan should not attempt to set the values if the values are already in the resource.

Additional context

No response

@itskvad itskvad added the bug label May 16, 2023
@rmcolbert
Copy link

Along the same vein, avi_healthmonitor (in v22.1.6 and 30.2.1) is recreating the protocol based monitor blocks on every apply, not simply the first after an import.

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

No branches or pull requests

2 participants