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

Google IAP client ID doesn't appear while creating #7334

Closed
aman-w-kumar opened this issue Sep 23, 2020 · 14 comments · Fixed by GoogleCloudPlatform/magic-modules#4044, hashicorp/terraform-provider-google-beta#2592 or #7520
Assignees
Labels

Comments

@aman-w-kumar
Copy link

aman-w-kumar commented Sep 23, 2020

Hi,
I'm facing a strange issue while creating IAP client through terraform. Terraform does show that "resource google_iap_client.iap-xxx: Creating..." but its value doesn't appear after creation (checked in GCP UI and iap client was created) that and becasuse of this terraform didn't create backend service because i use iap block in backend service resource which allow to map IAP client to backend service.

exact error :

"Error : provider produced inconsistent result after apply"
when applying changes to google_iap_client.iap-xxx, provider "registry.terraform.io/hashicorp/google" produced an unexpected new value: Root resource was present, but now absent.

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

@aman-w-kumar
Copy link
Author

Here are logs (test GCP project will no longer exist after this test)

google_iap_client.oauth-3: Creation complete after 1s [id=projects/55629310208/brands/55629310208/identityAwareProxyClients/55629310208-c5kb097motjefue8b082ch4u6hbf4s3c.apps.googleusercontent.com]
google_iap_client.oauth-6: Creation complete after 1s [id=projects/55629310208/brands/55629310208/identityAwareProxyClients/55629310208-pqlmt7n2ekdr3vsjcrq6lm1njijai8tg.apps.googleusercontent.com]
google_iap_client.oauth-15: Creation complete after 1s [id=projects/55629310208/brands/55629310208/identityAwareProxyClients/55629310208-k1sktgfgn2gi4jm5addrvklpp0f1b7jh.apps.googleusercontent.com]
google_iap_client.oauth-7: Creation complete after 1s [id=projects/55629310208/brands/55629310208/identityAwareProxyClients/55629310208-1pntnjip5cnkmus2tgrmbc8bee4ic6g6.apps.googleusercontent.com]
google_iap_client.oauth-25: Creation complete after 1s [id=projects/55629310208/brands/55629310208/identityAwareProxyClients/55629310208-78ebaacla6q91n7ivlj15p4rj96ftbsb.apps.googleusercontent.com]
google_iap_client.oauth-11: Creation complete after 1s [id=projects/55629310208/brands/55629310208/identityAwareProxyClients/55629310208-k1v86km9836gcl8f17mc3djbqdpfkd41.apps.googleusercontent.com]
google_iap_client.oauth-17: Creation complete after 1s [id=projects/55629310208/brands/55629310208/identityAwareProxyClients/55629310208-o9ct0dt0k9jvh4nejmsfnehlsjfhj79e.apps.googleusercontent.com]

Error: Provider produced inconsistent result after apply

When applying changes to google_iap_client.oauth-2, provider
"registry.terraform.io/hashicorp/google" produced an unexpected new value:
Root resource was present, but now absent.

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

@aman-w-kumar
Copy link
Author

Terraform v0.13.3

  • provider registry.terraform.io/hashicorp/google v3.40.0

@edwardmedia edwardmedia self-assigned this Sep 23, 2020
@edwardmedia
Copy link
Contributor

@aman-w-kumar can you post your Terraform config code?

@aman-w-kumar
Copy link
Author

Here is Terraform config code. (sometime it works but most of time, i see error)
provider "google" {
version = "~> 3.40"
}

data "google_project" "project" {
project_id = "project_id"
}

resource "google_iap_client" "oauth-1" {
display_name = "IAP-1"
brand = "projects/805xxxxxxxxxx/brands/805xxxxxxxxxx"
}
resource "google_iap_client" "oauth-2" {
display_name = "IAP-2"
brand = "projects/805xxxxxxxxxx/brands/805xxxxxxxxxx"

}
resource "google_iap_client" "oauth-3" {
display_name = "IAP-3"
brand = "projects/805xxxxxxxxxx/brands/805xxxxxxxxxx"

}
resource "google_iap_client" "oauth-4" {
display_name = "IAP-4"
brand = "projects/805xxxxxxxxxx/brands/805xxxxxxxxxx"

}
resource "google_iap_client" "oauth-5" {
display_name = "IAP-5"
brand = "projects/805xxxxxxxxxx/brands/805xxxxxxxxxx"

}
resource "google_iap_client" "oauth-6" {
display_name = "IAP-6"
brand = "projects/805xxxxxxxxxx/brands/805xxxxxxxxxx"

}
############################################
Here is "Terraform apply"
data.google_project.project: Refreshing state...

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

  • create

