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

Terraform can't update Host and path rules in LoadBalancer (NEG) #8074

Closed
skolenkin opened this issue Dec 23, 2020 · 6 comments
Closed

Terraform can't update Host and path rules in LoadBalancer (NEG) #8074

skolenkin opened this issue Dec 23, 2020 · 6 comments

Comments

@skolenkin
Copy link

Subject: Terraform can't update Host and path rules in LoadBalancer (NEG)
terraform apply will fail If we want to add or edit additional path rules

terraform plan:

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # module.load_balancer.google_compute_url_map.urlmap will be updated in-place
  ~ resource "google_compute_url_map" "urlmap" {
        id                 = "projects/development/global/urlMaps/dev-url-map"
        name               = "dev-url-map"
        # (6 unchanged attributes hidden)


      ~ path_matcher {
            name            = "dev-path-matcher"
            # (1 unchanged attribute hidden)

          ~ path_rule {
              ~ paths   = [
                  + "/auth/login2",
                    # (17 unchanged elements hidden)
                ]
                # (1 unchanged attribute hidden)
            }
        }

        # (2 unchanged blocks hidden)
    }

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

Terraform code:

resource "google_compute_url_map" "urlmap" {
  name = "dev-url-map"

  default_service = google_compute_backend_service.default.id
  host_rule {
    hosts        = ["*"]
    path_matcher = "dev-path-matcher"
  }

  path_matcher {
    default_service = google_compute_backend_service.default.id
    name            = "dev-path-matcher"

    path_rule {
      paths = ["/_gcp_iap/*",
        "/admin", "/admin/*",
        "/auth/login2"]
      service = google_compute_backend_service.default_iap.id
    }
  }
}

Terraform apply:

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # module.load_balancer.google_compute_url_map.urlmap will be updated in-place
  ~ resource "google_compute_url_map" "urlmap" {
        id                 = "projects/development/global/urlMaps/dev-url-map"
        name               = "dev-url-map"
        # (6 unchanged attributes hidden)


      ~ path_matcher {
            name            = "dev-path-matcher"
            # (1 unchanged attribute hidden)

          ~ path_rule {
              ~ paths   = [
                  + "/auth/login2",
                    # (17 unchanged elements hidden)
                ]
                # (1 unchanged attribute hidden)
            }
        }

        # (2 unchanged blocks hidden)
    }

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

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


Error: Provider produced inconsistent final plan

When expanding the plan for module.load_balancer.google_compute_url_map.urlmap
to include new values learned so far during apply, provider
"registry.terraform.io/hashicorp/google" produced an invalid new value for
.map_id: was cty.NumberIntVal(1.473177246450628164e+18), but now
cty.NumberIntVal(1.473177246450628e+18).

This is a bug in the provider, which should be reported in the provider's own
issue tracker.

If we add or edit URL path manually Terraform apply will work.

terraform version
Terraform v0.14.2
+ provider registry.terraform.io/hashicorp/archive v2.0.0
+ provider registry.terraform.io/hashicorp/google v3.51.0
+ provider registry.terraform.io/hashicorp/google-beta v3.51.0
+ provider registry.terraform.io/hashicorp/null v2.1.2
+ provider registry.terraform.io/hashicorp/random v2.3.1
+ provider registry.terraform.io/hashicorp/template v2.2.0

Your version of Terraform is out of date! The latest version
is 0.14.3. You can update by downloading from https://www.terraform.io/downloads.html
@edwardmedia
Copy link
Contributor

@skolenkin can you share the debug log?

@skolenkin
Copy link
Author

@edwardmedia Yes sure,

LOG_LEVEL=DBUG terraform apply -var-file=dev.tfvars

module.postgresql.google_secret_manager_secret_version.web_presence: Refreshing state... [id=projects/462288303433/secrets/XXXXXXX/versions/1]

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # module.load_balancer.google_compute_url_map.urlmap will be updated in-place
  ~ resource "google_compute_url_map" "urlmap" {
        id                 = "projects/development/global/urlMaps/dev-url-map"
        name               = "dev-url-map"
        # (6 unchanged attributes hidden)


      ~ path_matcher {
            name            = "dev-path-matcher"
            # (1 unchanged attribute hidden)

          ~ path_rule {
              ~ paths   = [
                  + "/auth/login2",
                    # (17 unchanged elements hidden)
                ]
                # (1 unchanged attribute hidden)
            }
        }

        # (2 unchanged blocks hidden)
    }

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

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


Error: Provider produced inconsistent final plan

When expanding the plan for module.load_balancer.google_compute_url_map.urlmap
to include new values learned so far during apply, provider
"registry.terraform.io/hashicorp/google" produced an invalid new value for
.map_id: was cty.NumberIntVal(1.473177246450628164e+18), but now
cty.NumberIntVal(1.473177246450628e+18).

This is a bug in the provider, which should be reported in the provider's own
issue tracker.

@ghost ghost removed the waiting-response label Dec 23, 2020
@edwardmedia
Copy link
Contributor

I can repro the issue

@rileykarson
Copy link
Collaborator

rileykarson commented Dec 28, 2020

@edwardmedia: Quick note! Your repro is failing due to a different reason. It hits the API and receives an error there- I believe you've got a stray reference to the mysite matcher once you've removed its definition.

@skolenkin: This is a variant of #7945 I believe. You can downgrade to 0.13.X to fix it, and we should have a fix out so that the provider works with 0.14 early next week.

@rileykarson
Copy link
Collaborator

Also one additional note, #7945 is ultimately the provider SDK issue hashicorp/terraform-plugin-sdk#655

@ghost
Copy link

ghost commented Jan 28, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Jan 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants