Skip to content

Conversation

@SirGitsalot
Copy link
Member

This is part of the Bazel work, which includes much more modularized builds. Right now the MM compiler can only generate a provider or integration tests that include every product, resource, and data source. The main reason for that is how these are cataloged in the provider: they are imported at compile time and statically registered. In the future, they will be discovered at runtime and dynamically registered.

This PR also switches MMv1 resource discovery to use the registry. It's still static compile-time registration, but with a step toward the aforementioned dynamic registration. Handwritten and DCL resources will come in subsequent PRs, and then the switch to fully dynamic.

The registry ended up in its own package due to circular dependencies. In the future it can probably be moved into the provider package, but not for now as static registration means that the provider package depends on product packages, and product packages will always depend on the provider package.

Probably the most important thing to check is the diff in the generated versions of google[-beta]/provider/provider_mmv1_resources.go. The assignments in generatedIAMDatasources and generatedResources should match 1:1, with the right hand side now coming from the registry.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 963 files changed, 12777 insertions(+), 1105 deletions(-))
google-beta provider: Diff ( 1061 files changed, 14233 insertions(+), 1244 deletions(-))
terraform-google-conversion: Diff ( 102 files changed, 2856 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 5967
Passed tests: 5332
Skipped tests: 633
Affected tests: 2

Click here to see the affected service packages

All service packages are affected

Action taken

Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccAccessContextManager__service_perimeter_dry_run_egress_policy
  • TestAccAccessContextManager__service_perimeter_dry_run_ingress_policy

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccAccessContextManager__access_level [Debug log]
TestAccAccessContextManager__access_level_condition [Debug log]
TestAccAccessContextManager__access_level_custom [Debug log]
TestAccAccessContextManager__access_level_full [Debug log]
TestAccAccessContextManager__access_levels [Debug log]
TestAccAccessContextManager__access_policy [Debug log]
TestAccAccessContextManager__access_policy_scoped [Debug log]
TestAccAccessContextManager__authorized_orgs_desc [Debug log]
TestAccAccessContextManager__service_perimeter [Debug log]
TestAccAccessContextManager__service_perimeter_dry_run_egress_policy [Debug log]
TestAccAccessContextManager__service_perimeter_dry_run_ingress_policy [Debug log]
TestAccAccessContextManager__service_perimeter_update [Debug log]
TestAccAccessContextManager__service_perimeters [Debug log]

🔴 Tests failed when rerunning REPLAYING mode:
TestAccAccessContextManager__service_perimeter_dry_run_egress_policy [Error message] [Debug log]

Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.

Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.


🟢 All tests passed!

View the build log or the debug log for each test

@SirGitsalot SirGitsalot requested a review from melinath January 28, 2026 18:17
@SirGitsalot SirGitsalot marked this pull request as ready for review January 28, 2026 18:17
Copy link
Member

@melinath melinath left a comment

Choose a reason for hiding this comment

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

Overall makes sense / looks good. A few questions & change requests below.

}

type registeredProducts struct {
sync.RWMutex
Copy link
Member

Choose a reason for hiding this comment

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

This should be a pointer to avoid copying the mutex per https://pkg.go.dev/sync#Mutex: "A Mutex must not be copied after first use."

Suggested change
sync.RWMutex
*sync.RWMutex

I'm not sure whether we can achieve that like this... possibly this needs to be a real field on the struct & Lock/Unlock callers need to access the mutex directly.

Copy link
Member Author

Choose a reason for hiding this comment

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

I changed the instantiations to be pointers. They're package-private types and their instantiations are package-private, which also prevents copying.

}

