Skip to content
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 remaining fields to TPU VM resource #9308

Merged
merged 8 commits into from
Oct 23, 2023
Merged

Add remaining fields to TPU VM resource #9308

merged 8 commits into from
Oct 23, 2023

Conversation

roaks3
Copy link
Contributor

@roaks3 roaks3 commented Oct 19, 2023

b/292585830

This adds the remaining fields to google_tpu_v2_vm that are available from the API.

Notable exceptions (which may end up making it into this PR):

  • accelerator_config
    • This conflicts with accelerator_type, and we'll need to work around the existing default behavior

One other interesting piece is service_account.scopes. If the user specifies this field but does not include https://www.googleapis.com/auth/pubsub, it will be automatically added by the server, so I've added a diff_suppress to ignore that value.

Release Note Template for Downstream PRs (will be copied)

tpuv2: added more fields to `google_tpu_v2_vm` resource, including `network_config`, `scheduling_config`, `shielded_instance_config`, `service_account` and `data_disks`

@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.

Terraform GA: Diff ( 1 file changed, 218 insertions(+))
Terraform Beta: Diff ( 4 files changed, 1247 insertions(+), 34 deletions(-))
TF Conversion: Diff ( 1 file changed, 268 insertions(+))
TF OiCS: Diff ( 1 file changed, 52 insertions(+))

Missing test report

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

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

