-
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
update google_dataflow_flex_template_job to send sdkpipeline parameters via environment field #9031
update google_dataflow_flex_template_job to send sdkpipeline parameters via environment field #9031
Conversation
… not implemented in final fix
the issue comments mentioned a lack of comprehensive documentation on the SdkPipeline options -- I had verified the camelCase naming and other values looking internally, and while this solution is still not comprehensive, it does cover all the environment block variables -- which were what was causing the main issue here. If any more are added that duplicate something that can be supplied via parameters, they will need to be added to the custom code blocks associated with this PR. |
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform Beta: Diff ( 1 file changed, 341 insertions(+), 20 deletions(-)) |
Tests analyticsTotal tests: Action takenFound 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected testsTestAccAlloydbInstance_createInstanceWithNetworkConfigAndAllocatedIPRange|TestAccVertexAIIndexEndpoint_updated |
|
Unrelated test failures :) |
mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job.go.erb
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job.go.erb
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job.go.erb
Outdated
Show resolved
Hide resolved
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.
Note that we'll want to test 1 or more flows that would have previously failed. I suggested a specific one inline, but other edge cases should be tested too.
mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job.go.erb
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job.go.erb
Outdated
Show resolved
Hide resolved
return err | ||
} | ||
|
||
if p, ok := d.GetOk("parameters.numWorkers"); ok { |
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.
Can you create a test that successfully performs an update? I think we'll hit the error case on any num_workers
change, because O+C fields will return a value to d.GetOk. I may be missing something, though.
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.
I had tested these the most locally since the integers had the funkiest interaction with everything due to Terraform treating a null integer as 0 -- will move to include them more specifically in the update tests
Unless I'm misunderstanding the question --this is why the following line inside checks for if d.HasChange("num_workers")
, rather than GetOk("num_workers")
, the O+C value will not be flagged as having a change when customizediff runs unless it is also in the user's configuration (with a value changed from its output read value). If the parameter has been removed from the parameters{} block entirely, then this check to perform a value override is skipped and the rest of the resource update will using num_workers
as exactly as configured within the user's .tf file (or by persisting the existing computed value if it is never configured).
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!
/gcbrun |
….0.0' into dataflowFlex
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform Beta: Diff ( 2 files changed, 224 insertions(+), 23 deletions(-)) |
output.log Tests the scenarios of swapping from parameters -> normal field in config alongside value update and verifying that the int parameters do not double send when updating within parameters |
return err | ||
} | ||
|
||
if p, ok := d.GetOk("parameters.numWorkers"); ok { |
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!
Tests analyticsTotal tests: Action takenFound 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected testsTestAccContainerNodePool_withSandboxConfig |
|
18480ba
into
GoogleCloudPlatform:FEATURE-BRANCH-major-release-5.0.0
thank you! |
Fixes hashicorp/terraform-provider-google#14679
Since the above issue was introduced, the flex template job resource has had the problem where fields can be sent via both an environment block and the parameters one -- which could lead to permadiffs due to the environment block fields not being flagged as computed, and would lead to guaranteed errors on max_workers and num_workers because they would be sent via both blocks always even when only included in parameters if the user applied a plan through the permadiff (as integer nils are equivalent to 0 within Terraform).
This has been resolved by:
resourceDataflowFlexJobSetupEnv()
function will now update the ResourceData to assign the parameter values to their corresponding environment variables, and remove those parameters from the parameters block sent to the API.Plus resolved a bonus undocumented issue
This technically will not be a breaking change!
Release Note Template for Downstream PRs (will be copied)