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

Can't use full region form in provider block #4133

Closed
alexeyd-itsoft opened this issue Jul 30, 2019 · 3 comments
Closed

Can't use full region form in provider block #4133

alexeyd-itsoft opened this issue Jul 30, 2019 · 3 comments
Assignees
Labels

Comments

@alexeyd-itsoft
Copy link

Terraform Version

$ terraform -v
Terraform v0.11.14
+ provider.google v1.20.0

Affected Resource(s)

  • google_XXXXX

Terraform Configuration Files

variable "short_region" {
    type = "string"
    default = "europe-west3"
}

variable "full_region" {
    type = "string"
    default = "https://www.googleapis.com/compute/v1/projects/test/regions/europe-west3"
}

provider "google" {
    credentials = "${file("~/.gcp/gcp-key.json")}"
    project     = "test"
    region      = "${var.full_region}"
}

data "google_compute_zones" "healthy" {
  status = "UP"
}

output "healthy_zone" {
    value = "${data.google_compute_zones.healthy.names}"
}

Debug Output

Panic Output

Expected Behavior

$ terraform apply
data.google_compute_zones.healthy: Refreshing state...

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

healthy_zone = [
    europe-west3-a,
    europe-west3-b,
    europe-west3-c
]

Actual Behavior

$ terraform apply
data.google_compute_zones.healthy: Refreshing state...

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

healthy_zone = []

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000
@ghost ghost added the bug label Jul 30, 2019
paddycarver added a commit to hashicorp/magic-modules that referenced this issue Aug 1, 2019
When configuring the provider, currently we only accept the name of a
region. As per hashicorp/terraform-provider-google#4133, being
able to use self_links for regions here would be helpful. I added a
utility function to pull the region's name from a self_link, tests for
that behavior, and then used it when setting up our Config object. It'll
either return what the user passed in, or if it recognizes it as a
region self_link, it'll just return the name part of the region. I also
left it open to expand on potentially more formats in the future.
@paddycarver
Copy link
Contributor

This looks like it can be resolved by just accepting either the self link to the region or the region name interchangeably in the provider. I've opened GoogleCloudPlatform/magic-modules#2119 to implement that.

@paddycarver paddycarver self-assigned this Aug 1, 2019
paddycarver added a commit to hashicorp/magic-modules that referenced this issue Aug 12, 2019
When configuring the provider, currently we only accept the name of a
region. As per hashicorp/terraform-provider-google#4133, being
able to use self_links for regions here would be helpful. I added a
utility function to pull the region's name from a self_link, tests for
that behavior, and then used it when setting up our Config object. It'll
either return what the user passed in, or if it recognizes it as a
region self_link, it'll just return the name part of the region. I also
left it open to expand on potentially more formats in the future.
@paddycarver
Copy link
Contributor

This has been merged and should be fixed with the next release. :)

@ghost
Copy link

ghost commented Sep 12, 2019

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 and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants