Skip to content

Conversation

@g-dreva
Copy link
Contributor

@g-dreva g-dreva commented Aug 20, 2025

Adds UnitKind resource provider for SaasRuntime API. (beta)

`google_saas_runtime_unit_kind`

@github-actions github-actions bot requested a review from hao-nan-li August 20, 2025 08:16
@github-actions
Copy link

Hello! I am a robot. Tests will require approval from a repository maintainer to run.

Googlers: For automatic test runs see go/terraform-auto-test-runs.

@hao-nan-li, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.

You can help make sure that review is quick by doing a self-review and by running impacted tests locally.

@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 ( 2 files changed, 325 insertions(+))
google-beta provider: Diff ( 7 files changed, 2132 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 408 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_saas_runtime_unit_kind (3 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_saas_runtime_unit_kind" "primary" {
  annotations     = # value needed
  default_release = # value needed
  input_variable_mappings {
    to {
      ignore_for_lookup = # value needed
    }
  }
  labels = # value needed
  output_variable_mappings {
    to {
      dependency        = # value needed
      ignore_for_lookup = # value needed
      input_variable    = # value needed
    }
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 4
Passed tests: 2
Skipped tests: 0
Affected tests: 2

Click here to see the affected service packages
  • saasruntime

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
  • TestAccSaasRuntimeUnitKind_saasRuntimeUnitKindBasicExample
  • TestAccSaasRuntimeUnitKind_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccSaasRuntimeUnitKind_saasRuntimeUnitKindBasicExample [Debug log]
TestAccSaasRuntimeUnitKind_update [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

@g-dreva
Copy link
Contributor Author

g-dreva commented Aug 20, 2025

Regarding the Missing test report:

Default release is a field that refers to a resource that we haven't added a provider for, and I'm following the guideline to add one resource at a time. I can add both resources in this PR if preferred so I can have full test coverage. Both resources depend on each other but the expected flow is 1) Create UnitKind, 2) Create Release with required UnitKind association, 3) Optionally set the default release on UnitKind to the release.

For OutputVariableMappings, although both input and output variable mappings have the same type, in practice output only uses "from" mapping as I've added in the test. The "to" mapping in output variables is not used.

@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 ( 2 files changed, 325 insertions(+))
google-beta provider: Diff ( 7 files changed, 2140 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 408 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_saas_runtime_unit_kind (3 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_saas_runtime_unit_kind" "primary" {
  default_release = # value needed
  input_variable_mappings {
    to {
      ignore_for_lookup = # value needed
    }
  }
  output_variable_mappings {
    to {
      dependency        = # value needed
      ignore_for_lookup = # value needed
      input_variable    = # value needed
    }
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 4
Passed tests: 3
Skipped tests: 0
Affected tests: 1

Click here to see the affected service packages
  • saasruntime

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
  • TestAccSaasRuntimeUnitKind_update

Get to know how VCR tests work

@hao-nan-li
Copy link
Contributor

Regarding the Missing test report:

Default release is a field that refers to a resource that we haven't added a provider for, and I'm following the guideline to add one resource at a time. I can add both resources in this PR if preferred so I can have full test coverage. Both resources depend on each other but the expected flow is 1) Create UnitKind, 2) Create Release with required UnitKind association, 3) Optionally set the default release on UnitKind to the release.

For OutputVariableMappings, although both input and output variable mappings have the same type, in practice output only uses "from" mapping as I've added in the test. The "to" mapping in output variables is not used.

Thanks for the explanation, if the Default release field refers to something not added, could we temporarily remove that field from this PR?

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccSaasRuntimeUnitKind_update [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

@g-dreva
Copy link
Contributor Author

g-dreva commented Aug 20, 2025

Regarding the Missing test report:
Default release is a field that refers to a resource that we haven't added a provider for, and I'm following the guideline to add one resource at a time. I can add both resources in this PR if preferred so I can have full test coverage. Both resources depend on each other but the expected flow is 1) Create UnitKind, 2) Create Release with required UnitKind association, 3) Optionally set the default release on UnitKind to the release.
For OutputVariableMappings, although both input and output variable mappings have the same type, in practice output only uses "from" mapping as I've added in the test. The "to" mapping in output variables is not used.

