akamai / terraform-provider-akamai

Terraform Akamai provider
https://www.terraform.io/docs/providers/akamai/
Mozilla Public License 2.0
109 stars 96 forks source link

akamai_cps_third_party_enrollment constantly see difference in csr #587

Open BAu0002 opened 3 weeks ago

BAu0002 commented 3 weeks ago

Hi there,

Terraform and Akamai Terraform Provider Versions

6.4.0

Affected Resource(s)

akamai_cps_third_party_enrollment

Terraform Configuration Files

main.tf file

resource "akamai_cps_third_party_enrollment" "cert_enrollment" {
  contract_id            = var.contract.id
  common_name            = var.commonName
  sans                   = var.sans
  secure_network         = var.secureNetwork
  sni_only               = true
  signature_algorithm    = "SHA-256"
  certificate_chain_type = "default"

  admin_contact {
    first_name       = lookup(var.adminContact, "first_name", "")
    last_name        = lookup(var.adminContact, "last_name", "")
    phone            = lookup(var.adminContact, "phone", "")
    email            = lookup(var.adminContact, "email", "")
    address_line_one = lookup(var.adminContact, "address_line_one", "")
    city             = lookup(var.adminContact, "city", "")
    country_code     = lookup(var.adminContact, "country_code", "")
    organization     = lookup(var.adminContact, "organization", "")
    postal_code      = lookup(var.adminContact, "postal_code", "")
    region           = lookup(var.adminContact, "region", "")
    title            = lookup(var.adminContact, "title", "")
  }

  tech_contact {
    first_name       = lookup(var.techContact, "first_name", "")
    last_name        = lookup(var.techContact, "last_name", "")
    phone            = lookup(var.techContact, "phone", "")
    email            = lookup(var.techContact, "email", "")
    address_line_one = lookup(var.techContact, "address_line_one", "")
    city             = lookup(var.techContact, "city", "")
    country_code     = lookup(var.techContact, "country_code", "")
    organization     = lookup(var.techContact, "organization", "")
    postal_code      = lookup(var.techContact, "postal_code", "")
    region           = lookup(var.techContact, "region", "")
    title            = lookup(var.techContact, "title", "")
  }

  csr {
    country_code        = lookup(var.csr, "country_code", "")
    city                = lookup(var.csr, "city", "")
    organization        = lookup(var.csr, "organization", "")
    organizational_unit = lookup(var.csr, "organizational_unit", "")
    state               = lookup(var.csr, "state", "")
  }

  network_configuration {
    disallowed_tls_versions = ["TLSv1", "TLSv1_1"]
    clone_dns_names         = true
    geography               = "core"
    ocsp_stapling           = "on"
    preferred_ciphers       = "ak-akamai-2020q1"
    must_have_ciphers       = "ak-akamai-2020q1"
    quic_enabled            = false
  }

  organization {
    name             = lookup(var.organizationDetail, "name", "")
    phone            = lookup(var.organizationDetail, "phone", "")
    address_line_one = lookup(var.organizationDetail, "address_line_one", "")
    address_line_two = lookup(var.organizationDetail, "address_line_two", "")
    city             = lookup(var.organizationDetail, "city", "")
    country_code     = lookup(var.organizationDetail, "country_code", "")
    postal_code      = lookup(var.organizationDetail, "postal_code", "")
    region           = lookup(var.organizationDetail, "region", "")
  }
}

tfvar file

adminContact = {
  first_name = "Technical"
  last_name  = "Support"
  phone      = "+44 1733 123 123"
  email      = "stub@stub.com"
}

techContact = {
  first_name = "stub"
  last_name  = "stub"
  phone      = "+48 11 111 77 22"
  email      = "stub@stub.com"
}

organizationDetail = {
  name             = "x"
  phone            = "01733 123123"
  address_line_one = "stub"
  address_line_two = "stub"
  city             = "Peterborough"
  country_code     = "GB"
  postal_code      = "ST1 ST11"
  region           = "Cambridgeshire"
}

csr = {
  country_code = "GB"
  city         = "Peterborough"
  organization = "x"
  state        = "Peterborough"
}

Expected Behavior and actual Behavior

When I run terraform plan, I expect no change but every run shows a change. This is what I'm seeing in terraform plan:

~ resource "akamai_cps_third_party_enrollment" "cert_enrollment" {
        id                                    = "234436"
        # (11 unchanged attributes hidden)

      - csr {
          - city                  = "Peterborough" -> null
          - country_code          = "GB" -> null
          - organization          = "x" -> null
          - state                 = "Peterborough" -> null
            # (2 unchanged attributes hidden)
        }
      + csr {
          + city                  = "Peterborough"
          + country_code          = "GB"
          + organization          = "x"
          + state                 = "Peterborough"
            # (2 unchanged attributes hidden)
        }

        # (4 unchanged blocks hidden)
    }
mstojanowski commented 2 weeks ago

Hi @BAu0002,

Thank you for rising this issue. So far we are unable to reproduce it. Was this certificate uploaded prior to executing terraform plan command? It would be helpful if you provide exact steps to reproduce and full configuration (if there is anything more).

BR, Marcin