// Schema is used to configure a resource or data source within the registry.
type Schema struct {
Copy link
Member

Choose a reason for hiding this comment

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

Why does this use a single Schema struct w/ SchemaType instead of having different structs per registerable type? It feels like resource/datasource are handled sufficiently differently that it could be easier to use if they were kept separate. (I don't feel very strongly about this, just curious about the reasoning.)

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about it but ultimately decided that since this is just a small wrapper around the Terraform schema type, and that type handles both data sources and resources that this wrapper would too.

_ = schema.Noop
)

func init() {
Copy link
Member

Choose a reason for hiding this comment

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

it looks like this is ending up in TGC, but the other registration blocks aren't. This seems a little surprising. Might cause problems?

Copy link
Member Author

Choose a reason for hiding this comment

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

In theory it's harmless, but I've modified the template to avoid it on TGC.

shuyama1 and others added 21 commits January 28, 2026 12:08
…gnore_schema_changes(dataPolicies) is defined (#15006)
…6013)

Co-authored-by: Mike Prieto <[email protected]>
Co-authored-by: Shuya Ma <[email protected]>
Co-authored-by: jgforsberg <[email protected]>
Co-authored-by: shang-jason <[email protected]>
Co-authored-by: Zhenhua Li <[email protected]>
Co-authored-by: Taneli Leppä <[email protected]>
Co-authored-by: Hank Freund <[email protected]>
Co-authored-by: Ning Kang <[email protected]>
Co-authored-by: Ning Kang <[email protected]>
Co-authored-by: nshah-google <[email protected]>
Co-authored-by: Riley Karson <[email protected]>
Co-authored-by: diegomguzman-google <[email protected]>
Co-authored-by: Nandini Agrawal <[email protected]>
Co-authored-by: Max Portocarrero CI&T <[email protected]>
Co-authored-by: Ricardo Godoy <[email protected]>
Co-authored-by: sushilchaskar28 <[email protected]>
Co-authored-by: Chi-Pin <[email protected]>
Co-authored-by: Björn <[email protected]>
Co-authored-by: Rahul Jaideoka <[email protected]>
Co-authored-by: shivangd <[email protected]>
Co-authored-by: shubhechha-google <[email protected]>
Co-authored-by: Andras Kerekes <[email protected]>
Co-authored-by: Luca Prete <[email protected]>
Co-authored-by: Stephane Charite <[email protected]>
Co-authored-by: Thomas Rodgers <[email protected]>
Co-authored-by: sreemoyee-basu <[email protected]>
Co-authored-by: Nicolas Dumazet <[email protected]>
rileykarson and others added 23 commits January 28, 2026 12:08
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 964 files changed, 12797 insertions(+), 1106 deletions(-))
google-beta provider: Diff ( 1063 files changed, 14264 insertions(+), 1246 deletions(-))
terraform-google-conversion: Diff ( 102 files changed, 2856 insertions(+))

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 964 files changed, 12797 insertions(+), 1106 deletions(-))
google-beta provider: Diff ( 1063 files changed, 14264 insertions(+), 1246 deletions(-))
terraform-google-conversion: Diff ( 102 files changed, 2856 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 5977
Passed tests: 5343
Skipped tests: 633
Affected tests: 1

Click here to see the affected service packages

All service packages are affected

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccAccessContextManager__service_perimeter_dry_run_egress_policy

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccAccessContextManager__access_level [Debug log]
TestAccAccessContextManager__access_level_condition [Debug log]
TestAccAccessContextManager__access_level_custom [Debug log]
TestAccAccessContextManager__access_level_full [Debug log]
TestAccAccessContextManager__access_levels [Debug log]
TestAccAccessContextManager__access_policy [Debug log]
TestAccAccessContextManager__access_policy_scoped [Debug log]
TestAccAccessContextManager__authorized_orgs_desc [Debug log]
TestAccAccessContextManager__service_perimeter [Debug log]
TestAccAccessContextManager__service_perimeter_dry_run_egress_policy [Debug log]
TestAccAccessContextManager__service_perimeter_dry_run_ingress_policy [Debug log]
TestAccAccessContextManager__service_perimeter_update [Debug log]
TestAccAccessContextManager__service_perimeters [Debug log]

🔴 Tests failed when rerunning REPLAYING mode:
TestAccAccessContextManager__service_perimeter_dry_run_egress_policy [Error message] [Debug log]
TestAccAccessContextManager__service_perimeter_dry_run_ingress_policy [Error message] [Debug log]

Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.

Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.


🟢 All tests passed!

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 5980
Passed tests: 5346
Skipped tests: 633
Affected tests: 1

Click here to see the affected service packages

All service packages are affected

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccAccessContextManager__service_perimeter_dry_run_egress_policy

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccAccessContextManager__access_level [Debug log]
TestAccAccessContextManager__access_level_condition [Debug log]
TestAccAccessContextManager__access_level_custom [Debug log]
TestAccAccessContextManager__access_level_full [Debug log]
TestAccAccessContextManager__access_levels [Debug log]
TestAccAccessContextManager__access_policy [Debug log]
TestAccAccessContextManager__access_policy_scoped [Debug log]
TestAccAccessContextManager__authorized_orgs_desc [Debug log]
TestAccAccessContextManager__service_perimeter [Debug log]
TestAccAccessContextManager__service_perimeter_dry_run_egress_policy [Debug log]
TestAccAccessContextManager__service_perimeter_dry_run_ingress_policy [Debug log]
TestAccAccessContextManager__service_perimeter_update [Debug log]
TestAccAccessContextManager__service_perimeters [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🟢 All tests passed!

View the build log or the debug log for each test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.