Skip to content

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

Merged
rosbo merged 3 commits into
hashicorp:masterfrom
rosbo:api-version-default-value
Oct 3, 2017
Merged

Firewall uses v1 API if the priority is unset or has the default value.#500
rosbo merged 3 commits into
hashicorp:masterfrom
rosbo:api-version-default-value

Conversation

@rosbo

@rosbo rosbo commented Sep 29, 2017

Copy link
Copy Markdown
Contributor

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 danawillow and selmanj September 29, 2017 22:06
Comment thread google/api_versions.go Outdated

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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread google/api_versions.go Outdated

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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread google/api_versions_test.go Outdated
},
},
"beta fields no set": {
"beta field no set": {

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread google/api_versions_test.go Outdated
Update: baseVersion,
},
},
"beta fields is being updated to default value": {

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread google/api_versions_test.go Outdated
Update: baseVersion,
},
},
"nested beta field is being updated default value": {

Copy link
Copy Markdown
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
Copy Markdown
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

ghost commented Mar 30, 2020

Copy link
Copy Markdown

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 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