Terraform will perform the following actions:

google_iap_client.oauth-1 will be created

  • resource "google_iap_client" "oauth-1" {
    • brand = "projects/8051xxxxxxxxxx/brands/8051xxxxxxxxxx"
    • client_id = (known after apply)
    • display_name = "IAP-1"
    • id = (known after apply)
    • secret = (sensitive value)
      }

google_iap_client.oauth-2 will be created

  • resource "google_iap_client" "oauth-2" {
    • brand = "projects/8051xxxxxxxxxx/brands/8051xxxxxxxxxx"
    • client_id = (known after apply)
    • display_name = "IAP-2"
    • id = (known after apply)
    • secret = (sensitive value)
      }

google_iap_client.oauth-3 will be created

  • resource "google_iap_client" "oauth-3" {
    • brand = "projects/8051xxxxxxxxxx/brands/8051xxxxxxxxxx"
    • client_id = (known after apply)
    • display_name = "IAP-3"
    • id = (known after apply)
    • secret = (sensitive value)
      }

google_iap_client.oauth-4 will be created

  • resource "google_iap_client" "oauth-4" {
    • brand = "projects/8051xxxxxxxxxx/brands/8051xxxxxxxxxx"
    • client_id = (known after apply)
    • display_name = "IAP-4"
    • id = (known after apply)
    • secret = (sensitive value)
      }

google_iap_client.oauth-5 will be created

  • resource "google_iap_client" "oauth-5" {
    • brand = "projects/8051xxxxxxxxxx/brands/8051xxxxxxxxxx"
    • client_id = (known after apply)
    • display_name = "IAP-5"
    • id = (known after apply)
    • secret = (sensitive value)
      }

google_iap_client.oauth-6 will be created

  • resource "google_iap_client" "oauth-6" {
    • brand = "projects/8051xxxxxxxxxx/brands/8051xxxxxxxxxx"
    • client_id = (known after apply)
    • display_name = "IAP-6"
    • id = (known after apply)
    • secret = (sensitive value)
      }

Plan: 6 to add, 0 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

google_iap_client.oauth-1: Creating...

Error: Provider produced inconsistent result after apply

When applying changes to google_iap_client.oauth-1, provider
"registry.terraform.io/hashicorp/google" produced an unexpected new value:
Root resource was present, but now absent.

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

@ghost ghost removed waiting-response labels Sep 24, 2020
@aman-w-kumar
Copy link
Author

aman-w-kumar commented Sep 24, 2020

I tested here with only creation of IAP clients and found that it is having some bug in creation. in the above example , it is failed at oauth-1 but when i check credentials in API & services on GCP console - it actually creates this oauth-1 resource but didn't write anything to terraform state. moreover when i run again. it starts from beginning to create oauth-1 and create duplicate again.
image

@aman-w-kumar
Copy link
Author