Thanks for the explanation, if the Default release field refers to something not added, could we temporarily remove that field from this PR?

The issue I see is that the UnitKind provider without the "default release" field is much less useful. If it's critical to test this field, and if it's ok with you, I would prefer to add both providers in this PR than remove a critical field from this resource and add it later.

To explain why: Releases are typically created as part of a CI/CD pipeline outside of Terraform. Then you might update the UnitKind terraform configuration to point to a particular release ID, without having the Release itself managed through Terraform. So UnitKind without default release will not satisfy customer needs.

@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 ( 2 files changed, 325 insertions(+))
google-beta provider: Diff ( 7 files changed, 2141 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 408 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_saas_runtime_unit_kind (3 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_saas_runtime_unit_kind" "primary" {
  default_release = # value needed
  output_variable_mappings {
    to {
      dependency        = # value needed
      ignore_for_lookup = # value needed
      input_variable    = # value needed
    }
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 4
Passed tests: 3
Skipped tests: 0
Affected tests: 1

Click here to see the affected service packages
  • saasruntime

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
  • TestAccSaasRuntimeUnitKind_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccSaasRuntimeUnitKind_update [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

@hao-nan-li
Copy link
Contributor

Regarding the Missing test report:
Default release is a field that refers to a resource that we haven't added a provider for, and I'm following the guideline to add one resource at a time. I can add both resources in this PR if preferred so I can have full test coverage. Both resources depend on each other but the expected flow is 1) Create UnitKind, 2) Create Release with required UnitKind association, 3) Optionally set the default release on UnitKind to the release.
For OutputVariableMappings, although both input and output variable mappings have the same type, in practice output only uses "from" mapping as I've added in the test. The "to" mapping in output variables is not used.

Thanks for the explanation, if the Default release field refers to something not added, could we temporarily remove that field from this PR?

The issue I see is that the UnitKind provider without the "default release" field is much less useful. If it's critical to test this field, and if it's ok with you, I would prefer to add both providers in this PR than remove a critical field from this resource and add it later.

To explain why: Releases are typically created as part of a CI/CD pipeline outside of Terraform. Then you might update the UnitKind terraform configuration to point to a particular release ID, without having the Release itself managed through Terraform. So UnitKind without default release will not satisfy customer needs.

I'm not sure I can fully understand what you said, but go ahead if you believe adding both providers is beneficial.

@g-dreva
Copy link
Contributor Author

g-dreva commented Aug 21, 2025

While adding the Release provider, I ran into an issue because it requires an Artifact Registry Image that is built in a very specific way. I found https://yaqs.corp.google.com/eng/q/6819086453071413248 which mentions that you can assist with this.

I tried creating the resource in our own testing project and granting the Terraform test project service agent the necessary permissions, but I ran into the issue documented in go/terraform-team-testing#other-dependencies:

google.com org-level constraints on providing access to resources outside the google.com organization

It's also not possible to create this resource through Terraform, so I can't have it set up as part of the test.

If I'm understanding correctly, there are some shared testing projects (like tf-static-<>) that are used to host static resources. Would it be possible for me to get access to one of those to create the images myself?

Or if you're able to do it, can you create the images directly in the testing projects? The instructions are here:go/ez-experience:gcloud-cli#create-blueprints.
To make the commands work, you just need to make sure go/ez-experience:gcloud-cli#set-up-variables has the correct values, for example: https://screenshot.googleplex.com/8HBvCJqyWB6HoyF.

@hao-nan-li
Copy link
Contributor

While adding the Release provider, I ran into an issue because it requires an Artifact Registry Image that is built in a very specific way. I found https://yaqs.corp.google.com/eng/q/6819086453071413248 which mentions that you can assist with this.

I tried creating the resource in our own testing project and granting the Terraform test project service agent the necessary permissions, but I ran into the issue documented in go/terraform-team-testing#other-dependencies:

google.com org-level constraints on providing access to resources outside the google.com organization

It's also not possible to create this resource through Terraform, so I can't have it set up as part of the test.

If I'm understanding correctly, there are some shared testing projects (like tf-static-<>) that are used to host static resources. Would it be possible for me to get access to one of those to create the images myself?

Or if you're able to do it, can you create the images directly in the testing projects? The instructions are here:go/ez-experience:gcloud-cli#create-blueprints. To make the commands work, you just need to make sure go/ez-experience:gcloud-cli#set-up-variables has the correct values, for example: https://screenshot.googleplex.com/8HBvCJqyWB6HoyF.

Do you mind setting up a quick 15 minutes with me? Just to make sure we are on the same page.

@github-actions
Copy link

@hao-nan-li This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

@modular-magician modular-magician added awaiting-approval Pull requests that need reviewer's approval to run presubmit tests and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels Aug 26, 2025
@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Aug 26, 2025
@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 ( 4 files changed, 640 insertions(+))
google-beta provider: Diff ( 13 files changed, 4052 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 2 files changed, 647 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_saas_runtime_release (4 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_saas_runtime_release" "primary" {
  input_variable_defaults {
    type = # value needed
  }
  input_variables {
    type     = # value needed
    value    = # value needed
    variable = # value needed
  }
  output_variables {
    type     = # value needed
    value    = # value needed
    variable = # value needed
  }
}

Resource: google_saas_runtime_unit_kind (6 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_saas_runtime_unit_kind" "primary" {
  default_release = # value needed
  output_variable_mappings {
    to {
      dependency        = # value needed
      ignore_for_lookup = # value needed
      input_variable    = # value needed
    }
  }
}

Multiple resources added

This PR adds multiple new resources: google_saas_runtime_release, google_saas_runtime_unit_kind. This makes review significantly more difficult. Please split it into multiple PRs, one per resource.
An override-multiple-resources label can be added to allow merging.

@modular-magician modular-magician removed the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Aug 26, 2025
@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 6
Passed tests: 3
Skipped tests: 0
Affected tests: 3

Click here to see the affected service packages
  • saasruntime

Action taken

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

Get to know how VCR tests work

@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 ( 4 files changed, 633 insertions(+))
google-beta provider: Diff ( 13 files changed, 4018 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 2 files changed, 637 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_saas_runtime_release (3 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_saas_runtime_release" "primary" {
  input_variable_defaults {
    type = # value needed
  }
  input_variables {
    type     = # value needed
    value    = # value needed
    variable = # value needed
  }
  output_variables {
    type     = # value needed
    value    = # value needed
    variable = # value needed
  }
}

Resource: google_saas_runtime_unit_kind (6 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_saas_runtime_unit_kind" "primary" {
  output_variable_mappings {
    to {
      dependency        = # value needed
      ignore_for_lookup = # value needed
      input_variable    = # value needed
    }
  }
}

Multiple resources added

This PR adds multiple new resources: google_saas_runtime_release, google_saas_runtime_unit_kind. This makes review significantly more difficult. Please split it into multiple PRs, one per resource.
An override-multiple-resources label can be added to allow merging.

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 6
Passed tests: 4
Skipped tests: 0
Affected tests: 2

Click here to see the affected service packages
  • saasruntime

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
  • TestAccSaasRuntimeRelease_saasRuntimeReleaseBasicExample
  • TestAccSaasRuntimeRelease_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccSaasRuntimeRelease_saasRuntimeReleaseBasicExample [Debug log]
TestAccSaasRuntimeRelease_update [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

@modular-magician modular-magician added awaiting-approval Pull requests that need reviewer's approval to run presubmit tests and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels Aug 27, 2025
@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 ( 4 files changed, 634 insertions(+))
google-beta provider: Diff ( 13 files changed, 4022 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 2 files changed, 637 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_saas_runtime_release (3 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_saas_runtime_release" "primary" {
  input_variables {
    type     = # value needed
    value    = # value needed
    variable = # value needed
  }
  output_variables {
    type     = # value needed
    value    = # value needed
    variable = # value needed
  }
}

Resource: google_saas_runtime_unit_kind (6 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_saas_runtime_unit_kind" "primary" {
  output_variable_mappings {
    to {
      dependency        = # value needed
      ignore_for_lookup = # value needed
      input_variable    = # value needed
    }
  }
}

Multiple resources added

This PR adds multiple new resources: google_saas_runtime_release, google_saas_runtime_unit_kind. This makes review significantly more difficult. Please split it into multiple PRs, one per resource.
An override-multiple-resources label can be added to allow merging.

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 6
Passed tests: 4
Skipped tests: 0
Affected tests: 2

Click here to see the affected service packages
  • saasruntime

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
  • TestAccSaasRuntimeRelease_saasRuntimeReleaseBasicExample
  • TestAccSaasRuntimeRelease_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccSaasRuntimeRelease_saasRuntimeReleaseBasicExample [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🔴 Tests failed during RECORDING mode:
TestAccSaasRuntimeRelease_update [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@modular-magician modular-magician added awaiting-approval Pull requests that need reviewer's approval to run presubmit tests and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels Aug 27, 2025
@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 ( 2 files changed, 313 insertions(+))
google-beta provider: Diff ( 7 files changed, 2094 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 398 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_saas_runtime_unit_kind (3 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_saas_runtime_unit_kind" "primary" {
  output_variable_mappings {
    to {
      dependency        = # value needed
      ignore_for_lookup = # value needed
      input_variable    = # value needed
    }
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 4
Passed tests: 4
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages
  • saasruntime

🟢 All tests passed!

View the build log

@github-actions
Copy link

@GoogleCloudPlatform/terraform-team @hao-nan-li This PR has been waiting for review for 1 week. Please take a look! Use the label disable-review-reminders to disable these notifications.

@hao-nan-li
Copy link
Contributor

One thing I want to make sure before merging this: the added tests will run on a different project, do I need to re-do what we've done to create the blueprints on the other project?

@g-dreva
Copy link
Contributor Author

g-dreva commented Aug 27, 2025

One thing I want to make sure before merging this: the added tests will run on a different project, do I need to re-do what we've done to create the blueprints on the other project?

Yes, and actually I need to enable the API and create the P4SA in each testing project as well: https://yaqs.corp.google.com/eng/q/5003599241566748672

The commands needed before creating the blueprint are:
gcloud services enable saasservicemgmt.googleapis.com --project TEST-PROJECT
gcloud beta saas-runtime saas create tftest-saas --location=us-central1 --locations=name=us-central1 --project TEST-PROJECT

@github-actions github-actions bot requested a review from hao-nan-li August 27, 2025 21:12
@hao-nan-li
Copy link
Contributor

One thing I want to make sure before merging this: the added tests will run on a different project, do I need to re-do what we've done to create the blueprints on the other project?

Yes, and actually I need to enable the API and create the P4SA in each testing project as well: https://yaqs.corp.google.com/eng/q/5003599241566748672

The commands needed before creating the blueprint are: gcloud services enable saasservicemgmt.googleapis.com --project TEST-PROJECT gcloud beta saas-runtime saas create tftest-saas --location=us-central1 --locations=name=us-central1 --project TEST-PROJECT

commands applied on nightly beta test project

@github-actions
Copy link

github-actions bot commented Sep 1, 2025

@hao-nan-li This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

@hao-nan-li hao-nan-li added this pull request to the merge queue Sep 2, 2025
Merged via the queue into GoogleCloudPlatform:main with commit c02ebf9 Sep 2, 2025
28 of 29 checks passed
BBBmau pushed a commit to BBBmau/magic-modules that referenced this pull request Sep 26, 2025
jkrish-c pushed a commit to jkrish-c/magic-modules that referenced this pull request Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

override-multiple-resources Allow a PR to contain multiple new resources service/saasservicemgmt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants