magic-modules
magic-modules copied to clipboard
Add `region_from_id` and `zone_from_id` provider-defined functions
This PR adds support for 2 new provider-defined functions:
- region_from_id
- zone_from_id
There are unit and acceptance tests for both of these, and documentation
Note about testing
Currently, testing this PR requires downloading an alpha release of TF 1.8.0 and running the acceptance test locally. The unit tests should work fine because they don't use a TF binary like acc tests do, and the dependencies on this branch include provider function support.
Release Note Template for Downstream PRs (will be copied)
provider: added provider-defined function `region_from_id` for retrieving the region from a resource's self link or id
provider: added provider-defined function `zone_from_id` for retrieving the zone from a resource's self link or id
/gcbrun
Update: I'm in the process of adding the ability to test this via TeamCity here: https://github.com/GoogleCloudPlatform/magic-modules/pull/10088
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 ( 9 files changed, 696 insertions(+), 1 deletion(-)) Terraform Beta: Diff ( 9 files changed, 696 insertions(+), 1 deletion(-))
Tests analytics
Total tests: 3466
Passed tests: 3061
Skipped tests: 350
Affected tests: 55
Click here to see the affected service packages
all service packages are affected
Action taken
Found 55 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccAppEngineApplicationUrlDispatchRules_appEngineApplicationUrlDispatchRulesBasicExample|TestAccAppEngineServiceNetworkSettings_appEngineServiceNetworkSettingsExample|TestAccAppEngineServiceNetworkSettings_update|TestAccAppEngineServiceSplitTraffic_appEngineServiceSplitTrafficExample|TestAccAppEngineStandardAppVersion_appEngineStandardAppVersionExample|TestAccCloudFunctionsFunction_basic|TestAccCloudFunctionsFunction_buildworkerpool|TestAccCloudFunctionsFunction_update|TestAccComposerEnvironmentComposer3_basic|TestAccComposerEnvironmentComposer3_update|TestAccComposerEnvironmentComposer3_updateFromEmpty|TestAccComposerEnvironmentComposer3_updateToEmpty|TestAccComputeBackendService_regionNegBackend|TestAccComputeRegionNetworkEndpointGroup_negWithServerlessDeployment|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupAppengineExample|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupCloudrunExample|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupFunctionsExample|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupInternetFqdnPortExample|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupInternetIpPortExample|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupPscExample|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupPscServiceAttachmentExample|TestAccComputeRegionNetworkEndpoint_regionNetworkEndpointInternetFqdnPortExample|TestAccComputeRegionNetworkEndpoint_regionNetworkEndpointInternetIpPortExample|TestAccComputeRegionTargetTcpProxy_update|TestAccContainerCluster_withGatewayApiConfig|TestAccDataSourceRegionNetworkEndpointGroup_basic|TestAccDefaultUniverseDomain_doesNotMatchExplicit|TestAccGKEHub2ScopeIamBindingGenerated|TestAccGKEHub2ScopeIamMemberGenerated|TestAccGKEHub2ScopeIamPolicyGenerated|TestAccGKEHub2Scope_gkehubScopeBasicExample|TestAccGKEHub2Scope_gkehubScopeBasicExample_update|TestAccGkeonpremVmwareCluster_gkeonpremVmwareClusterF5lbExample|TestAccIapAppEngineServiceIamBindingGenerated|TestAccIapAppEngineServiceIamBindingGenerated_withCondition|TestAccIapAppEngineServiceIamMemberGenerated|TestAccIapAppEngineServiceIamMemberGenerated_withCondition|TestAccIapAppEngineServiceIamPolicyGenerated|TestAccIapAppEngineServiceIamPolicyGenerated_withCondition|TestAccIapAppEngineVersionIamBindingGenerated|TestAccIapAppEngineVersionIamBindingGenerated_withCondition|TestAccIapAppEngineVersionIamMemberGenerated|TestAccIapAppEngineVersionIamMemberGenerated_withCondition|TestAccIapAppEngineVersionIamPolicyGenerated|TestAccIapAppEngineVersionIamPolicyGenerated_withCondition|TestAccInstanceGroupManager_update|TestAccInstanceGroupManager_waitForStatus|TestAccNotebooksRuntime_update|TestAccProviderFunction_location_from_id|TestAccProviderFunction_project_from_id|TestAccProviderFunction_region_from_id|TestAccProviderFunction_zone_from_id|TestAccRegionInstanceGroupManager_update|TestAccSecurityposturePosture_securityposturePostureBasicExample|TestAccStorageBucket_lifecycleRulesNoAge
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 ( 9 files changed, 696 insertions(+), 1 deletion(-)) Terraform Beta: Diff ( 9 files changed, 696 insertions(+), 1 deletion(-))
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 ( 9 files changed, 695 insertions(+), 1 deletion(-)) Terraform Beta: Diff ( 9 files changed, 695 insertions(+), 1 deletion(-))
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 ( 11 files changed, 703 insertions(+), 1 deletion(-)) Terraform Beta: Diff ( 11 files changed, 703 insertions(+), 1 deletion(-))
Using the diff from the latest report I've triggered tests in TeamCity here : https://hashicorp.teamcity.com/buildConfiguration/TerraformProviders_GoogleCloud_FEATUREBRANCHPROVIDERFUNCTIONS_MM_GA_GOOGLE_PACKAGE_FUNCTIONS/115271?mode=builds&buildTab=overview&hideTestsFromDependencies=false&hideProblemsFromDependencies=false
Tests analytics
Total tests: 3466
Passed tests: 3059
Skipped tests: 354
Affected tests: 53
Click here to see the affected service packages
all service packages are affected
Action taken
Found 53 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccAppEngineApplicationUrlDispatchRules_appEngineApplicationUrlDispatchRulesBasicExample|TestAccAppEngineServiceNetworkSettings_appEngineServiceNetworkSettingsExample|TestAccAppEngineServiceNetworkSettings_update|TestAccAppEngineServiceSplitTraffic_appEngineServiceSplitTrafficExample|TestAccAppEngineStandardAppVersion_appEngineStandardAppVersionExample|TestAccCloudFunctionsFunction_basic|TestAccCloudFunctionsFunction_buildworkerpool|TestAccCloudFunctionsFunction_update|TestAccComposerEnvironmentComposer3_basic|TestAccComposerEnvironmentComposer3_update|TestAccComposerEnvironmentComposer3_updateFromEmpty|TestAccComposerEnvironmentComposer3_updateToEmpty|TestAccComputeBackendService_regionNegBackend|TestAccComputeRegionNetworkEndpointGroup_negWithServerlessDeployment|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupAppengineExample|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupCloudrunExample|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupFunctionsExample|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupInternetFqdnPortExample|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupInternetIpPortExample|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupPscExample|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupPscServiceAttachmentExample|TestAccComputeRegionNetworkEndpoint_regionNetworkEndpointInternetFqdnPortExample|TestAccComputeRegionNetworkEndpoint_regionNetworkEndpointInternetIpPortExample|TestAccComputeRegionPerInstanceConfig_removeInstanceOnDestroy|TestAccComputeRegionTargetTcpProxy_update|TestAccContainerCluster_withGatewayApiConfig|TestAccDataSourceRegionNetworkEndpointGroup_basic|TestAccDataprocJobIamPolicy|TestAccDefaultUniverseDomain_doesNotMatchExplicit|TestAccGKEHub2ScopeIamBindingGenerated|TestAccGKEHub2ScopeIamMemberGenerated|TestAccGKEHub2ScopeIamPolicyGenerated|TestAccGKEHub2Scope_gkehubScopeBasicExample|TestAccGKEHub2Scope_gkehubScopeBasicExample_update|TestAccGkeonpremVmwareCluster_gkeonpremVmwareClusterF5lbExample|TestAccIapAppEngineServiceIamBindingGenerated|TestAccIapAppEngineServiceIamBindingGenerated_withCondition|TestAccIapAppEngineServiceIamMemberGenerated|TestAccIapAppEngineServiceIamMemberGenerated_withCondition|TestAccIapAppEngineServiceIamPolicyGenerated|TestAccIapAppEngineServiceIamPolicyGenerated_withCondition|TestAccIapAppEngineVersionIamBindingGenerated|TestAccIapAppEngineVersionIamBindingGenerated_withCondition|TestAccIapAppEngineVersionIamMemberGenerated|TestAccIapAppEngineVersionIamMemberGenerated_withCondition|TestAccIapAppEngineVersionIamPolicyGenerated|TestAccIapAppEngineVersionIamPolicyGenerated_withCondition|TestAccInstanceGroupManager_update|TestAccInstanceGroupManager_waitForStatus|TestAccNotebooksRuntime_update|TestAccRegionInstanceGroupManager_update|TestAccSecurityposturePosture_securityposturePostureBasicExample|TestAccStorageBucket_lifecycleRulesNoAge
$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccCloudFunctionsFunction_basic
[Debug log]
TestAccCloudFunctionsFunction_buildworkerpool
[Debug log]
TestAccCloudFunctionsFunction_update
[Debug log]
TestAccComposerEnvironmentComposer3_basic
[Debug log]
TestAccComposerEnvironmentComposer3_update
[Debug log]
TestAccComposerEnvironmentComposer3_updateFromEmpty
[Debug log]
TestAccComposerEnvironmentComposer3_updateFromEmpty
[Debug log]
TestAccComposerEnvironmentComposer3_updateToEmpty
[Debug log]
TestAccComposerEnvironmentComposer3_updateToEmpty
[Debug log]
TestAccComputeBackendService_regionNegBackend
[Debug log]
TestAccComputeRegionNetworkEndpointGroup_negWithServerlessDeployment
[Debug log]
TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupCloudrunExample
[Debug log]
TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupFunctionsExample
[Debug log]
TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupInternetFqdnPortExample
[Debug log]
TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupInternetIpPortExample
[Debug log]
TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupPscExample
[Debug log]
TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupPscServiceAttachmentExample
[Debug log]
TestAccComputeRegionNetworkEndpoint_regionNetworkEndpointInternetFqdnPortExample
[Debug log]
TestAccComputeRegionNetworkEndpoint_regionNetworkEndpointInternetIpPortExample
[Debug log]
TestAccComputeRegionPerInstanceConfig_removeInstanceOnDestroy
[Debug log]
TestAccComputeRegionTargetTcpProxy_update
[Debug log]
TestAccDataSourceRegionNetworkEndpointGroup_basic
[Debug log]
TestAccDataprocJobIamPolicy
[Debug log]
TestAccGKEHub2ScopeIamBindingGenerated
[Debug log]
TestAccGKEHub2ScopeIamMemberGenerated
[Debug log]
TestAccGKEHub2ScopeIamPolicyGenerated
[Debug log]
TestAccGKEHub2Scope_gkehubScopeBasicExample
[Debug log]
TestAccGKEHub2Scope_gkehubScopeBasicExample_update
[Debug log]
TestAccGKEHub2Scope_gkehubScopeBasicExample_update
[Debug log]
TestAccGkeonpremVmwareCluster_gkeonpremVmwareClusterF5lbExample
[Debug log]
TestAccInstanceGroupManager_update
[Debug log]
TestAccInstanceGroupManager_waitForStatus
[Debug log]
TestAccNotebooksRuntime_update
[Debug log]
TestAccRegionInstanceGroupManager_update
[Debug log]
TestAccSecurityposturePosture_securityposturePostureBasicExample
[Debug log]
TestAccStorageBucket_lifecycleRulesNoAge
[Debug log]
$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$
$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccAppEngineApplicationUrlDispatchRules_appEngineApplicationUrlDispatchRulesBasicExample
[Error message] [Debug log]
TestAccAppEngineServiceNetworkSettings_appEngineServiceNetworkSettingsExample
[Error message] [Debug log]
TestAccAppEngineServiceNetworkSettings_update
[Error message] [Debug log]
TestAccAppEngineServiceSplitTraffic_appEngineServiceSplitTrafficExample
[Error message] [Debug log]
TestAccAppEngineStandardAppVersion_appEngineStandardAppVersionExample
[Error message] [Debug log]
TestAccContainerCluster_withGatewayApiConfig
[Error message] [Debug log]
TestAccDefaultUniverseDomain_doesNotMatchExplicit
[Error message] [Debug log]
TestAccIapAppEngineServiceIamBindingGenerated
[Error message] [Debug log]
TestAccIapAppEngineServiceIamBindingGenerated_withCondition
[Error message] [Debug log]
TestAccIapAppEngineServiceIamBindingGenerated_withCondition
[Error message] [Debug log]
TestAccIapAppEngineServiceIamMemberGenerated
[Error message] [Debug log]
TestAccIapAppEngineServiceIamMemberGenerated_withCondition
[Error message] [Debug log]
TestAccIapAppEngineServiceIamMemberGenerated_withCondition
[Error message] [Debug log]
TestAccIapAppEngineServiceIamPolicyGenerated
[Error message] [Debug log]
TestAccIapAppEngineServiceIamPolicyGenerated_withCondition
[Error message] [Debug log]
TestAccIapAppEngineServiceIamPolicyGenerated_withCondition
[Error message] [Debug log]
TestAccIapAppEngineVersionIamBindingGenerated
[Error message] [Debug log]
TestAccIapAppEngineVersionIamBindingGenerated_withCondition
[Error message] [Debug log]
TestAccIapAppEngineVersionIamBindingGenerated_withCondition
[Error message] [Debug log]
TestAccIapAppEngineVersionIamMemberGenerated
[Error message] [Debug log]
TestAccIapAppEngineVersionIamMemberGenerated_withCondition
[Error message] [Debug log]
TestAccIapAppEngineVersionIamMemberGenerated_withCondition
[Error message] [Debug log]
TestAccIapAppEngineVersionIamPolicyGenerated
[Error message] [Debug log]
TestAccIapAppEngineVersionIamPolicyGenerated_withCondition
[Error message] [Debug log]
TestAccIapAppEngineVersionIamPolicyGenerated_withCondition
[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
rebased to include the the latest synced commits on the feature branch that came from main - that should address the test failures above
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 ( 11 files changed, 702 insertions(+)) Terraform Beta: Diff ( 11 files changed, 702 insertions(+))
Tests analytics
Total tests: 3501
Passed tests: 3111
Skipped tests: 358
Affected tests: 32
Click here to see the affected service packages
all service packages are affected
Action taken
Found 32 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccCloudFunctionsFunction_basic|TestAccCloudFunctionsFunction_buildworkerpool|TestAccCloudFunctionsFunction_update|TestAccComposerEnvironmentComposer3_basic|TestAccComposerEnvironmentComposer3_update|TestAccComposerEnvironmentComposer3_updateFromEmpty|TestAccComposerEnvironmentComposer3_updateToEmpty|TestAccComputeBackendService_regionNegBackend|TestAccComputeRegionNetworkEndpointGroup_negWithServerlessDeployment|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupCloudrunExample|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupFunctionsExample|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupInternetFqdnPortExample|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupInternetIpPortExample|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupPscExample|TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupPscServiceAttachmentExample|TestAccComputeRegionNetworkEndpoint_regionNetworkEndpointInternetFqdnPortExample|TestAccComputeRegionNetworkEndpoint_regionNetworkEndpointInternetIpPortExample|TestAccComputeRegionTargetTcpProxy_update|TestAccDataSourceRegionNetworkEndpointGroup_basic|TestAccDataprocClusterIamPolicy|TestAccGKEHub2ScopeIamBindingGenerated|TestAccGKEHub2ScopeIamMemberGenerated|TestAccGKEHub2ScopeIamPolicyGenerated|TestAccGKEHub2Scope_gkehubScopeBasicExample|TestAccGKEHub2Scope_gkehubScopeBasicExample_update|TestAccGkeonpremVmwareCluster_gkeonpremVmwareClusterF5lbExample|TestAccInstanceGroupManager_update|TestAccInstanceGroupManager_waitForStatus|TestAccNotebooksRuntime_update|TestAccRegionInstanceGroupManager_update|TestAccSecurityposturePosture_securityposturePostureBasicExample|TestAccStorageBucket_lifecycleRulesNoAge
$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccCloudFunctionsFunction_basic
[Debug log]
TestAccCloudFunctionsFunction_buildworkerpool
[Debug log]
TestAccCloudFunctionsFunction_update
[Debug log]
TestAccComposerEnvironmentComposer3_basic
[Debug log]
TestAccComposerEnvironmentComposer3_update
[Debug log]
TestAccComposerEnvironmentComposer3_updateFromEmpty
[Debug log]
TestAccComposerEnvironmentComposer3_updateToEmpty
[Debug log]
TestAccComputeBackendService_regionNegBackend
[Debug log]
TestAccComputeRegionNetworkEndpointGroup_negWithServerlessDeployment
[Debug log]
TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupCloudrunExample
[Debug log]
TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupFunctionsExample
[Debug log]
TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupInternetFqdnPortExample
[Debug log]
TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupInternetIpPortExample
[Debug log]
TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupPscExample
[Debug log]
TestAccComputeRegionNetworkEndpointGroup_regionNetworkEndpointGroupPscServiceAttachmentExample
[Debug log]
TestAccComputeRegionNetworkEndpoint_regionNetworkEndpointInternetFqdnPortExample
[Debug log]
TestAccComputeRegionNetworkEndpoint_regionNetworkEndpointInternetIpPortExample
[Debug log]
TestAccComputeRegionTargetTcpProxy_update
[Debug log]
TestAccDataSourceRegionNetworkEndpointGroup_basic
[Debug log]
TestAccDataprocClusterIamPolicy
[Debug log]
TestAccGKEHub2ScopeIamBindingGenerated
[Debug log]
TestAccGKEHub2ScopeIamMemberGenerated
[Debug log]
TestAccGKEHub2ScopeIamPolicyGenerated
[Debug log]
TestAccGKEHub2Scope_gkehubScopeBasicExample
[Debug log]
TestAccGKEHub2Scope_gkehubScopeBasicExample_update
[Debug log]
TestAccGkeonpremVmwareCluster_gkeonpremVmwareClusterF5lbExample
[Debug log]
TestAccInstanceGroupManager_update
[Debug log]
TestAccInstanceGroupManager_waitForStatus
[Debug log]
TestAccNotebooksRuntime_update
[Debug log]
TestAccRegionInstanceGroupManager_update
[Debug log]
TestAccSecurityposturePosture_securityposturePostureBasicExample
[Debug log]
TestAccStorageBucket_lifecycleRulesNoAge
[Debug log]
$\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
let me know when this is out of draft and ready for review
@c2thorn - sorry for the notification spam this PR must have given you. This is now ready for review :) - the unrelated test failures are now resolved by syncing in commits from main.
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 ( 9 files changed, 672 insertions(+)) Terraform Beta: Diff ( 9 files changed, 672 insertions(+))
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 ( 9 files changed, 702 insertions(+)) Terraform Beta: Diff ( 9 files changed, 702 insertions(+))
Tests analytics
Total tests: 3502
Passed tests: 3143
Skipped tests: 359
Affected tests: 0
Click here to see the affected service packages
all service packages are affected
$\textcolor{green}{\textsf{All tests passed!}}$ View the build log
Thanks! Merging now, & I'll do the mentioned refactoring once all functions are on the feature branch