Another example (when Terraform is failed while creating IAP-6 but in fact it is created and seen in GCP UI and doesn't show up in "terraform state"
image

image

@aman-w-kumar
Copy link
Author

Trace logs of one of IAP-5 client creation.
########################################################
google_iap_client.oauth-5: Creating...
2020/09/24 07:54:52 [TRACE] eval: *terraform.EvalCheckPlannedChange
2020/09/24 07:54:52 [TRACE] EvalCheckPlannedChange: Verifying that actual change (action Create) matches planned change (action Create)
2020/09/24 07:54:52 [TRACE] eval: *terraform.EvalGetProvider
2020/09/24 07:54:52 [TRACE] eval: *terraform.EvalReadState
2020/09/24 07:54:52 [TRACE] EvalReadState: reading state for google_iap_client.oauth-5
2020/09/24 07:54:52 [TRACE] EvalReadState: no state present for google_iap_client.oauth-5
2020/09/24 07:54:52 [TRACE] eval: *terraform.EvalReduceDiff
2020/09/24 07:54:52 [TRACE] eval: *terraform.EvalIf
2020/09/24 07:54:52 [TRACE] eval: terraform.EvalNoop
2020/09/24 07:54:52 [TRACE] eval: *terraform.EvalApplyPre
2020/09/24 07:54:52 [TRACE] eval: *terraform.EvalApply
2020/09/24 07:54:52 [DEBUG] EvalApply: ProviderMeta config value set
2020/09/24 07:54:52 [DEBUG] google_iap_client.oauth-5: applying the planned Create change
2020/09/24 07:54:52 [TRACE] GRPCProvider: ApplyResourceChange
2020-09-24T07:54:52.633Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 2020/09/24 07:54:52 [DEBUG] Creating new Client: map[string]interface {}{"displayName":"IAP-5"}
2020-09-24T07:54:52.634Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 2020/09/24 07:54:52 [DEBUG] Waiting for state to become: [success]
2020-09-24T07:54:52.634Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 2020/09/24 07:54:52 [DEBUG] Retry Transport: starting RoundTrip retry loop
2020-09-24T07:54:52.634Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 2020/09/24 07:54:52 [DEBUG] Retry Transport: request attempt 0
2020-09-24T07:54:52.634Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 2020/09/24 07:54:52 [DEBUG] Google API Request Details:
2020-09-24T07:54:52.634Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: ---[ REQUEST ]---------------------------------------
2020-09-24T07:54:52.634Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: POST /v1/projects/8051xxxxxxxxxx/brands/8051xxxxxxxxxx/identityAwareProxyClients?alt=json HTTP/1.1
2020-09-24T07:54:52.634Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Host: iap.googleapis.com
2020-09-24T07:54:52.634Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: User-Agent: HashiCorp Terraform/0.13.3 (+https://www.terraform.io) Terraform Plugin SDK/1.11.0 terraform-provider-google/3.40.0
2020-09-24T07:54:52.634Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Content-Length: 24
2020-09-24T07:54:52.634Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Content-Type: application/json
2020-09-24T07:54:52.634Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Accept-Encoding: gzip
2020-09-24T07:54:52.634Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5:
2020-09-24T07:54:52.634Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: {
2020-09-24T07:54:52.634Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: "displayName": "IAP-5"
2020-09-24T07:54:52.634Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: }
2020-09-24T07:54:52.634Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5:
2020-09-24T07:54:52.634Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: -----------------------------------------------------
2020-09-24T07:54:53.915Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 2020/09/24 07:54:53 [DEBUG] Google API Response Details:
2020-09-24T07:54:53.915Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: ---[ RESPONSE ]--------------------------------------
2020-09-24T07:54:53.915Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: HTTP/1.1 200 OK
2020-09-24T07:54:53.915Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Connection: close
2020-09-24T07:54:53.915Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Transfer-Encoding: chunked
2020-09-24T07:54:53.915Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Cache-Control: private
2020-09-24T07:54:53.915Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Content-Type: application/json; charset=UTF-8
2020-09-24T07:54:53.916Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: X-Frame-Options: SAMEORIGIN
2020-09-24T07:54:53.916Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: X-Xss-Protection: 0
2020-09-24T07:54:53.916Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5:
2020-09-24T07:54:53.916Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: df
2020-09-24T07:54:53.916Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: {
2020-09-24T07:54:53.916Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: "name": "projects/8051xxxxxxxxxx/brands/8051xxxxxxxxxx/identityAwareProxyClients/8051xxxxxxxxxx-2an7keps8587njotca8mval1pdjd0k0n.apps.googleusercontent.com",
2020-09-24T07:54:53.916Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: "secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
2020-09-24T07:54:53.916Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: "displayName": "IAP-5"
2020-09-24T07:54:53.916Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: }
2020-09-24T07:54:53.916Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5:
2020-09-24T07:54:53.916Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 0
2020-09-24T07:54:53.916Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5:
2020-09-24T07:54:53.916Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5:
2020-09-24T07:54:53.916Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: -----------------------------------------------------
2020-09-24T07:54:53.916Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 2020/09/24 07:54:53 [DEBUG] Retry Transport: Stopping retries, last request was successful
2020-09-24T07:54:53.916Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 2020/09/24 07:54:53 [DEBUG] Retry Transport: Returning after 1 attempts
2020-09-24T07:54:53.916Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 2020/09/24 07:54:53 [DEBUG] Finished creating Client "projects/8051xxxxxxxxxx/brands/8051xxxxxxxxxx/identityAwareProxyClients/": map[string]interface {}{"displayName":"IAP-5", "name":"projects/8051xxxxxxxxxx/brands/8051xxxxxxxxxx/identityAwareProxyClients/8051xxxxxxxxxx-2an7keps8587njotca8mval1pdjd0k0n.apps.googleusercontent.com", "secret":"xxxxxxxxxxxxxxxxxxxxxxxxxxx"}
2020-09-24T07:54:53.917Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 2020/09/24 07:54:53 [DEBUG] Waiting for state to become: [success]
2020-09-24T07:54:53.917Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 2020/09/24 07:54:53 [DEBUG] Retry Transport: starting RoundTrip retry loop
2020-09-24T07:54:53.917Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 2020/09/24 07:54:53 [DEBUG] Retry Transport: request attempt 0
2020-09-24T07:54:53.918Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 2020/09/24 07:54:53 [DEBUG] Google API Request Details:
2020-09-24T07:54:53.918Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: ---[ REQUEST ]---------------------------------------
2020-09-24T07:54:53.918Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: GET /v1/projects/8051xxxxxxxxxx/brands/8051xxxxxxxxxx/identityAwareProxyClients/8051xxxxxxxxxx-2an7keps8587njotca8mval1pdjd0k0n.apps.googleusercontent.com?alt=json HTTP/1.1
2020-09-24T07:54:53.918Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Host: iap.googleapis.com
2020-09-24T07:54:53.918Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: User-Agent: HashiCorp Terraform/0.13.3 (+https://www.terraform.io) Terraform Plugin SDK/1.11.0 terraform-provider-google/3.40.0
2020-09-24T07:54:53.918Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Content-Type: application/json
2020-09-24T07:54:53.918Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Accept-Encoding: gzip
2020-09-24T07:54:53.918Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5:
2020-09-24T07:54:53.918Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5:
2020-09-24T07:54:53.918Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: -----------------------------------------------------
2020-09-24T07:54:53.988Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 2020/09/24 07:54:53 [DEBUG] Google API Response Details:
2020-09-24T07:54:53.988Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: ---[ RESPONSE ]--------------------------------------
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: HTTP/1.1 404 Not Found
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Connection: close

2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Transfer-Encoding: chunked
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Cache-Control: private
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Content-Type: application/json; charset=UTF-8
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Date: Thu, 24 Sep 2020 07:54:53 GMT
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Server: ESF
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Vary: Origin
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Vary: X-Origin
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Vary: Referer
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: X-Content-Type-Options: nosniff
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: X-Frame-Options: SAMEORIGIN
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: X-Xss-Protection: 0
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5:
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 72
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: {
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: "error": {
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: "code": 404,
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: "message": "Requested entity was not found.",
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: "status": "NOT_FOUND"

2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: }
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: }
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5:
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 0
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5:
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5:
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: -----------------------------------------------------
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 2020/09/24 07:54:53 [DEBUG] Retry Transport: Stopping retries, last request failed with non-retryable error: googleapi: got HTTP response code 404 with body: HTTP/1.1 404 Not Found
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Connection: close
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Transfer-Encoding: chunked
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Cache-Control: private
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Content-Type: application/json; charset=UTF-8
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Date: Thu, 24 Sep 2020 07:54:53 GMT
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Server: ESF
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Vary: Origin
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Vary: X-Origin
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: Vary: Referer
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: X-Content-Type-Options: nosniff
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: X-Frame-Options: SAMEORIGIN
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: X-Xss-Protection: 0
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5:
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 72
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: {
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: "error": {
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: "code": 404,
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: "message": "Requested entity was not found.",
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: "status": "NOT_FOUND"

2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: }
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: }
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5:
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 0
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5:
2020-09-24T07:54:53.989Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 2020/09/24 07:54:53 [DEBUG] Retry Transport: Returning after 1 attempts
**2020-09-24T07:54:53.990Z [DEBUG] plugin.terraform-provider-google_v3.40.0_x5: 2020/09/24 07:54:53 [WARN] Removing IapClient "projects/8051xxxxxxxxxx/brands/8051xxxxxxxxxx/identityAwareProxyClients/8051xxxxxxxxxx-2an7keps8587njotca8mval1pdjd0k0n.apps.googleusercontent.com" because it's gone
2020/09/24 07:54:53 [DEBUG] google_iap_client.oauth-5: apply errored, but we're indicating that via the Error pointer rather than returning it: Provider produced inconsistent result after apply: When applying changes to google_iap_client.oauth-5, provider "registry.terraform.io/hashicorp/google" produced an unexpected new value: Root resource was present, but now absent.

This is a bug in the provider, which should be reported in the provider's own issue tracker.**
2020/09/24 07:54:53 [TRACE] eval: *terraform.EvalMaybeTainted
2020/09/24 07:54:53 [TRACE] EvalMaybeTainted: google_iap_client.oauth-5 encountered an error during creation, so it is now marked as tainted
2020/09/24 07:54:53 [TRACE] eval: *terraform.EvalWriteState
2020/09/24 07:54:53 [TRACE] EvalWriteState: removing state object for google_iap_client.oauth-5
2020/09/24 07:54:53 [TRACE] eval: *terraform.EvalApplyProvisioners
2020/09/24 07:54:53 [TRACE] EvalApplyProvisioners: google_iap_client.oauth-5 has no state, so skipping provisioners
2020/09/24 07:54:53 [TRACE] eval: *terraform.EvalMaybeTainted
2020/09/24 07:54:53 [TRACE] EvalMaybeTainted: google_iap_client.oauth-5 encountered an error during creation, so it is now marked as tainted
2020/09/24 07:54:53 [TRACE] eval: *terraform.EvalWriteState
2020/09/24 07:54:53 [TRACE] EvalWriteState: removing state object for google_iap_client.oauth-5
2020/09/24 07:54:53 [TRACE] eval: *terraform.EvalIf
2020/09/24 07:54:53 [TRACE] eval: *terraform.EvalIf
2020/09/24 07:54:53 [TRACE] eval: *terraform.EvalWriteDiff
2020/09/24 07:54:53 [TRACE] eval: *terraform.EvalApplyPost
2020/09/24 07:54:53 [ERROR] eval: *terraform.EvalApplyPost, err: Provider produced inconsistent result after apply: When applying changes to google_iap_client.oauth-5, provider "registry.terraform.io/hashicorp/google" produced an unexpected new value: Root resource was present, but now absent.

This is a bug in the provider, which should be reported in the provider's own issue tracker.
2020/09/24 07:54:53 [ERROR] eval: *terraform.EvalSequence, err: Provider produced inconsistent result after apply: When applying changes to google_iap_client.oauth-5, provider "registry.terraform.io/hashicorp/google" produced an unexpected new value: Root resource was present, but now absent.

This is a bug in the provider, which should be reported in the provider's own issue tracker.
2020/09/24 07:54:53 [TRACE] [walkApply] Exiting eval tree: google_iap_client.oauth-5
2020/09/24 07:54:53 [TRACE] vertex "google_iap_client.oauth-5": visit complete
########################################################

@aman-w-kumar
Copy link
Author

could you please change the label as "Bug"? thanks

@edwardmedia edwardmedia added bug and removed question labels Sep 24, 2020
@edwardmedia edwardmedia assigned c2thorn and unassigned c2thorn Sep 24, 2020
@c2thorn c2thorn removed their assignment Sep 24, 2020
@slevenick
Copy link
Collaborator

Interesting. I think I know what the issue is, but can you give me some more details on when you noticed this?

Was this the first time you tried to create IAP clients via Terraform?

@aman-w-kumar
Copy link
Author

Yes, I'm creating first time with terraform. Sometime it works but most of time it's failing. I tried with retry but then I found there are multiple duplicate IAP clients are created with same name but different clientID as you might go through to the debug logs above. You might find that terraform lost resource after creation and try to connect IAP API but got response "Requested entity was not found.", I think you know better 😉 what is missing there. Thanks ak

@aman-w-kumar
Copy link
Author

Imo, It could be related eventual consistent and resource creation takes some time to propogate but I'm not sure how terraform is handling this situation, there could be some other reasons why terraform lost object after creation.

@slevenick
Copy link
Collaborator

Looks like eventual consistency to me. I'm unclear on why this would be showing up for you though, I thought we already had polling on the resource creation. I'll check it out and maybe tune it a bit

@aman-w-kumar
Copy link
Author

Just curious, if this issue is resolved ?

@ghost
Copy link

ghost commented Nov 14, 2020

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 Nov 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.