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 0.13.5 crash when creating GCS bucket #7690

Closed
ghost opened this issue Nov 2, 2020 · 5 comments · Fixed by GoogleCloudPlatform/magic-modules#4184 or #7760
Closed

Terraform 0.13.5 crash when creating GCS bucket #7690

ghost opened this issue Nov 2, 2020 · 5 comments · Fixed by GoogleCloudPlatform/magic-modules#4184 or #7760
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Nov 2, 2020

This issue was originally opened by @syedrakib as hashicorp/terraform#26771. It was migrated here as a result of the provider split. The original body of the issue is below.


Terraform Version

Terraform v0.13.5
+ provider registry.terraform.io/hashicorp/google v3.45.0
+ provider registry.terraform.io/hashicorp/google-beta v3.45.0
+ provider registry.terraform.io/hashicorp/null v3.0.0
+ provider registry.terraform.io/hashicorp/random v2.3.0

Terraform Plan

All other resources and modules have been created and refreshing successfully. Only this 1 resource is left to create:

  # module.prd_infra.module.gcs_bucket.google_storage_bucket.gcs_bucket will be created
  + resource "google_storage_bucket" "gcs_bucket" {
      + bucket_policy_only          = (known after apply)
      + force_destroy               = false
      + id                          = (known after apply)
      + labels                      = {}
      + location                    = "ASIA-SOUTHEAST1"
      + name                        = "my-bucket-tfprd-unicorn"
      + project                     = (known after apply)
      + self_link                   = (known after apply)
      + storage_class               = "STANDARD"
      + uniform_bucket_level_access = false
      + url                         = (known after apply)
      + cors {}
      + versioning {
          + enabled = false
        }
      + website {
          + main_page_suffix = "index.html"
          + not_found_page   = "404.html"
        }
    }

Crash Output

https://gist.github.com/syedrakib/0e0338ac106f37ca4ec3849a0d0eb431

Expected Behavior

The GCS bucket should just create. Or should fail with a proper error message.

Actual Behavior

Crashing with this crash.log

Additional Context

The crash log and error message are unclear

@syedrakib
Copy link

syedrakib commented Nov 2, 2020

Ok. After troubleshooting the GCS module that i used, turns out the cors {} line in it was the bad player. Removing that line helped. The bucket created successfully.

However, TF should produce a more reasonable error message than the crash.log that it produced. Is it something that can be addressed?

@venkykuberan
Copy link
Contributor

Added the fix for crash/panic situation, however its advised not to use the empty (cors) block in the config, as API may not return any data for that object in the response. In that case TF stores nothing on your state file for the cors and the subsequent plan finds difference (perma diff) between your config & state.
I would recommend either use the cors block with attributes or don't use it, as its an optional.

@syedrakib
Copy link

Hey @venkykuberan . Yes you are right. It was certainly a bug from our side. We shouldn't have added empty cors block to begin with.

However, the error experience made it difficult for us to find out our mistake. Thanks for arranging the fix :)

@syedrakib
Copy link

BTW, is there any PR or merge that you can refer to for this fix?

@ghost
Copy link
Author

ghost commented Dec 10, 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 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.