Skip to content

apigee: populate sharedflow_deployment fields in Read#17442

Open
mattaldenshaw wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
mattaldenshaw:fix-b466423810-apigee-sa-read
Open

apigee: populate sharedflow_deployment fields in Read#17442
mattaldenshaw wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
mattaldenshaw:fix-b466423810-apigee-sa-read

Conversation

@mattaldenshaw
Copy link
Copy Markdown

Summary

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 matching what was actually deployed.

This PR populates environment, sharedflow_id (from the apiProxy response field, since the API uses apiProxy for both API proxy and shared flow deployments), revision, and service_account in state from the GET response.

It also strips the projects/-/serviceAccounts/ prefix that the API may return on serviceAccount, so a Read after a Create using the bare-email form (which the schema documents and Create accepts) shows no drift.

The existing acceptance test now sets a service_account on the deployment so the existing ImportStateVerify step actually exercises the field; previously it did not because no service_account was set.

org_id is 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

apigee: fixed `google_apigee_sharedflow_deployment.service_account` always reading as null, which caused forced replacement on import

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
@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label May 6, 2026
@github-actions github-actions Bot requested a review from zli82016 May 6, 2026 19:34
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

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.

@modular-magician modular-magician added service/apigee and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels May 7, 2026
@modular-magician
Copy link
Copy Markdown
Collaborator

modular-magician commented May 7, 2026

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 270c1dc:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 2 files changed, 42 insertions(+), 5 deletions(-)
google-beta provider View Diff 2 files changed, 42 insertions(+), 5 deletions(-)

Test report

Analytics

Total Tests Passed Skipped Affected
75 35 38 2
Affected Service Packages
  • apigee

Learn how VCR tests work


Step 1: Replaying Mode

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
  • TestAccApigeeOrganization_apigeeOrganizationCloudBasicDisableVpcPeeringTestExample
  • TestAccApigeeOrganization_apigeeOrganizationCloudFullDisableVpcPeeringTestExample

View the build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
❌ Error · Log - TestAccApigeeOrganization_apigeeOrganizationCloudBasicDisableVpcPeeringTestExample
❌ Error · Log - TestAccApigeeOrganization_apigeeOrganizationCloudFullDisableVpcPeeringTestExample

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

resource google_apigee_sharedflow_deployment attribute service_account value always returns null

2 participants