-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat(vertexai): Support google_vertex_ai_deployment_resource_pool #9518
feat(vertexai): Support google_vertex_ai_deployment_resource_pool #9518
Conversation
Hello! I am a robot. It looks like you are a: Community Contributor @rileykarson, 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. |
# Skip the import test because deployment_resource_pool_id can't be specified in an auto-generated test | ||
skip_import_test: true |
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.
[QUESTION] Should I add a manually written test for importing a resource by specifying ImportId:
?
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.
Ah, the import format we're creating is wrong- it assumes that /{{name}}
is appended to the base_url
. If we add an identity
entry similar to
magic-modules/mmv1/products/storage/BucketAccessControl.yaml
Lines 42 to 43 in ce2d84b
identity: | |
- entity |
For this resource that value'll be deploymentResourcePoolId
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.
Thank you for your comment! I updated the code to use name
as identifier along with the custom encoder in 99bb911. So skip_import_test
and identity
became unnecessary in the end.
# Deal with deploymentResourcePool as a flatten object because GET returns DeploymentResourcePool | ||
flatten_object: true |
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.
[MEMO] The get
returns DeploymentResourcePool
, but create
requires a wrapper of DeploymentResourcePool
.
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.
Instead of flatten_object
can we use an encoder
? Very similar to something like https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/templates/terraform/encoders/wrap_object_with_template_id.go.erb
(We likely need to remove deploymentResourcePoolId
from obj
and reinsert it to obj
, I think that that encoder's resourceId
field was url_param_only
)
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.
Thank you for your feedback. I updated the code to use the custom encoder in 99bb911.
@rileykarson Hello 👋 Could you approve the cloud build jobs to run acceptance tests? |
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 5 files changed, 1146 insertions(+), 2 deletions(-)) |
Tests analyticsTotal tests: Action takenFound 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected testsTestAccHealthcareDatasetIamPolicy|TestAccVertexAIDeploymentResourcePool_vertexAiDeploymentResourcePoolExample |
Rerun these tests in REPLAYING mode to catch issues
|
# Skip the import test because deployment_resource_pool_id can't be specified in an auto-generated test | ||
skip_import_test: true |
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.
Ah, the import format we're creating is wrong- it assumes that /{{name}}
is appended to the base_url
. If we add an identity
entry similar to
magic-modules/mmv1/products/storage/BucketAccessControl.yaml
Lines 42 to 43 in ce2d84b
identity: | |
- entity |
For this resource that value'll be deploymentResourcePoolId
# Deal with deploymentResourcePool as a flatten object because GET returns DeploymentResourcePool | ||
flatten_object: true |
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.
Instead of flatten_object
can we use an encoder
? Very similar to something like https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/templates/terraform/encoders/wrap_object_with_template_id.go.erb
(We likely need to remove deploymentResourcePoolId
from obj
and reinsert it to obj
, I think that that encoder's resourceId
field was url_param_only
)
@@ -0,0 +1,19 @@ | |||
resource "google_vertex_ai_deployment_resource_pool" "<%= ctx[:primary_resource_id] %>" { | |||
region = "us-central1" | |||
deployment_resource_pool_id = "sample-deployment-resource-pool" |
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.
We'll want to define vars
and supply the name through that- that will ensure that we add a random suffix and a sweeper prefix to test resources so that we don't leak resources or fail tests due to leaked resources.
Docs: https://googlecloudplatform.github.io/magic-modules/develop/test/#add-a-create-test
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.
I updated the code to use the random suffix through vars
in 99bb911.
@rileykarson Hello 👋 Sorry for the late response. I updated the code based on your feedback. According to the API doc, all fields are immutable. Therefore, I didn't add a hand-written test for updatable fields. Please let me know if you have a concern. Thanks! |
@rileykarson Happy New Year 👋 When you have time, could you review this PR? Thanks |
@rileykarson Hello 👋 When you have time, could you review this PR? Thanks! |
@rileykarson Hello 👋 If this PR looks good, could you approve the cloud build job? Thanks |
Sorry about the delay! Losing against my email 😅 Running build |
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 5 files changed, 1106 insertions(+), 2 deletions(-)) |
Tests analyticsTotal tests: Click here to see the affected service packages
Action takenFound 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected testsTestAccVertexAIDeploymentResourcePool_vertexAiDeploymentResourcePoolExample |
Rerun these tests in REPLAYING mode to catch issues
|
@rileykarson Hello 👋 When you have time, could you review the code? Please let me know if merging the latest main branch into this development branch is necessary. Thanks! |
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, sorry for the delay!
Fixes hashicorp/terraform-provider-google#16561
Release Note Template for Downstream PRs (will be copied)
I confirmed
TestAccVertexAIDeploymentResourcePool_vertexAiDeploymentResourcePoolExample
succeeded without errors by running the test on a local machine.