apigee: populate sharedflow_deployment fields in Read#17442
apigee: populate sharedflow_deployment fields in Read#17442mattaldenshaw wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
Conversation
The Read function for google_apigee_sharedflow_deployment fetched the deployment from the API but never copied the response into Terraform state. As a result service_account always read back as null, and because service_account is ForceNew this caused destructive resource replacement after terraform import whenever the user's HCL declared a non-empty service_account that matched what was actually deployed. Populate environment, sharedflow_id (from the apiProxy response field), revision, and service_account in state from the GET response. Also strip the projects/-/serviceAccounts/ prefix that the API may return on serviceAccount, so a Read after a Create using the bare-email form that the schema documents shows no drift. Update the existing acceptance test to declare a service_account on the deployment so the existing ImportStateVerify steps now exercise the field; previously they did not because no service_account was set. Fixes hashicorp/terraform-provider-google#25332
|
Googlers: For automatic test runs see go/terraform-auto-test-runs. @zli82016, 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 for commit 270c1dc: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode 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 tests
View the build log Step 2: Recording Mode
Caution Issues requiring attention before PR completion 🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details. Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer. View the build log or the debug logs folder for detailed results. @mattaldenshaw, @zli82016 VCR tests complete for 270c1dc! |
Summary
The Read function for
google_apigee_sharedflow_deploymentfetched the deployment from the API but never copied the response into Terraform state. As a resultservice_accountalways read back as null, and becauseservice_accountisForceNewthis caused destructive resource replacement afterterraform importwhenever the user's HCL declared a non-emptyservice_accountmatching what was actually deployed.This PR populates
environment,sharedflow_id(from theapiProxyresponse field, since the API usesapiProxyfor both API proxy and shared flow deployments),revision, andservice_accountin state from the GET response.It also strips the
projects/-/serviceAccounts/prefix that the API may return onserviceAccount, so a Read after a Create using the bare-email form (which the schema documents andCreateaccepts) shows no drift.The existing acceptance test now sets a
service_accounton the deployment so the existingImportStateVerifystep actually exercises the field; previously it did not because noservice_accountwas set.org_idis intentionally not re-set in Read because the API does not return it; it remains in state from the resource ID (which is set by Create or by the import parser).Fixes hashicorp/terraform-provider-google#25332
Release Note