-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Adding "name" to Cloud Build trigger resource #2492
Adding "name" to Cloud Build trigger resource #2492
Conversation
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesNew Pull RequestsI built this PR into one or more new PRs on other repositories, and when those are closed, this PR will also be merged and closed. |
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
@@ -50,6 +50,10 @@ objects: | |||
description: | | |||
The unique identifier for the trigger. | |||
output: true | |||
- !ruby/object:Api::Type::String | |||
name: 'name' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: Reviewing in Terraform context
Adding a property to api.yaml will default to making it optional. However since this property is created by the API if it's not specified you will need to also have it marked as Computed
in Terraform. If it's not Computed and a user upgrades to this version, subsequent terraform apply
runs will attempt to override the name
with an empty string as it will detect a difference between what had been specified in the config and what was set in the state from the API.
To do this you can set the property to default_from_api: true
in the terraform.yaml
. See triggerTemplate.projectId
as an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Chris! This makes a ton of sense. I'm adding this because creating multiple triggers at once sometimes results in them getting the same computed name. Thanks for reviewing and explaining how to add this default.
I've made the change (I think in the right way). 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great thanks, a much needed addition.
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. For future reference there's no need to merge master back into the branch. Our build tools will rebase against master before merging the change in.
@@ -50,6 +50,10 @@ objects: | |||
description: | | |||
The unique identifier for the trigger. | |||
output: true | |||
- !ruby/object:Api::Type::String | |||
name: 'name' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great thanks, a much needed addition.
Tracked submodules are build/terraform-beta build/terraform-mapper build/terraform build/ansible build/inspec.
When trying to create multiple Cloud Build triggers in parallel, sometimes triggers will get the same name. I added the field
name
so that a user can ensure uniqueness instead of rely on the API.Here is an example of what I was doing.
When trying to run the compiler I ran into issues about file limits. I added a note to the
README.md
about this, let me know if I should separate that into a different PR.