-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 source_workstation in workstations_workstation resource. #12549
Conversation
Hello! I am a robot. Tests will require approval from a repository maintainer to run. @ScottSuarez, 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. |
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.
Missing test reportYour PR includes resource fields which are not covered by any test. Resource: resource "google_workstations_workstation" "primary" {
source_workstation = # value needed
}
|
Tests analyticsTotal tests: 37 Click here to see the affected service packages
🟢 All tests passed! View the build log |
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.
Can you add tests for this field? Potentially an update and create test.
You can extend existing ones where appropriate
It's difficult to write a create test for this field because it requires a manual human interaction on a dependency resource. A create test would have to:
Is it possible to send GCP API calls without Terraform during a create test? Open to suggestions on how to implement this. |
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.
You can do a two step test where you first create a workstation. Then you add another workstation which depends on the previous in that config.
So your config would look something like
{
Config: testAccWorkstationsWorkstation_initialWorkStation(context),
},
{
// import verify
}
{
Config: testAccWorkstationsWorkstation_initialWorkStationWithSecondaryReference(context),
},
{
// import verify
}
I am not sure we can do that -- the initial workstation can be created using Terraform, but it's created in a In your example, creating a secondary workstation using |
@ScottSuarez This PR has been waiting for review for 3 weekdays. Please take a look! Use the label |
Ah! I see! Thanks for that clarification! Let me try and test it locally. |
tested locally |
This adds support for workstation PD cloning using
source_workstation
. It can only be set during workstation resource creation and cannot be updated afterwards: https://cloud.google.com/workstations/docs/reference/rest/v1beta/projects.locations.workstationClusters.workstationConfigs.workstations#Workstation.FIELDS.source_workstationThe primary use case of this field is for recovery, so it doesn't seem possible to write an automated test for it. This is because a workstation must be started manually before it can be cloned, else its PD is not created. If there is a way to write a test that can send API calls outside of Terraform, please let me know.
Fixes hashicorp/terraform-provider-google#19730.
Release Note Template for Downstream PRs (will be copied)
See Write release notes for guidance.