-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 plan should fail if a project or a region value is missing #4071
Comments
This is technically possible but very difficult, as it requires we touch every resource that has optional projects (i.e. all resources with parent projects) and add a customdiff to verify the presence of the provider field, since it is essentially validating a resource field based off a separate "resource" (the provider config). I'm inclined to say this isn't feasible to fix. |
@emilymye Thanks for a quick response! What makes it fundamentally different from AWS |
Based on a quick look and your comment, I'd say that yes, because AWS and Azure have the field marked as required per resource or per provider, they are able to validate at plan. Because GCP allows you generally to specify the project/location in either, they must also be marked as Optional in both and the validation provided through the TF Core Schema API isn't very good for verifying across resources/provider. I'm not saying it's not possible, and we may do it sometime in the future! It's just not the nicest solution and requires us to touch every project/location-based resource, and we haven't run into this issue that much before. If more users are interested, we can look into it, but I'm not sure we have it at a high priority right now. |
I'm going to actually close this since we don't anticipate doing this anytime soon. We'll reopen if we reconsider. |
@emilymye , we've been hit by it and it was confusing. I realise that upstream is not going to fix it,but it doesn't mean Pulumi can't do it's part. One way would be to do merging with ambient defaults on Pulumi side and always pass project to TF explicitly or error before even calling TF is project is not set. |
@redbaron You should probably move your comment to pulumi/pulumi-gcp#129 |
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! |
Community Note
Terraform Version
Terraform v0.12.5
provider.google v2.11.0
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
terraform plan
fails with"project": required field is not set
.Actual Behavior
If I forget to include the
project
value in myprovider "google"
resource,terraform plan
works perfectly well. It's onlyterraform apply
that is going to fail withproject: required field is not set
which is a bit unfortunate.Likewise,
plan
won't fail for a regional resource like subnet with a missingregion
property. I have to wait until the actualapply
to getCannot determine region: set in this resource, or set provider-level 'region' or 'zone'.
.Steps to Reproduce
terraform plan
References
None
The text was updated successfully, but these errors were encountered: