Fix compute instance iam asset name#6390
Conversation
|
Hello! I am a robot who works on Magic Modules PRs. I've detected that you're a community contributor. @rileykarson, a repository maintainer, has been assigned to assist you and help review your changes. ❓ First time contributing? Click here for more detailsYour assigned reviewer will help review your code by:
You can help make sure that review is quick by running local tests and ensuring they're passing in between each push you make to your PR's branch. Also, try to leave a comment with each push you make, as pushes generally don't generate emails. If your reviewer doesn't get back to you within a week after your most recent change, please feel free to leave a comment on the issue asking them to take a look! In the absence of a dedicated review dashboard most maintainers manage their pending reviews through email, and those will sometimes get lost in their inbox. |
|
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:TF Validator: Diff ( 13 files changed, 1816 insertions(+), 18 deletions(-)) |
Tests analyticsTotal tests: Action takenTriggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed testsTestAccComputeInstance_networkPerformanceConfig|TestAccComputeInstance_soleTenantNodeAffinities|TestAccComputeGlobalForwardingRule_internalLoadBalancing|TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample|TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample|TestAccCloudRunService_cloudRunServiceStaticOutboundExample|TestAccCloudFunctions2Function_fullUpdate|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample |
|
Tests passed during RECORDING mode: Tests failed during RECORDING mode: Please fix these to complete your PR |
melinath
left a comment
There was a problem hiding this comment.
This case should be handled by the resource_converter_iam template; ideally we'd be able to fix the bug instead of making this handwritten. The resource converter template has access to instance_name being the parent_resource_attribute - this seems like maybe a bug in how the asset_name_template is built when there isn't an explicit import_format.
Should we add an import_format for that resource, or add a logic to replace the {{instance}} as well in the else? |
|
@iyabchen we shouldn't need to add an import format and we shouldn't need to make a special case - we should just need to change the first case (import format being nil) to correctly reference |
|
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:TF Validator: Diff ( 15 files changed, 1752 insertions(+), 8 deletions(-)) |
Tests analyticsTotal tests: Action takenTriggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed testsTestAccComputeInstance_networkPerformanceConfig|TestAccComputeInstance_soleTenantNodeAffinities|TestAccComputeGlobalForwardingRule_internalLoadBalancing|TestAccCloudFunctions2Function_fullUpdate|TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample|TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample|TestAccCloudRunService_cloudRunServiceStaticOutboundExample|TestAccCGCSnippet_eventarcWorkflowsExample|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample|TestAccDataSourceGoogleServiceAccountIdToken_impersonation |
|
Tests passed during RECORDING mode: Tests failed during RECORDING mode: Please fix these to complete your PR |
melinath
left a comment
There was a problem hiding this comment.
💯 this is looking good - it fixes a few other iam resources as well! I think it might be possible to simplify the logic a bit? LGTM otherwise.
| import_format = object.iam_policy.import_format || object.import_format | ||
| if import_format.nil? || import_format.empty? | ||
| asset_name_template = '//' + product_backend_name.downcase + '.googleapis.com/' + (object.cai_base_url || object.self_link || object.base_url) + '/{{' + object.name.downcase + '}}' | ||
| asset_name_template = '//' + product_backend_name.downcase + '.googleapis.com/' + (object.cai_base_url || object.self_link || object.base_url) + '/{{' + asset_resource_name + '}}' |
There was a problem hiding this comment.
| asset_name_template = '//' + product_backend_name.downcase + '.googleapis.com/' + (object.cai_base_url || object.self_link || object.base_url) + '/{{' + asset_resource_name + '}}' | |
| asset_name_template = '//' + product_backend_name.downcase + '.googleapis.com/' + (object.cai_base_url || object.self_link || object.base_url) + '/{{' + parent_resource_name + '}}' |
There was a problem hiding this comment.
Done. parent_resource_name alone works, so no need to || object.name.
|
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:TF Validator: Diff ( 15 files changed, 1752 insertions(+), 8 deletions(-)) |
Tests analyticsTotal tests: Action takenTriggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed testsTestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample|TestAccFirebaserulesRelease_BasicRelease|TestAccComputeGlobalForwardingRule_internalLoadBalancing|TestAccComputeInstance_networkPerformanceConfig|TestAccComputeInstance_soleTenantNodeAffinities|TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample|TestAccCloudFunctions2Function_fullUpdate|TestAccCloudRunService_cloudRunServiceStaticOutboundExample|TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample|TestAccCGCSnippet_eventarcWorkflowsExample |
|
Tests passed during RECORDING mode: Tests failed during RECORDING mode: Please fix these to complete your PR |
* Fix compute instance iam asset name * Use parent resource name for asset name if not empty * fix iam policy test case * revert a new file * use parent_resource_name
Fix compute instance iam asset name
Asset name was expecting
instance, but compute instance iam uses instance_name as attribute name.If this PR is for Terraform, I acknowledge that I have:
make testandmake lintto ensure it passes unit and linter tests.Release Note Template for Downstream PRs (will be copied)