resource "google_tpu_v2_vm" "primary" {
  scheduling_config {
    reserved = # value needed
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3162
Passed tests 2840
Skipped tests: 318
Affected tests: 4

Action taken

Found 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccContainerAttachedCluster_containerAttachedClusterFullExample|TestAccContainerAttachedCluster_update|TestAccTpuV2Vm_update|TestAccTpuV2Vm_tpuV2VmFullExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccContainerAttachedCluster_containerAttachedClusterFullExample[Debug log]
TestAccContainerAttachedCluster_update[Debug log]
TestAccTpuV2Vm_tpuV2VmFullExample[Debug log]

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccTpuV2Vm_update[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

@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.

Terraform GA: Diff ( 1 file changed, 218 insertions(+))
Terraform Beta: Diff ( 4 files changed, 1255 insertions(+), 34 deletions(-))
TF Conversion: Diff ( 1 file changed, 268 insertions(+))
TF OiCS: Diff ( 1 file changed, 52 insertions(+))

Missing test report

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

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

resource "google_tpu_v2_vm" "primary" {
  scheduling_config {
    reserved = # value needed
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3162
Passed tests 2841
Skipped tests: 318
Affected tests: 3

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
TestAccContainerAttachedCluster_containerAttachedClusterFullExample|TestAccContainerAttachedCluster_update|TestAccTpuV2Vm_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccContainerAttachedCluster_containerAttachedClusterFullExample[Debug log]
TestAccContainerAttachedCluster_update[Debug log]

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccTpuV2Vm_update[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

@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.

Terraform GA: Diff ( 1 file changed, 218 insertions(+))
Terraform Beta: Diff ( 4 files changed, 1263 insertions(+), 32 deletions(-))
TF Conversion: Diff ( 1 file changed, 268 insertions(+))
TF OiCS: Diff ( 1 file changed, 52 insertions(+))

Missing test report

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

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

resource "google_tpu_v2_vm" "primary" {
  scheduling_config {
    reserved = # value needed
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3164
Passed tests 2840
Skipped tests: 318
Affected tests: 6

Action taken

Found 6 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccContainerNodePool_fastSocket|TestAccContainerNodePool_012_ConfigModeAttr|TestAccDataSourceGoogleServiceAccountJwt|TestAccDataSourceGoogleServiceAccountAccessToken_basic|TestAccTpuV2Vm_update|TestAccWorkstationsWorkstationConfig_workstationConfigAcceleratorsExample

Get to know how VCR tests work

@roaks3 roaks3 requested review from zeleena and rileykarson October 19, 2023 19:13
@roaks3
Copy link
Contributor Author

roaks3 commented Oct 19, 2023

I've added you both for initial review since this should be done (except for the additional fields I will be trying to add), and tests have passed locally, but it is just taking a very long time to get the VCR tests in a happy place.

I already have a change queued up to attempt adding the networking fields as well, just waiting on VCR to complete to do that.

@rileykarson I added you since I know you have context but feel free to re-assign.

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccContainerNodePool_012_ConfigModeAttr[Debug log]
TestAccDataSourceGoogleServiceAccountAccessToken_basic[Debug log]
TestAccTpuV2Vm_update[Debug log]
TestAccWorkstationsWorkstationConfig_workstationConfigAcceleratorsExample[Debug log]

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccContainerNodePool_fastSocket[Error message] [Debug log]
TestAccDataSourceGoogleServiceAccountJwt[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

@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.

Terraform GA: Diff ( 1 file changed, 257 insertions(+))
Terraform Beta: Diff ( 4 files changed, 1410 insertions(+), 32 deletions(-))
TF Conversion: Diff ( 1 file changed, 300 insertions(+))
TF OiCS: Diff ( 1 file changed, 72 insertions(+))

Missing test report

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

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

resource "google_tpu_v2_vm" "primary" {
  scheduling_config {
    reserved = # value needed
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3163
Passed tests 2841
Skipped tests: 317
Affected tests: 5

Action taken

Found 5 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccContainerNodePool_012_ConfigModeAttr|TestAccProjectIamPolicy_invalidMembers|TestAccTpuV2Vm_tpuV2VmFullExample|TestAccTpuV2Vm_update|TestAccWorkstationsWorkstationConfig_workstationConfigAcceleratorsExample

Get to know how VCR tests work

Copy link
Member

@rileykarson rileykarson left a comment

Choose a reason for hiding this comment

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

Partial pass, I'm still working through updatable fields.

mmv1/products/tpuv2/Vm.yaml Show resolved Hide resolved
mmv1/products/tpuv2/Vm.yaml Show resolved Hide resolved
mmv1/products/tpuv2/Vm.yaml Show resolved Hide resolved
mmv1/products/tpuv2/Vm.yaml Show resolved Hide resolved
mmv1/products/tpuv2/Vm.yaml Show resolved Hide resolved
Copy link
Member

@rileykarson rileykarson left a comment

Choose a reason for hiding this comment

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

OK, pass done- was shorter to finish than I expected.

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccContainerNodePool_012_ConfigModeAttr[Debug log]
TestAccProjectIamPolicy_invalidMembers[Debug log]
TestAccTpuV2Vm_tpuV2VmFullExample[Debug log]
TestAccTpuV2Vm_update[Debug log]
TestAccWorkstationsWorkstationConfig_workstationConfigAcceleratorsExample[Debug log]

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$
View the build log or the debug log for each test

@roaks3
Copy link
Contributor Author

roaks3 commented Oct 19, 2023

Oh good, it looks like the firewall issue I was seeing was specific to my local environment 🎉

Copy link
Member

@rileykarson rileykarson left a comment

Choose a reason for hiding this comment

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

LGTM, nothing blocking left on my end- it'd be nice to test updating a disk mode too, but as you mentioned that wasn't succeeding for API business logic reasons.

mmv1/products/tpuv2/Vm.yaml Show resolved Hide resolved
@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.

Terraform GA: Diff ( 1 file changed, 258 insertions(+))
Terraform Beta: Diff ( 4 files changed, 1399 insertions(+), 32 deletions(-))
TF Conversion: Diff ( 1 file changed, 302 insertions(+))
TF OiCS: Diff ( 1 file changed, 72 insertions(+))

Missing test report

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

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

resource "google_tpu_v2_vm" "primary" {
  scheduling_config {
    reserved = # value needed
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3163
Passed tests 2844
Skipped tests: 317
Affected tests: 2

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
TestAccBigQueryDataTable_bigtable|TestAccTpuV2Vm_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccBigQueryDataTable_bigtable[Debug log]
TestAccTpuV2Vm_update[Debug log]

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$
View the build log or the debug log for each test

item_type: Api::Type::String
- !ruby/object:Api::Type::String
name: 'state'
output: true
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that output is true here, but does that mean it is output only? Want to check that it cannot be set in the .tf file. Also, are the output-only fields typically defined here in the resource yaml?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, output: true is our equivalent to output-only; it cannot be set by the user. And yea, this is where we specify that for mmv1 resources.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. It didn't seem required to state the outputs when I tested it and I didn't see this in some of the other resource files I checked. This seems fine, just curious if this is the preferred method since I'm not sure if I saw any difference when output fields were omitted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, you won't typically see a difference in output fields when testing, but we include them to better support users. They can feed outputs into other config or automation they may be using.

tags = ["foo"]

lifecycle {
prevent_destroy = true
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we want prevent_destroy to be true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is sort of a trick I've seen used a few times that might be adopted more. The point of this type of test is to create the resource, update it in-place, and then destroy it. However, by default the "update in-place" requirement is not enforced, so changing an immutable field will still pass, and since that will recreate the resource, you can no longer tell if any of the fields are appropriately configured in terms of mutability.

So the workaround you see here ensures that Terraform will error if the resource needs to be recreated, so you know that only in-place updates are taking place if the test passes. Then, in order to clean up after the test is done, we need to set prevent_destroy = false, and then finally delete the resource.

Copy link
Member

Choose a reason for hiding this comment

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

Longer term we'll be able to use hashicorp/terraform-plugin-testing#61 to assert properties of the test plan

@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.

Terraform GA: Diff ( 1 file changed, 262 insertions(+))
Terraform Beta: Diff ( 4 files changed, 1407 insertions(+), 32 deletions(-))
TF Conversion: Diff ( 1 file changed, 302 insertions(+))
TF OiCS: Diff ( 1 file changed, 72 insertions(+))

Missing test report

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

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

resource "google_tpu_v2_vm" "primary" {
  scheduling_config {
    reserved = # value needed
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3164
Passed tests 2845
Skipped tests: 317
Affected tests: 2

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
TestAccSpannerInstanceIamPolicy|TestAccTpuV2Vm_tpuV2VmFullExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccSpannerInstanceIamPolicy[Debug log]
TestAccTpuV2Vm_tpuV2VmFullExample[Debug log]

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$
View the build log or the debug log for each test

@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.

Terraform GA: Diff ( 1 file changed, 262 insertions(+))
Terraform Beta: Diff ( 4 files changed, 1407 insertions(+), 32 deletions(-))
TF Conversion: Diff ( 1 file changed, 302 insertions(+))
TF OiCS: Diff ( 1 file changed, 72 insertions(+))

Missing test report

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

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

resource "google_tpu_v2_vm" "primary" {
  scheduling_config {
    reserved = # value needed
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3170
Passed tests 2849
Skipped tests: 320
Affected tests: 1

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
TestAccTpuV2Vm_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccTpuV2Vm_update[Debug log]

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$
View the build log or the debug log for each test

@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.

Terraform GA: Diff ( 1 file changed, 272 insertions(+))
Terraform Beta: Diff ( 4 files changed, 1575 insertions(+), 74 deletions(-))
TF Conversion: Diff ( 1 file changed, 302 insertions(+))
TF OiCS: Diff ( 1 file changed, 72 insertions(+))

Missing test report

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

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

resource "google_tpu_v2_vm" "primary" {
  scheduling_config {
    reserved = # value needed
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 3170
Passed tests 2850
Skipped tests: 320
Affected tests: 0

$\textcolor{green}{\textsf{All tests passed in REPLAYING mode.}}$
View the build log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants