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
Add support for IAM policies on Security Command Center sources #6493
Add support for IAM policies on Security Command Center sources #6493
Conversation
Hello! I am a robot who works on Magic Modules PRs. I've detected that you're a community contributor. @melinath, 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:Terraform GA: Diff ( 4 files changed, 323 insertions(+), 3 deletions(-)) |
Tests analyticsTotal tests: Action takenTriggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed testsTestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRange|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample|TestAccComputeGlobalForwardingRule_internalLoadBalancing|TestAccCloudRunService_cloudRunServiceStaticOutboundExample|TestAccComputeInstance_soleTenantNodeAffinities|TestAccSqlDatabaseInstance_SqlServerAuditConfig |
Tests passed during RECORDING mode: Tests failed during RECORDING mode: Please fix these to complete your PR |
I cannot view these test results. Also, nothing I changed seems even tangentially related to these errors. |
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.
The current test failures are unrelated to your changes.
Please add tests for the new resource. Usually IAM tests are autogenerated; however, SCC sources are an unusual resource that can't be deleted, so you will need to handwrite the tests for the IAM resource as well.
The easiest way to do this would probably be:
- Remove skip_test from the Source example in terraform.yaml
- Generate the beta provider locally - this should generate tests for the iam resources
- Make any changes to the IAM tests that are necessary to account for the fact that SCC sources can't be deleted - for reference, compare the generated source tests from the previous step with the handwritten test that works around this.
- After making sure the IAM tests run locally with your modifications, copy the test file to magic modules as if it was a handwritten test file.
- You will need to add guards around the parts of the tests that test beta-only features. Basically: conditions. For comparison, here are the iam tests for kms crypto key, which also can't be deleted: https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/third_party/terraform/tests/resource_kms_key_ring_iam_test.go.erb
I have added tests as requested, they all seem to pass. Trying to add conditions to the IAM policies in SCC always yields 400, so I assume the API does not support these, yet? I tried the /v1/ and /v1beta1/ endpoints, neither accepted any condition I tried (including the same one used in other tests) Note: I did have I have attached a (with private details removed) request log: |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 5 files changed, 542 insertions(+), 3 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|TestAccComputeInstance_soleTenantNodeAffinities|TestAccComputeGlobalForwardingRule_internalLoadBalancing|TestAccCloudRunService_cloudRunServiceStaticOutboundExample|TestAccCGCSnippet_eventarcWorkflowsExample|TestAccSecurityCenterSourceIamMember|TestAccSecurityCenterSourceIamPolicy|TestAccSecurityCenterSourceIamBinding|TestAccSecurityCenterNotificationConfig_updateStreamingConfigFilter|TestAccSecurityCenterNotificationConfig_sccNotificationConfigBasicExample|TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRange|TestAccSecurityCenterSource_basic|TestAccSqlDatabaseInstance_SqlServerAuditConfig|TestAccFirebaserulesRelease_BasicRelease |
Seems my tests are failing here, but they all pass locally for me. I just checked again and they still pass just fine. //EDIT: I guess disregard that, they passed in the second round... |
Tests passed during RECORDING mode: Tests failed during RECORDING mode: Please fix these to complete your 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.
One quick change request; I'll look into the question of whether the conditions are supported. b/246645013
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 5 files changed, 542 insertions(+), 3 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_soleTenantNodeAffinities|TestAccSecurityCenterSourceIamPolicy|TestAccSecurityCenterSourceIamMember|TestAccSecurityCenterSourceIamBinding|TestAccSecurityCenterSource_basic |
Tests passed during RECORDING mode: Tests failed during RECORDING mode: Please fix these to complete your PR |
@melinath Just reaching out, how are we looking on this? |
apologies for the delay; I'm still waiting to hear back on this. |
@mdietzer-fn looking at this again, it looks like your current implementation actually excludes support for conditions by not passing |
@melinath Sure, lets do that. As mentioned, I had tried setting that in a local build and the conditions did not work at all either:
|
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.
LGTM
If this PR is for Terraform, I acknowledge that I have:
make test
andmake lint
to ensure it passes unit and linter tests.Release Note Template for Downstream PRs (will be copied)