akamai / terraform-provider-akamai

Terraform Akamai provider

Home Page:https://www.terraform.io/docs/providers/akamai/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DXE-3506 Invalid behaviour when renaming GTM property

findmyname666 opened this issue · comments

Terraform Version

$ terraform -v
Terraform v1.4.6
on linux_amd64

Provider version: 5.5.0.

Affected Resource(s)

akamai_gtm_property

Terraform Configuration Files

Testing code to created GTM property:

resource "akamai_gtm_property" "this" {
  domain                 = var.domain_name
  name                   = "tfexample"
  type                   = "performance"
  score_aggregation_type = "worst"
  handout_limit          = 5
  handout_mode           = "normal"

  traffic_target {
    datacenter_id = 1
    enabled       = true
    weight        = 100
    servers       = ["_replace_this_with_real_value_"]
    handout_cname = "_replace_this_with_real_value"
  }

  liveness_test {
    name                             = "lt5"
    test_interval                    = 40
    test_object_protocol             = "HTTP"
    test_timeout                     = 30
    answers_required                 = false
    disable_nonstandard_port_warning = false
    error_penalty                    = 0
    http_error3xx                    = false
    http_error4xx                    = false
    http_error5xx                    = false
    disabled                         = false
    http_header {
      name  = "test_name"
      value = "test_value"
    }
    peer_certificate_verification = false
    recursion_requested           = false
    request_string                = ""
    resource_type                 = ""
    response_string               = ""
    ssl_client_certificate        = ""
    ssl_client_private_key        = ""
    test_object                   = "/junk"
    test_object_password          = ""
    test_object_port              = 1
    test_object_username          = ""
    timeout_penalty               = 0
  }

  failover_delay   = 0
  failback_delay   = 0
  wait_on_complete = true
}

Apply was successful and property was created.
Later I decided to changed property name.
I changed the name in the code:

resource "akamai_gtm_property" "this" {
  domain                 = var.domain_name
  name                   = "tfexample2"
  type                   = "performance"
  score_aggregation_type = "worst"
  handout_limit          = 5
  handout_mode           = "normal"

  traffic_target {
    datacenter_id = 1
    enabled       = true
    weight        = 100
    servers       = ["_replace_this_with_real_value_"]
    handout_cname = "_replace_this_with_real_value"
  }

  liveness_test {
    name                             = "lt5"
    test_interval                    = 40
    test_object_protocol             = "HTTP"
    test_timeout                     = 30
    answers_required                 = false
    disable_nonstandard_port_warning = false
    error_penalty                    = 0
    http_error3xx                    = false
    http_error4xx                    = false
    http_error5xx                    = false
    disabled                         = false
    http_header {
      name  = "test_name"
      value = "test_value"
    }
    peer_certificate_verification = false
    recursion_requested           = false
    request_string                = ""
    resource_type                 = ""
    response_string               = ""
    ssl_client_certificate        = ""
    ssl_client_private_key        = ""
    test_object                   = "/junk"
    test_object_password          = ""
    test_object_port              = 1
    test_object_username          = ""
    timeout_penalty               = 0
  }

  failover_delay   = 0
  failback_delay   = 0
  wait_on_complete = true
}

Provider reports changes:

Terraform will perform the following actions:

  # akamai_gtm_property.this will be updated in-place
  ~ resource "akamai_gtm_property" "this" {
        id                          = "edeng.stable-int.nbcuott.com.akadns.net:tfexample"
      ~ name                        = "tfexample" -> "tfexample2"
        # (24 unchanged attributes hidden)

        # (2 unchanged blocks hidden)
    }

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

Apply was successful. However both properties are visible in UI e.g. tfexample and tfexample2.
The expected behaviour would be that property tfexample is destroyed and a new property tfexample2 would be created.

Ok so what now ... I tried to destroy the property with terraform destroy. Displayed changes:

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  # akamai_gtm_property.this will be destroyed
  - resource "akamai_gtm_property" "this" {
      - balance_by_download_score   = false -> null
      - domain                      = "_reducted_" -> null
      - dynamic_ttl                 = 300 -> null
      - failback_delay              = 0 -> null
      - failover_delay              = 0 -> null
      - ghost_demand_reporting      = false -> null
      - handout_limit               = 5 -> null
      - handout_mode                = "normal" -> null
      - health_max                  = 0 -> null
      - health_multiplier           = 0 -> null
      - health_threshold            = 0 -> null
      - id                          = "_reducted_:tfexample" -> null
      - ipv6                        = false -> null
      - load_imbalance_percentage   = 0 -> null
      - max_unreachable_penalty     = 0 -> null
      - min_live_fraction           = 0 -> null
      - name                        = "tfexample" -> null
      - score_aggregation_type      = "worst" -> null
      - stickiness_bonus_constant   = 0 -> null
      - stickiness_bonus_percentage = 0 -> null
      - type                        = "performance" -> null
      - unreachable_threshold       = 0 -> null
      - use_computed_targets        = false -> null
      - wait_on_complete            = true -> null
      - weighted_hash_bits_for_ipv4 = 0 -> null
      - weighted_hash_bits_for_ipv6 = 0 -> null

      - liveness_test {
          - answers_required                 = false -> null
          - disable_nonstandard_port_warning = false -> null
          - disabled                         = false -> null
          - error_penalty                    = 0 -> null
          - http_error3xx                    = false -> null
          - http_error4xx                    = false -> null
          - http_error5xx                    = false -> null
          - name                             = "lt5" -> null
          - peer_certificate_verification    = false -> null
          - recursion_requested              = false -> null
          - test_interval                    = 40 -> null
          - test_object                      = "/junk" -> null
          - test_object_port                 = 1 -> null
          - test_object_protocol             = "HTTP" -> null
          - test_timeout                     = 30 -> null
          - timeout_penalty                  = 0 -> null

          - http_header {
              - name  = "test_name" -> null
              - value = "test_value" -> null
            }
        }

      - traffic_target {
          - datacenter_id = 1 -> null
          - enabled       = true -> null
          - handout_cname = "_reducted_" -> null
          - servers       = [
              - "_reducted_",
            ] -> null
          - weight        = 100 -> null
        }
    }

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

tfexample property was destroyed but tfexample2 property still exists.

Hi @findmyname666

Thank you for raising this issue. We were able to reproduce it and created internal ticket to fix it.

BR,
Lukasz

Hi, fix for this was part of recent relese 5.6.0.