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

provider block using google-beta #5519

Closed
anubbhavm opened this issue Jan 27, 2020 · 7 comments · Fixed by GoogleCloudPlatform/magic-modules#3100, #5634 or hashicorp/terraform-provider-google-beta#1743

Comments

@anubbhavm
Copy link

anubbhavm commented Jan 27, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Expected Behavior

As per documentation,
https://www.terraform.io/docs/providers/google/guides/provider_versions.html#using-both-provider-versions-together
To use the google-beta provider, explicitly define a google-beta provider block, and state on the resource which provider you wish to use.

provider "google-beta" {
  credentials = "${file("account.json")}"
  project     = "my-project-id"
  region      = "us-central1"
}

resource "google_compute_instance" "beta-instance" {
  provider = "google-beta"

  # ...
}

Actual Behavior

Not explicitly defining the google-beta provider block and only defining the provider on the resource also seems to work.

resource "google_compute_instance" "beta-instance" {
  provider = "google-beta"
  # ...
}
@ghost ghost added the bug label Jan 27, 2020
@edwardmedia edwardmedia self-assigned this Jan 28, 2020
@edwardmedia
Copy link
Contributor

@anubbhavm Not sure what exact cases you are referring, but if you are taking about below two configs, they are different. Let me know if I addressed your issue.

resource "google_compute_instance" "beta-instance" {
  provider = "google-beta"
  # ...
}
resource "google_compute_instance" "beta-instance" {
  # provider = "google-beta"
  # ...
}

@anubbhavm
Copy link
Author

anubbhavm commented Jan 28, 2020

Okay let me clarify:
In order to use the google-beta provider, is it required to explicitly define a google-beta provider block?

provider "google-beta" {
  credentials = "${file("account.json")}"
  project     = "my-project-id"
  region      = "us-central1"
}

Or, just stating the provider on the resource should suffice?

resource "google_compute_instance" "beta-instance" {
  provider = "google-beta"
  # ...
}

The TF documentation says both are necessary (a provider block and provider on the resource), but I was able to use the beta feature without explicitly defining a provider block.

@ghost ghost removed the waiting-response label Jan 28, 2020
@edwardmedia
Copy link
Contributor

@anubbhavm the block is not required. You need to provide the attribute provider inside the resource if it is google-beta.

@anubbhavm
Copy link
Author

anubbhavm commented Jan 29, 2020

Thanks. Could we then have the TF documentation updated please?
https://www.terraform.io/docs/providers/google/guides/provider_versions.html#using-the-google-beta-provider

@danawillow
Copy link
Contributor

Thanks @anubbhavm, that's a good suggestion and I didn't even know that not providing the provider block for google-beta even worked, so I learned something new today :)

Changing the labels since this is a docs improvement rather than a bug in the provider. We'll triage this alongside FRs.

@rileykarson
Copy link
Collaborator

This changed in Terraform 0.12. We were aware at the time of 2.5.1's release, but kept the docs indicating it was required because the majority of users would have been using 0.11 still. It could be worth including a note about 0.11 still needing it, since our docs are unversioned and we expect some users to be using 2.X + 0.11 still.

@ghost
Copy link

ghost commented Mar 28, 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 and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.