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

Firewall uses v1 API if the priority is unset or has the default value. #500

Merged
merged 3 commits into from
Oct 3, 2017

Conversation

rosbo
Copy link
Contributor

@rosbo rosbo commented Sep 29, 2017

Fixes #429

Right now, the google_compute_firewall always uses the beta API even if no beta fields are set.

The is because the beta priority field has a default value set to 1000 in the schema. Even if you don't specify a value for the priority field, the field still has a value (the default value) and getComputeApiVersion or getComputeApiVersionUpdate consider that the field is used and returns that the v0beta should be used.

@rosbo rosbo requested review from selmanj and danawillow September 29, 2017 22:06

func defaultInUseFunc(d TerraformResourceData, path string, defaultValue interface{}) bool {
// At read and delete time, there is no change.
// At create time, all fields are marked has changed. We should only considered the feature active if the field has
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: consider

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


func updateInUseFunc(d TerraformResourceData, path string, defaultValue interface{}) bool {
// During a resource update, if the beta field has changes, the feature is considered active even if the new value
// is the default value. This is because the beta API must be call to change the value of the field back to the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: called

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -29,7 +29,7 @@ func TestComputeApiVersion(t *testing.T) {
Update: baseVersion,
},
},
"beta fields no set": {
"beta field no set": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: not

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Update: baseVersion,
},
},
"beta fields is being updated to default value": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: field

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Update: baseVersion,
},
},
"nested beta field is being updated default value": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: updated to

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@rosbo rosbo merged commit 7d65b3e into hashicorp:master Oct 3, 2017
@rosbo rosbo deleted the api-version-default-value branch October 3, 2017 20:30
negz pushed a commit to negz/terraform-provider-google that referenced this pull request Oct 17, 2017
…e. (hashicorp#500)

* api_versions supports default value
* Firewall use v1 API if the priority is set to default value (1000)
negz pushed a commit to negz/terraform-provider-google that referenced this pull request Oct 17, 2017
…e. (hashicorp#500)

* api_versions supports default value
* Firewall use v1 API if the priority is set to default value (1000)
luis-silva pushed a commit to luis-silva/terraform-provider-google that referenced this pull request May 21, 2019
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
@ghost
Copy link

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

Successfully merging this pull request may close these issues.

google_compute_firewall always uses the beta API even when not using any beta fields.
2 participants