diff --git a/.ci/containers/gcb-terraform-vcr-tester/test_terraform_vcr.sh b/.ci/containers/gcb-terraform-vcr-tester/test_terraform_vcr.sh index b62e4c6e9dab..58b5449d51df 100755 --- a/.ci/containers/gcb-terraform-vcr-tester/test_terraform_vcr.sh +++ b/.ci/containers/gcb-terraform-vcr-tester/test_terraform_vcr.sh @@ -98,7 +98,7 @@ while [[ -n $TESTS_TERMINATED ]]; do gsutil -h "Content-Type:text/plain" -q cp replaying_test$test_suffix.log gs://ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/ if [[ $counter -gt 3 ]]; then - comment="Failed to run VCR tests in REPLAYING mode${NEWLINE}" + comment="$\textcolor{red}{\textsf{Failed to run VCR tests in REPLAYING mode}}$ ${NEWLINE}" comment+="View the [build log](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/replaying_test$test_suffix.log)${NEWLINE}" comment+="If you believe the error is unrelated to your PR, please rerun the tests" add_comment "${comment}" @@ -128,8 +128,8 @@ gsutil -h "Content-Type:text/plain" -m -q cp testlog/replaying/* gs://ci-vcr-log TESTS_PANIC=$(grep "^panic: " replaying_test$test_suffix.log) if [[ -n $TESTS_PANIC ]]; then - comment="The provider crashed while running the VCR tests in REPLAYING mode${NEWLINE}" - comment+="Please fix it to complete your PR${NEWLINE}" + comment="$\textcolor{red}{\textsf{The provider crashed while running the VCR tests in REPLAYING mode}}$ ${NEWLINE}" + comment+="$\textcolor{red}{\textsf{Please fix it to complete your PR}}$ ${NEWLINE}" comment+="View the [build log](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/replaying_test$test_suffix.log)" add_comment "${comment}" update_status "failure" @@ -181,7 +181,7 @@ if [[ -n $FAILED_TESTS_PATTERN ]]; then export VCR_MODE=RECORDING FAILED_TESTS=$(grep "^--- FAIL: TestAcc" replaying_test$test_suffix.log | awk '{print $3}') # test_exit_code=0 - parallel --jobs 16 TF_LOG=DEBUG TF_LOG_PATH_MASK=$local_path/testlog/recording/%s.log TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test $GOOGLE_TEST_DIRECTORY -parallel 1 -v -run="{}$" -timeout 240m -ldflags="-X=github.com/hashicorp/terraform-provider-google-beta/version.ProviderVersion=acc" ">" testlog/recording_build/{}_recording_test.log ::: $FAILED_TESTS + parallel --jobs 16 TF_LOG=DEBUG TF_LOG_PATH_MASK=$local_path/testlog/recording/%s.log TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test {1} -parallel 1 -v -run="{2}$" -timeout 240m -ldflags="-X=github.com/hashicorp/terraform-provider-google-beta/version.ProviderVersion=acc" ">>" testlog/recording_build/{2}_recording_test.log ::: $GOOGLE_TEST_DIRECTORY ::: $FAILED_TESTS test_exit_code=$? @@ -208,8 +208,9 @@ if [[ -n $FAILED_TESTS_PATTERN ]]; then RECORDING_TESTS_PANIC=$(grep "^panic: " recording_test.log) if [[ -n $RECORDING_TESTS_PANIC ]]; then - comment="The provider crashed while running the VCR tests in RECORDING mode${NEWLINE}" - comment+="Please fix it to complete your PR${NEWLINE}" + + comment="$\textcolor{red}{\textsf{The provider crashed while running the VCR tests in RECORDING mode}}$ ${NEWLINE}" + comment+="$\textcolor{red}{\textsf{Please fix it to complete your PR}}$ ${NEWLINE}" comment+="View the [build log](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/recording_test.log)" add_comment "${comment}" update_status "failure" @@ -225,16 +226,16 @@ if [[ -n $FAILED_TESTS_PATTERN ]]; then RECORDING_PASSED_TESTS_COUNT=0 RECORDING_FAILED_TESTS_COUNT=0 if [[ -n $RECORDING_PASSED_TESTS ]]; then - comment+="Tests passed during RECORDING mode:${NEWLINE} $RECORDING_PASSED_TESTS ${NEWLINE}${NEWLINE}" + comment+="$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$ ${NEWLINE} $RECORDING_PASSED_TESTS ${NEWLINE}${NEWLINE}" RECORDING_PASSED_TESTS_COUNT=$(echo "$RECORDING_PASSED_TESTS" | wc -l) comment+="##### Rerun these tests in REPLAYING mode to catch issues ${NEWLINE}${NEWLINE}" # Rerun passed tests in REPLAYING mode 3 times to catch issues export VCR_MODE=REPLAYING count=3 - parallel --jobs 16 TF_LOG=DEBUG TF_LOG_PATH_MASK=$local_path/testlog/replaying_after_recording/%s.log TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test $GOOGLE_TEST_DIRECTORY -parallel 1 -count=$count -v -run="{}$" -timeout 120m -ldflags="-X=github.com/hashicorp/terraform-provider-google-beta/version.ProviderVersion=acc" ">" testlog/replaying_build_after_recording/{}_replaying_test.log ::: $RECORDING_PASSED_TEST_LIST + parallel --jobs 16 TF_LOG=DEBUG TF_LOG_PATH_MASK=$local_path/testlog/replaying_after_recording/%s.log TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test {1} -parallel 1 -count=$count -v -run="{2}$" -timeout 120m -ldflags="-X=github.com/hashicorp/terraform-provider-google-beta/version.ProviderVersion=acc" ">>" testlog/replaying_build_after_recording/{2}_replaying_test.log ::: $GOOGLE_TEST_DIRECTORY ::: $RECORDING_PASSED_TEST_LIST - test_exit_code=$? + test_exit_code=$(($test_exit_code || $?)) # Concatenate recording build logs to one file for test in $RECORDING_PASSED_TEST_LIST @@ -250,11 +251,11 @@ if [[ -n $FAILED_TESTS_PATTERN ]]; then REPLAYING_FAILED_TESTS=$(grep "^--- FAIL: TestAcc" replaying_build_after_recording.log | sort -u -t' ' -k3,3 | awk -v pr_number=$pr_number -v build_id=$build_id '{print "`"$3"`[[Error message](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-"pr_number"/artifacts/"build_id"/build-log/replaying_build_after_recording/"$3"_replaying_test.log)] [[Debug log](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-"pr_number"/artifacts/"build_id"/replaying_after_recording/"$3".log)]"}') if [[ -n $REPLAYING_FAILED_TESTS ]]; then - comment+="Tests failed when rerunning REPLAYING mode:${NEWLINE} $REPLAYING_FAILED_TESTS ${NEWLINE}${NEWLINE}" + comment+="$\textcolor{red}{\textsf{Tests failed when rerunning REPLAYING mode:}}$ ${NEWLINE} $REPLAYING_FAILED_TESTS ${NEWLINE}${NEWLINE}" comment+="Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.${NEWLINE}${NEWLINE}" - comment+="Please fix these to complete your PR. If you do not know how VCR tests work, please work with the code reviewer to figure out the reason why the tests failed and fix the tests.${NEWLINE}" + comment+="Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.${NEWLINE}" else - comment+="All tests passed after rerunning REPLAYING mode.${NEWLINE}" + comment+="$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$ ${NEWLINE}" fi comment+="${NEWLINE}---${NEWLINE}" @@ -264,18 +265,20 @@ if [[ -n $FAILED_TESTS_PATTERN ]]; then fi if [[ -n $RECORDING_FAILED_TESTS ]]; then - comment+="Tests failed during RECORDING mode:${NEWLINE} $RECORDING_FAILED_TESTS ${NEWLINE}${NEWLINE}" + comment+="$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$ ${NEWLINE} $RECORDING_FAILED_TESTS ${NEWLINE}${NEWLINE}" RECORDING_FAILED_TESTS_COUNT=$(echo "$RECORDING_FAILED_TESTS" | wc -l) if [[ $RECORDING_PASSED_TESTS_COUNT+$RECORDING_FAILED_TESTS_COUNT -lt $FAILED_TESTS_COUNT ]]; then - comment+="Several tests got terminated during RECORDING mode.${NEWLINE}" + comment+="$\textcolor{red}{\textsf{Several tests got terminated during RECORDING mode.}}$ ${NEWLINE}" fi - comment+="Please fix these to complete your PR${NEWLINE}" + comment+="$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$ ${NEWLINE}" else if [[ $RECORDING_PASSED_TESTS_COUNT+$RECORDING_FAILED_TESTS_COUNT -lt $FAILED_TESTS_COUNT ]]; then - comment+="Several tests got terminated during RECORDING mode.${NEWLINE}" + comment+="$\textcolor{red}{\textsf{Several tests got terminated during RECORDING mode.}}$ ${NEWLINE}" elif [[ $test_exit_code -ne 0 ]]; then # check for any uncaught errors in RECORDING mode - comment+="Errors occurred during RECORDING mode. Please fix them to complete your PR${NEWLINE}" + comment+="$\textcolor{red}{\textsf{Errors occurred during RECORDING mode. Please fix them to complete your PR.}}$ ${NEWLINE}" + else + comment+="$\textcolor{green}{\textsf{All tests passed!}} ${NEWLINE}" fi fi @@ -285,9 +288,9 @@ if [[ -n $FAILED_TESTS_PATTERN ]]; then else if [[ $test_exit_code -ne 0 ]]; then # check for any uncaught errors errors in REPLAYING mode - comment+="Errors occurred during REPLAYING mode. Please fix them to complete your PR${NEWLINE}" + comment+="$\textcolor{red}{\textsf{Errors occurred during REPLAYING mode. Please fix them to complete your PR}}$ ${NEWLINE}" else - comment+="All tests passed in REPLAYING mode${NEWLINE}" + comment+="$\textcolor{green}{\textsf{All tests passed in REPLAYING mode.}}$ ${NEWLINE}" fi comment+="View the [build log](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/replaying_test$test_suffix.log)" add_comment "${comment}" diff --git a/docs/content/contribute/review-pr.md b/docs/content/contribute/review-pr.md new file mode 100644 index 000000000000..01e3b67f40cd --- /dev/null +++ b/docs/content/contribute/review-pr.md @@ -0,0 +1,45 @@ +--- +title: "Review a PR" +weight: 11 +--- + +# Review a PR + +This page provides guidelines for reviewing Magic Modules pull requests + +1. Read the PR description to understand the context and ensure the PR either + * is linked to a GitHub issue or an internal bug + * if not, check the [issue tracker](https://github.com/hashicorp/terraform-provider-google/issues) to see whether the feature has already been requested and add the issues in the description, if any. + * establishes clear context itself via title or description. +2. If the PR adds any new resource, ensure that the resource does not already exists in the [GA provider](https://github.com/hashicorp/terraform-provider-google) or [beta provider](https://github.com/hashicorp/terraform-provider-google-beta) +1. Read through all the changes in the PR, generated code in the downstreams and the API documentation to ensure that: + 1. the resource schema added in the PR matches the API structure. + 1. the features are added in the correct version + * features only available in beta are not included in the GA google provider. + * features added to the GA provider are also included in the beta provider -- beta should be a strict superset of GA. + 1. no [breaking changes]({{< ref "/develop/breaking-changes" >}}) are introduced without a valid justification. + 1. verify the change actually resolves the linked issues, if any. +1. Check the tests added/modified to ensure that: + 1. all fields added/updated in the PR appear in at least one test. + * It is advisable to test updating from a non-zero value to a zero value if feasible. + 1. all mutable fields are tested in at least one update test. + 1. all related tests pass in GA for features promoted from beta to GA. + {{< hint info >}}Note: + Presubmit VCR tests do not run in GA. Manual testing is required for promoted GA features. + {{< /hint >}} + 1. newly added or modified diff suppress functions are tested in at least one unit test. + 1. the linked issue (if any) is covered by at least one test that reproduces the issue + * for example - a bugfix should test the bug (or explain why it's not feasible to do so in the description) and an enhancement should test the new behaviour(s). + 1. all related PR presubmit tests have been completed successfully, including: + * terraform-provider-breaking-change-test + * presubmit-rake-tests + * terraform-provider-google-build-and-unit-tests + * terraform-provider-google-beta-build-and-unit-tests + * VCR-test + {{< hint info >}}Note: + Some acceptance tests may be skipped in VCR and manual testing is required. + {{< /hint >}} +1. Check documentation to ensure + 1. resouce-level and field-level documentation are generated correctly for MMv1-based resource + 1. documentation is added manually for handwritten resources. +1. Check if release notes capture all changes in the PR, and are correctly formatted following the guidance in [write release notes]({{< ref "release-notes" >}}) before merge the PR. \ No newline at end of file diff --git a/docs/content/get-started/generate-providers.md b/docs/content/get-started/generate-providers.md index c1aea1bbf696..1ba881b5958e 100644 --- a/docs/content/get-started/generate-providers.md +++ b/docs/content/get-started/generate-providers.md @@ -128,7 +128,7 @@ If you are familiar with Docker or Podman, you may want to use the experimental 1. Set up application default credentials for Terraform ```bash gcloud auth application-default login - export GOOGLE_USE_DEFAULT_CREDENTIALS=TRUE + export GOOGLE_USE_DEFAULT_CREDENTIALS=true ``` 1. Set required environment variables ```bash diff --git a/mmv1/api/type.rb b/mmv1/api/type.rb index e5f330f5ae2c..2d0900b1fd7d 100644 --- a/mmv1/api/type.rb +++ b/mmv1/api/type.rb @@ -655,7 +655,6 @@ def validate # TODO: (camthornton) product reference may not exist yet return if @__resource.__product.nil? - check_resource_ref_exists check_resource_ref_property_exists end @@ -663,13 +662,11 @@ def property props = resource_ref.all_user_properties .select { |prop| prop.name == @imports } return props.first unless props.empty? - raise "#{@imports} does not exist on #{@resource}" if props.empty? end def resource_ref product = @__resource.__product resources = product.objects.select { |obj| obj.name == @resource } - raise "Unknown item type '#{@resource}'" if resources.empty? resources[0] end @@ -683,13 +680,9 @@ def property_class private - def check_resource_ref_exists - product = @__resource.__product - resources = product.objects.select { |obj| obj.name == @resource } - raise "Missing '#{@resource}'" if resources.empty? - end - def check_resource_ref_property_exists + return unless defined?(resource_ref.all_user_properties) + exported_props = resource_ref.all_user_properties exported_props << Api::Type::String.new('selfLink') \ if resource_ref.has_self_link diff --git a/mmv1/products/bigquery/Dataset.yaml b/mmv1/products/bigquery/Dataset.yaml index 9efd9208c917..7cd95a4eb7f1 100644 --- a/mmv1/products/bigquery/Dataset.yaml +++ b/mmv1/products/bigquery/Dataset.yaml @@ -356,3 +356,12 @@ properties: - 'und:ci': undetermined locale, case insensitive. - '': empty string. Default to case-sensitive behavior. default_from_api: true + - !ruby/object:Api::Type::String + name: 'storageBillingModel' + description: | + Specifies the storage billing model for the dataset. + Set this flag value to LOGICAL to use logical bytes for storage billing, + or to PHYSICAL to use physical bytes instead. + + LOGICAL is the default if this flag isn't specified. + default_from_api: true diff --git a/mmv1/products/compute/Address.yaml b/mmv1/products/compute/Address.yaml index 78f9e431c26f..0aeb95ac33df 100644 --- a/mmv1/products/compute/Address.yaml +++ b/mmv1/products/compute/Address.yaml @@ -106,6 +106,7 @@ parameters: required: false default_from_api: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::String name: 'address' @@ -188,6 +189,7 @@ properties: This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes. default_from_api: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Array name: 'users' description: 'The URLs of the resources that are using this address.' @@ -216,6 +218,7 @@ properties: The URL of the network in which to reserve the address. This field can only be used with INTERNAL type with the VPC_PEERING and IPSEC_INTERCONNECT purposes. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Integer name: prefixLength description: | diff --git a/mmv1/products/compute/Autoscaler.yaml b/mmv1/products/compute/Autoscaler.yaml index 366dcc676ab6..e10212ef636b 100644 --- a/mmv1/products/compute/Autoscaler.yaml +++ b/mmv1/products/compute/Autoscaler.yaml @@ -85,6 +85,7 @@ parameters: required: false immutable: true default_from_api: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Time name: 'creationTimestamp' diff --git a/mmv1/products/compute/BackendBucketSignedUrlKey.yaml b/mmv1/products/compute/BackendBucketSignedUrlKey.yaml index 300535746f31..ac2a7c34d235 100644 --- a/mmv1/products/compute/BackendBucketSignedUrlKey.yaml +++ b/mmv1/products/compute/BackendBucketSignedUrlKey.yaml @@ -75,6 +75,7 @@ parameters: required: true immutable: true ignore_read: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::String name: 'name' diff --git a/mmv1/products/compute/BackendService.yaml b/mmv1/products/compute/BackendService.yaml index cd1daf3e0f5c..ef24870db9bf 100644 --- a/mmv1/products/compute/BackendService.yaml +++ b/mmv1/products/compute/BackendService.yaml @@ -1247,6 +1247,7 @@ properties: connections to backends of a service. This resource itself does not affect configuration unless it is attached to a backend service resource. required: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Array name: 'subjectAltNames' description: | diff --git a/mmv1/products/compute/BackendServiceSignedUrlKey.yaml b/mmv1/products/compute/BackendServiceSignedUrlKey.yaml index 96558f6f73b3..845def332ba5 100644 --- a/mmv1/products/compute/BackendServiceSignedUrlKey.yaml +++ b/mmv1/products/compute/BackendServiceSignedUrlKey.yaml @@ -75,6 +75,7 @@ parameters: required: true immutable: true ignore_read: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::String name: 'name' diff --git a/mmv1/products/compute/Disk.yaml b/mmv1/products/compute/Disk.yaml index 92d50a0df5bc..84467c0539f4 100644 --- a/mmv1/products/compute/Disk.yaml +++ b/mmv1/products/compute/Disk.yaml @@ -108,6 +108,7 @@ parameters: required: false default_from_api: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::NestedObject name: 'sourceImageEncryptionKey' description: | @@ -218,6 +219,7 @@ parameters: * `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` * `snapshot` + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::NestedObject name: 'sourceSnapshotEncryptionKey' description: | @@ -336,6 +338,7 @@ properties: resource: 'Instance' imports: 'selfLink' description: 'A reference to a user of this disk' + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' output: true - !ruby/object:Api::Type::Integer name: 'physicalBlockSizeBytes' @@ -389,6 +392,7 @@ properties: create the disk. Provide this when creating the disk. custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' default_value: 'pd-standard' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::String name: 'image' api_name: 'sourceImage' @@ -423,6 +427,7 @@ properties: description: 'A resource policy applied to this disk for automatic snapshot creations.' + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Boolean name: 'multiWriter' description: | @@ -433,7 +438,7 @@ properties: description: | Indicates how many IOPS must be provisioned for the disk. Note: Updating currently is only supported by hyperdisk skus without the need to delete and recreate the disk, hyperdisk - allows for an update of IOPS every 4 hours. To update your hyperdisk more frequently, you'll need to manually delete and recreate it + allows for an update of IOPS every 4 hours. To update your hyperdisk more frequently, you'll need to manually delete and recreate it required: false default_from_api: true update_verb: :PATCH @@ -443,7 +448,7 @@ properties: description: | Indicates how much Throughput must be provisioned for the disk. Note: Updating currently is only supported by hyperdisk skus without the need to delete and recreate the disk, hyperdisk - allows for an update of Throughput every 4 hours. To update your hyperdisk more frequently, you'll need to manually delete and recreate it + allows for an update of Throughput every 4 hours. To update your hyperdisk more frequently, you'll need to manually delete and recreate it default_from_api: true update_verb: :PATCH update_url: 'projects/{{project}}/zones/{{zone}}/disks/{{name}}?paths=provisionedThroughput' @@ -492,3 +497,4 @@ properties: description: 'An applicable license URI' resource: 'License' imports: 'selfLink' + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' diff --git a/mmv1/products/compute/DiskType.yaml b/mmv1/products/compute/DiskType.yaml index 8bdceb173a1c..ac1407bc5700 100644 --- a/mmv1/products/compute/DiskType.yaml +++ b/mmv1/products/compute/DiskType.yaml @@ -37,6 +37,7 @@ parameters: imports: 'name' description: 'A reference to the zone where the disk type resides.' required: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Time name: 'creationTimestamp' diff --git a/mmv1/products/compute/ExternalVpnGateway.yaml b/mmv1/products/compute/ExternalVpnGateway.yaml index 8a02e9d22fb3..7fd92d7952f3 100644 --- a/mmv1/products/compute/ExternalVpnGateway.yaml +++ b/mmv1/products/compute/ExternalVpnGateway.yaml @@ -66,6 +66,15 @@ properties: - !ruby/object:Api::Type::KeyValuePairs name: 'labels' description: 'Labels for the external VPN gateway resource.' + update_verb: :POST + update_url: 'projects/{{project}}/global/externalVpnGateways/{{name}}/setLabels' + - !ruby/object:Api::Type::Fingerprint + name: 'labelFingerprint' + description: | + The fingerprint used for optimistic locking of this resource. Used + internally during updates. + update_url: 'projects/{{project}}/global/externalVpnGateways/{{name}}/setLabels' + update_verb: :POST - !ruby/object:Api::Type::String name: 'name' description: | diff --git a/mmv1/products/compute/Firewall.yaml b/mmv1/products/compute/Firewall.yaml index b09b9093b2be..3e7475ea9394 100644 --- a/mmv1/products/compute/Firewall.yaml +++ b/mmv1/products/compute/Firewall.yaml @@ -234,6 +234,7 @@ properties: required: true description: | The name or self_link of the network to attach this firewall to. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Integer name: 'priority' description: | diff --git a/mmv1/products/compute/ForwardingRule.yaml b/mmv1/products/compute/ForwardingRule.yaml index 3eb1f39f97ef..63d7ca4ec017 100644 --- a/mmv1/products/compute/ForwardingRule.yaml +++ b/mmv1/products/compute/ForwardingRule.yaml @@ -217,6 +217,7 @@ parameters: required: false default_from_api: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Time name: 'creationTimestamp' @@ -378,6 +379,7 @@ properties: # manifest input from a single value to a range of form NN-NN. The API # accepts a single value, e.g. '80', but the API stores and returns # '80-80'. This causes idempotency false positive. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::String name: 'portRange' description: | @@ -450,6 +452,7 @@ properties: # TargetSslProxy, TargetTcpProxy, TargetVpnGateway, TargetPool, # TargetInstance) default_from_api: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::String name: 'target' description: | @@ -609,8 +612,8 @@ properties: - !ruby/object:Api::Type::Boolean name: noAutomateDnsZone description: - This is used in PSC consumer ForwardingRule to control whether it should try to auto-generate a DNS zone or not. + This is used in PSC consumer ForwardingRule to control whether it should try to auto-generate a DNS zone or not. Non-PSC forwarding rules do not use this field. send_empty_value: true immutable: true - ignore_read: true \ No newline at end of file + ignore_read: true diff --git a/mmv1/products/compute/GlobalAddress.yaml b/mmv1/products/compute/GlobalAddress.yaml index e77a7bf95ca0..16a0497a6cdd 100644 --- a/mmv1/products/compute/GlobalAddress.yaml +++ b/mmv1/products/compute/GlobalAddress.yaml @@ -147,5 +147,6 @@ properties: any reserved IP ranges referring to it. This should only be set when using an Internal address. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' # status is not useful for state convergence # users[] is not useful for state convergence diff --git a/mmv1/products/compute/GlobalForwardingRule.yaml b/mmv1/products/compute/GlobalForwardingRule.yaml index 927a65795c7f..13567a3083b7 100644 --- a/mmv1/products/compute/GlobalForwardingRule.yaml +++ b/mmv1/products/compute/GlobalForwardingRule.yaml @@ -397,6 +397,7 @@ properties: # manifest input from a single value to a range of form NN-NN. The API # accepts a single value, e.g. '80', but the API stores and returns # '80-80'. This causes idempotency false positive. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::String name: 'portRange' description: | @@ -458,8 +459,8 @@ properties: - !ruby/object:Api::Type::Boolean name: noAutomateDnsZone description: - This is used in PSC consumer ForwardingRule to control whether it should try to auto-generate a DNS zone or not. + This is used in PSC consumer ForwardingRule to control whether it should try to auto-generate a DNS zone or not. Non-PSC forwarding rules do not use this field. send_empty_value: true immutable: true - ignore_read: true \ No newline at end of file + ignore_read: true diff --git a/mmv1/products/compute/Image.yaml b/mmv1/products/compute/Image.yaml index 1e978aa73eff..2c428d454187 100644 --- a/mmv1/products/compute/Image.yaml +++ b/mmv1/products/compute/Image.yaml @@ -191,6 +191,7 @@ properties: description: 'An applicable license URI' resource: 'License' imports: 'selfLink' + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' - !ruby/object:Api::Type::String name: 'name' description: | @@ -239,6 +240,7 @@ properties: rawDisk.source property but not both to create an image. resource: 'Disk' imports: 'selfLink' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::ResourceRef name: 'sourceImage' description: | @@ -251,6 +253,7 @@ properties: * The sourceDisk URL resource: 'Image' imports: 'selfLink' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::ResourceRef name: 'sourceSnapshot' description: | @@ -265,4 +268,5 @@ properties: * The sourceDisk URL resource: 'Snapshot' imports: 'selfLink' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' # State is not applicable for state convergence. diff --git a/mmv1/products/compute/Instance.yaml b/mmv1/products/compute/Instance.yaml index 19fab48a9f34..fe606a8ef47a 100644 --- a/mmv1/products/compute/Instance.yaml +++ b/mmv1/products/compute/Instance.yaml @@ -59,6 +59,7 @@ parameters: imports: 'name' description: 'A reference to the zone where the machine resides.' required: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Boolean name: 'canIpForward' @@ -171,6 +172,7 @@ properties: If not specified, the default is pd-standard. resource: 'DiskType' imports: 'selfLink' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::String name: 'sourceImage' description: | @@ -239,6 +241,7 @@ properties: If desired, you can also attach existing non-root persistent disks using this property. This field is only applicable for persistent disks. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Enum name: 'type' description: | @@ -332,6 +335,7 @@ properties: update_url: projects/{{project}}/zones/{{zone}}/instances/{{name}}/setMachineType update_verb: :POST # TODO(alexstephen): Add metadata + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::String name: 'minCpuPlatform' description: | @@ -387,6 +391,7 @@ properties: from a shared ephemeral IP address pool. If you specify a static external IP address, it must live in the same region as the zone of the instance. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Enum name: 'type' description: | @@ -461,6 +466,7 @@ properties: the default network global/networks/default is used; if the network is not specified but the subnetwork is specified, the network is inferred. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::String name: 'networkIP' description: | @@ -480,6 +486,7 @@ properties: the network is in custom subnet mode, then this field should be specified. # networkInterfaces.kind is not necessary for convergence. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::NestedObject name: 'scheduling' description: Sets the scheduling options for this instance. diff --git a/mmv1/products/compute/InstanceGroup.yaml b/mmv1/products/compute/InstanceGroup.yaml index 86df5fbfbe96..454723ea05fe 100644 --- a/mmv1/products/compute/InstanceGroup.yaml +++ b/mmv1/products/compute/InstanceGroup.yaml @@ -49,6 +49,7 @@ parameters: imports: 'name' description: 'A reference to the zone where the instance group resides.' required: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Array name: 'instances' description: | @@ -63,6 +64,7 @@ parameters: description: 'An instance being added to the InstanceGroup' resource: 'Instance' imports: 'selfLink' + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Time name: 'creationTimestamp' @@ -113,6 +115,7 @@ properties: imports: 'selfLink' description: | The network to which all instances in the instance group belong. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::ResourceRef name: 'region' resource: 'Region' @@ -120,9 +123,11 @@ properties: description: | The region where the instance group is located (for regional resources). + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::ResourceRef name: 'subnetwork' resource: 'Subnetwork' imports: 'selfLink' description: | The subnetwork to which all instances in the instance group belong. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' diff --git a/mmv1/products/compute/InstanceGroupManager.yaml b/mmv1/products/compute/InstanceGroupManager.yaml index bb8485d48568..d1992e1aa278 100644 --- a/mmv1/products/compute/InstanceGroupManager.yaml +++ b/mmv1/products/compute/InstanceGroupManager.yaml @@ -53,6 +53,7 @@ parameters: imports: 'name' description: 'The zone the managed instance group resides.' required: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::String name: 'baseInstanceName' @@ -154,6 +155,7 @@ properties: imports: 'selfLink' description: 'The instance group being managed' output: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::ResourceRef name: 'instanceTemplate' resource: 'InstanceTemplate' @@ -164,6 +166,7 @@ properties: managed instance group. required: true # kind is internal transport detail + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::String name: 'name' description: | @@ -195,6 +198,7 @@ properties: The region this managed instance group resides (for regional resources). output: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Array name: 'targetPools' description: | @@ -206,6 +210,7 @@ properties: description: 'The targetPool to receive managed instances.' resource: 'TargetPool' imports: 'selfLink' + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Integer name: 'targetSize' description: | diff --git a/mmv1/products/compute/InterconnectAttachment.yaml b/mmv1/products/compute/InterconnectAttachment.yaml index 0c19837876ef..39b5082c0230 100644 --- a/mmv1/products/compute/InterconnectAttachment.yaml +++ b/mmv1/products/compute/InterconnectAttachment.yaml @@ -68,6 +68,7 @@ parameters: description: | Region where the regional interconnect attachment resides. default_from_api: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Boolean name: 'adminEnabled' @@ -208,6 +209,7 @@ properties: required: true immutable: true diff_suppress_func: 'tpgresource.CompareSelfLinkOrResourceName' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Time name: 'creationTimestamp' description: | @@ -275,6 +277,7 @@ properties: description: | URL of an address that has been reserved for the interconnect attachment. + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Enum name: 'encryption' description: | diff --git a/mmv1/products/compute/MachineImage.yaml b/mmv1/products/compute/MachineImage.yaml index e8f20d4901dd..c84a6923e879 100644 --- a/mmv1/products/compute/MachineImage.yaml +++ b/mmv1/products/compute/MachineImage.yaml @@ -89,6 +89,7 @@ properties: resource: 'Instance' imports: 'selfLink' required: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Array name: 'storageLocations' description: | diff --git a/mmv1/products/compute/MachineType.yaml b/mmv1/products/compute/MachineType.yaml index 281aa834c803..9a61bb4474f5 100644 --- a/mmv1/products/compute/MachineType.yaml +++ b/mmv1/products/compute/MachineType.yaml @@ -119,4 +119,5 @@ properties: resource: 'Zone' imports: 'name' description: 'The zone the machine type is defined.' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' required: true diff --git a/mmv1/products/compute/NetworkEndpointGroup.yaml b/mmv1/products/compute/NetworkEndpointGroup.yaml index b580ee3582f9..9e849d2b3f76 100644 --- a/mmv1/products/compute/NetworkEndpointGroup.yaml +++ b/mmv1/products/compute/NetworkEndpointGroup.yaml @@ -78,6 +78,7 @@ parameters: Zone where the network endpoint group is located. required: false default_from_api: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::String name: 'name' @@ -126,6 +127,7 @@ properties: The network to which all network endpoints in the NEG belong. Uses "default" project network if unspecified. required: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::ResourceRef name: 'subnetwork' resource: 'Subnetwork' @@ -133,6 +135,7 @@ properties: description: | Optional subnetwork to which all network endpoints in the NEG belong. diff_suppress_func: 'tpgresource.CompareOptionalSubnet' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Integer name: 'defaultPort' description: | diff --git a/mmv1/products/compute/NodeGroup.yaml b/mmv1/products/compute/NodeGroup.yaml index 562524d23ad0..63e3ab1a8f8d 100644 --- a/mmv1/products/compute/NodeGroup.yaml +++ b/mmv1/products/compute/NodeGroup.yaml @@ -84,6 +84,7 @@ parameters: Zone where this node group is located default_from_api: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Time name: 'creationTimestamp' @@ -107,6 +108,7 @@ properties: The URL of the node template to which this node group belongs. update_verb: :POST update_url: 'projects/{{project}}/zones/{{zone}}/nodeGroups/{{name}}/setNodeTemplate' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Integer name: 'size' description: | diff --git a/mmv1/products/compute/NodeTemplate.yaml b/mmv1/products/compute/NodeTemplate.yaml index e949c4688755..ea93a134f43e 100644 --- a/mmv1/products/compute/NodeTemplate.yaml +++ b/mmv1/products/compute/NodeTemplate.yaml @@ -66,6 +66,7 @@ parameters: If it is not provided, the provider region is used. default_from_api: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Time name: 'creationTimestamp' diff --git a/mmv1/products/compute/PacketMirroring.yaml b/mmv1/products/compute/PacketMirroring.yaml index 4241c6c54171..b1de67a949d5 100644 --- a/mmv1/products/compute/PacketMirroring.yaml +++ b/mmv1/products/compute/PacketMirroring.yaml @@ -89,6 +89,7 @@ properties: imports: 'selfLink' required: true immutable: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' required: true - !ruby/object:Api::Type::Integer name: priority @@ -113,6 +114,7 @@ properties: resource: 'ForwardingRule' imports: 'selfLink' description: The URL of the forwarding rule. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::NestedObject name: filter description: | @@ -163,6 +165,7 @@ properties: description: The URL of the subnetwork where this rule should be active. required: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Array name: instances description: | @@ -182,6 +185,7 @@ properties: description: The URL of the instances where this rule should be active. required: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Array name: tags at_least_one_of: diff --git a/mmv1/products/compute/PerInstanceConfig.yaml b/mmv1/products/compute/PerInstanceConfig.yaml index 2a492c26516e..a899987c95a1 100644 --- a/mmv1/products/compute/PerInstanceConfig.yaml +++ b/mmv1/products/compute/PerInstanceConfig.yaml @@ -217,6 +217,7 @@ properties: imports: 'selfLink' description: | The URL of the reservation for this IP address. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Map name: 'externalIp' min_version: beta @@ -245,3 +246,4 @@ properties: imports: 'selfLink' description: | The URL of the reservation for this IP address. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' diff --git a/mmv1/products/compute/RegionAutoscaler.yaml b/mmv1/products/compute/RegionAutoscaler.yaml index 67569be7c01c..e68955cf3728 100644 --- a/mmv1/products/compute/RegionAutoscaler.yaml +++ b/mmv1/products/compute/RegionAutoscaler.yaml @@ -65,6 +65,7 @@ parameters: required: false immutable: true default_from_api: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Time name: 'creationTimestamp' diff --git a/mmv1/products/compute/RegionBackendService.yaml b/mmv1/products/compute/RegionBackendService.yaml index 5486b87d0297..ccb72397ecd3 100644 --- a/mmv1/products/compute/RegionBackendService.yaml +++ b/mmv1/products/compute/RegionBackendService.yaml @@ -126,6 +126,7 @@ parameters: required: false default_from_api: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Integer name: 'affinityCookieTtlSec' @@ -1238,6 +1239,7 @@ properties: description: | The URL of the network to which this backend service belongs. This field can only be specified when the load balancing scheme is set to INTERNAL. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::NestedObject name: 'subsetting' min_version: beta diff --git a/mmv1/products/compute/RegionCommitment.yaml b/mmv1/products/compute/RegionCommitment.yaml index 167500210315..5d2a25a7c320 100644 --- a/mmv1/products/compute/RegionCommitment.yaml +++ b/mmv1/products/compute/RegionCommitment.yaml @@ -76,6 +76,7 @@ parameters: required: false default_from_api: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Integer name: 'commitment_id' diff --git a/mmv1/products/compute/RegionDisk.yaml b/mmv1/products/compute/RegionDisk.yaml index 8d8509afad9f..bbb3ec2ee5cb 100644 --- a/mmv1/products/compute/RegionDisk.yaml +++ b/mmv1/products/compute/RegionDisk.yaml @@ -108,6 +108,7 @@ parameters: required: false default_from_api: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::NestedObject name: 'diskEncryptionKey' description: | @@ -156,6 +157,7 @@ parameters: * `projects/project/global/snapshots/snapshot` * `global/snapshots/snapshot` * `snapshot` + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::NestedObject name: 'sourceSnapshotEncryptionKey' description: | @@ -259,6 +261,7 @@ properties: resource: 'Instance' imports: 'selfLink' description: 'A reference to a user of this disk' + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' output: true - !ruby/object:Api::Type::Integer name: 'physicalBlockSizeBytes' @@ -281,6 +284,7 @@ properties: imports: 'selfLink' description: | A reference to a zone where the disk should be replicated to. + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' - !ruby/object:Api::Type::ResourceRef name: 'type' resource: 'RegionDiskType' @@ -290,6 +294,7 @@ properties: create the disk. Provide this when creating the disk. custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' default_value: 'pd-standard' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::String name: 'interface' min_version: 'beta' @@ -369,3 +374,4 @@ properties: description: 'An applicable license URI' resource: 'License' imports: 'selfLink' + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' diff --git a/mmv1/products/compute/RegionDiskType.yaml b/mmv1/products/compute/RegionDiskType.yaml index f6c03f663ce2..e0b24ffebd8e 100644 --- a/mmv1/products/compute/RegionDiskType.yaml +++ b/mmv1/products/compute/RegionDiskType.yaml @@ -30,6 +30,7 @@ parameters: imports: 'name' description: 'A reference to the region where the disk type resides.' required: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Time name: 'creationTimestamp' diff --git a/mmv1/products/compute/RegionGroupInstanceManager.yaml b/mmv1/products/compute/RegionGroupInstanceManager.yaml index ad72c71c24e9..3d42a649b53f 100644 --- a/mmv1/products/compute/RegionGroupInstanceManager.yaml +++ b/mmv1/products/compute/RegionGroupInstanceManager.yaml @@ -52,6 +52,7 @@ parameters: imports: 'name' description: 'The region the managed instance group resides.' required: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::String name: 'baseInstanceName' @@ -153,6 +154,7 @@ properties: imports: 'selfLink' description: 'The instance group being managed' output: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::ResourceRef name: 'instanceTemplate' resource: 'InstanceTemplate' @@ -163,6 +165,7 @@ properties: managed instance group. required: true # kind is internal transport detail + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::String name: 'name' description: | @@ -197,6 +200,7 @@ properties: description: 'The targetPool to receive managed instances.' resource: 'TargetPool' imports: 'selfLink' + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Integer name: 'targetSize' description: | diff --git a/mmv1/products/compute/RegionHealthCheck.yaml b/mmv1/products/compute/RegionHealthCheck.yaml index db75a4c15010..7e0bf64d078d 100644 --- a/mmv1/products/compute/RegionHealthCheck.yaml +++ b/mmv1/products/compute/RegionHealthCheck.yaml @@ -135,6 +135,7 @@ parameters: default_from_api: true required: false custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Integer name: 'checkIntervalSec' diff --git a/mmv1/products/compute/RegionNetworkEndpointGroup.yaml b/mmv1/products/compute/RegionNetworkEndpointGroup.yaml index 20765726c720..f5b76577aeeb 100644 --- a/mmv1/products/compute/RegionNetworkEndpointGroup.yaml +++ b/mmv1/products/compute/RegionNetworkEndpointGroup.yaml @@ -92,6 +92,7 @@ parameters: description: | A reference to the region where the Serverless NEGs Reside. required: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::String name: 'name' @@ -132,6 +133,7 @@ properties: This field is only used for PSC. The URL of the network to which all network endpoints in the NEG belong. Uses "default" project network if unspecified. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::ResourceRef name: 'subnetwork' resource: 'Subnetwork' @@ -139,6 +141,7 @@ properties: description: | This field is only used for PSC. Optional URL of the subnetwork to which all network endpoints in the NEG belong. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::NestedObject name: 'cloudRun' conflicts: diff --git a/mmv1/products/compute/RegionPerInstanceConfig.yaml b/mmv1/products/compute/RegionPerInstanceConfig.yaml index 6471c44a3a65..8318ccdf205d 100644 --- a/mmv1/products/compute/RegionPerInstanceConfig.yaml +++ b/mmv1/products/compute/RegionPerInstanceConfig.yaml @@ -220,6 +220,7 @@ properties: imports: 'selfLink' description: | The URL of the reservation for this IP address. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Map name: 'externalIp' min_version: beta @@ -248,3 +249,4 @@ properties: imports: 'selfLink' description: | The URL of the reservation for this IP address. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' diff --git a/mmv1/products/compute/RegionSecurityPolicy.yaml b/mmv1/products/compute/RegionSecurityPolicy.yaml index de5aef7a09af..6fdecc4332b4 100644 --- a/mmv1/products/compute/RegionSecurityPolicy.yaml +++ b/mmv1/products/compute/RegionSecurityPolicy.yaml @@ -64,6 +64,7 @@ parameters: The Region in which the created Region Security Policy should reside. If it is not provided, the provider region is used. default_from_api: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::String name: 'policyId' diff --git a/mmv1/products/compute/RegionSslCertificate.yaml b/mmv1/products/compute/RegionSslCertificate.yaml index 9f1498418217..3e6cae1e9e04 100644 --- a/mmv1/products/compute/RegionSslCertificate.yaml +++ b/mmv1/products/compute/RegionSslCertificate.yaml @@ -91,6 +91,7 @@ parameters: If it is not provided, the provider region is used. default_from_api: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::String name: 'certificate' diff --git a/mmv1/products/compute/RegionSslPolicy.yaml b/mmv1/products/compute/RegionSslPolicy.yaml index 863c4cafe1a3..8b86fd79e0ec 100644 --- a/mmv1/products/compute/RegionSslPolicy.yaml +++ b/mmv1/products/compute/RegionSslPolicy.yaml @@ -58,6 +58,7 @@ parameters: immutable: true description: | The region where the regional SSL policy resides. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Time name: 'creationTimestamp' diff --git a/mmv1/products/compute/RegionTargetHttpProxy.yaml b/mmv1/products/compute/RegionTargetHttpProxy.yaml index bcebce49f8b8..7ecdf2a322e2 100644 --- a/mmv1/products/compute/RegionTargetHttpProxy.yaml +++ b/mmv1/products/compute/RegionTargetHttpProxy.yaml @@ -68,6 +68,7 @@ parameters: If it is not provided, the provider region is used. default_from_api: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Time name: 'creationTimestamp' @@ -101,4 +102,5 @@ properties: to the BackendService. required: true update_verb: :POST + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' update_url: 'projects/{{project}}/regions/{{region}}/targetHttpProxies/{{name}}/setUrlMap' diff --git a/mmv1/products/compute/RegionTargetHttpsProxy.yaml b/mmv1/products/compute/RegionTargetHttpsProxy.yaml index ead7d7e4d931..ec2a539f3ab8 100644 --- a/mmv1/products/compute/RegionTargetHttpsProxy.yaml +++ b/mmv1/products/compute/RegionTargetHttpsProxy.yaml @@ -63,6 +63,7 @@ parameters: If it is not provided, the provider region is used. default_from_api: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Time name: 'creationTimestamp' @@ -122,6 +123,7 @@ properties: resource: 'RegionSslCertificate' imports: 'selfLink' description: 'The SSL certificates used by this TargetHttpsProxy' + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' - !ruby/object:Api::Type::ResourceRef name: 'sslPolicy' resource: 'RegionSslPolicy' @@ -136,6 +138,7 @@ properties: # update_verb: :POST # update_url: # 'projects/{{project}}/regions/{{region}}/targetHttpsProxies/{{name}}/setSslPolicy' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::ResourceRef name: 'urlMap' resource: 'RegionUrlMap' @@ -145,4 +148,5 @@ properties: to the RegionBackendService. required: true update_verb: :POST + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' update_url: 'projects/{{project}}/regions/{{region}}/targetHttpsProxies/{{name}}/setUrlMap' diff --git a/mmv1/products/compute/RegionTargetTcpProxy.yaml b/mmv1/products/compute/RegionTargetTcpProxy.yaml index 9b8aba56916d..6d118abb22fb 100644 --- a/mmv1/products/compute/RegionTargetTcpProxy.yaml +++ b/mmv1/products/compute/RegionTargetTcpProxy.yaml @@ -62,6 +62,7 @@ parameters: If it is not provided, the provider region is used. default_from_api: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Time name: 'creationTimestamp' @@ -105,6 +106,7 @@ properties: description: | A reference to the BackendService resource. required: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Boolean name: 'proxyBind' description: | diff --git a/mmv1/products/compute/RegionUrlMap.yaml b/mmv1/products/compute/RegionUrlMap.yaml index 4403e5088e57..69d8e8fcb7ae 100644 --- a/mmv1/products/compute/RegionUrlMap.yaml +++ b/mmv1/products/compute/RegionUrlMap.yaml @@ -141,6 +141,7 @@ parameters: required: false default_from_api: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Time name: 'creationTimestamp' @@ -162,6 +163,7 @@ properties: weightedBackendServices. Conversely, if routeAction specifies any weightedBackendServices, service must not be specified. Only one of defaultService, defaultUrlRedirect or defaultRouteAction.weightedBackendService must be set. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::String name: 'description' description: | @@ -238,6 +240,7 @@ properties: A reference to a RegionBackendService resource. This will be used if none of the pathRules defined by this PathMatcher is matched by the URL's path portion. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::String name: 'description' description: 'An optional description of this resource.' @@ -288,6 +291,7 @@ properties: contain any weightedBackendService s. Conversely, if routeAction specifies any weightedBackendServices, service must not be specified. Only one of urlRedirect, service or routeAction.weightedBackendService must be set. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::NestedObject name: 'headerAction' description: | @@ -688,6 +692,7 @@ properties: imports: 'selfLink' description: | The RegionBackendService resource being mirrored to. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::NestedObject name: 'retryPolicy' description: | @@ -801,6 +806,7 @@ properties: The default RegionBackendService resource. Before forwarding the request to backendService, the loadbalancer applies any relevant headerActions specified as part of this backendServiceWeight. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::NestedObject name: 'headerAction' description: | @@ -970,6 +976,7 @@ properties: contain any weightedBackendService s. Conversely, if routeAction specifies any weightedBackendServices, service must not be specified. Only one of urlRedirect, service or routeAction.weightedBackendService must be set. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Array name: 'paths' required: true @@ -1117,6 +1124,7 @@ properties: imports: 'selfLink' description: | The RegionBackendService resource being mirrored to. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::NestedObject name: 'retryPolicy' description: | @@ -1229,6 +1237,7 @@ properties: The default RegionBackendService resource. Before forwarding the request to backendService, the loadbalancer applies any relevant headerActions specified as part of this backendServiceWeight. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::NestedObject name: 'headerAction' description: | @@ -1475,6 +1484,7 @@ properties: description: A reference to expected RegionBackendService resource the given URL should be mapped to. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::NestedObject name: 'defaultUrlRedirect' exactly_one_of: @@ -1583,6 +1593,7 @@ properties: imports: 'selfLink' description: | The full or partial URL to the default BackendService resource. Before forwarding the request to backendService, the load balancer applies any relevant headerActions specified as part of this backendServiceWeight. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Integer name: 'weight' description: | @@ -1808,6 +1819,7 @@ properties: The full or partial URL to the RegionBackendService resource being mirrored to. The backend service configured for a mirroring policy must reference backends that are of the same type as the original backend service matched in the URL map. Serverless NEG backends are not currently supported as a mirrored backend service. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::NestedObject name: 'corsPolicy' description: | diff --git a/mmv1/products/compute/Reservation.yaml b/mmv1/products/compute/Reservation.yaml index 45e3d85c230f..55285cfcbe91 100644 --- a/mmv1/products/compute/Reservation.yaml +++ b/mmv1/products/compute/Reservation.yaml @@ -81,6 +81,7 @@ parameters: The zone where the reservation is made. required: true immutable: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Time name: 'creationTimestamp' diff --git a/mmv1/products/compute/ResourcePolicy.yaml b/mmv1/products/compute/ResourcePolicy.yaml index 67dbada04bd3..325506ff420c 100644 --- a/mmv1/products/compute/ResourcePolicy.yaml +++ b/mmv1/products/compute/ResourcePolicy.yaml @@ -84,6 +84,7 @@ parameters: immutable: true required: false default_from_api: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::String name: 'name' diff --git a/mmv1/products/compute/Route.yaml b/mmv1/products/compute/Route.yaml index 36daa31baf53..9b6b70de1f4d 100644 --- a/mmv1/products/compute/Route.yaml +++ b/mmv1/products/compute/Route.yaml @@ -136,6 +136,7 @@ properties: immutable: true required: true diff_suppress_func: 'tpgresource.CompareSelfLinkOrResourceName' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Integer name: 'priority' description: | @@ -219,6 +220,7 @@ properties: - next_hop_ilb description: | URL to a VpnTunnel that should handle matching packets. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::String name: 'nextHopNetwork' output: true diff --git a/mmv1/products/compute/Router.yaml b/mmv1/products/compute/Router.yaml index cc45b6c5c956..7f868b4ed1a0 100644 --- a/mmv1/products/compute/Router.yaml +++ b/mmv1/products/compute/Router.yaml @@ -74,6 +74,7 @@ parameters: required: false default_from_api: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Time name: 'creationTimestamp' @@ -112,6 +113,7 @@ properties: # these fields to the Terraform resource (and then within that, decide # whether to deprecate router_interface and router_peer or leave them # alone). + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::NestedObject name: bgp description: | diff --git a/mmv1/products/compute/RouterBgpPeer.yaml b/mmv1/products/compute/RouterBgpPeer.yaml index adce7a08a834..85fa7eca15a8 100644 --- a/mmv1/products/compute/RouterBgpPeer.yaml +++ b/mmv1/products/compute/RouterBgpPeer.yaml @@ -284,6 +284,7 @@ properties: such as Next Gen Firewalls, Virtual Routers, or Router Appliances. The VM instance must be located in zones contained in the same region as this Cloud Router. The VM instance is the peer side of the BGP session. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Boolean name: 'enableIpv6' description: | diff --git a/mmv1/products/compute/RouterNat.yaml b/mmv1/products/compute/RouterNat.yaml index 9b38181b0019..9585438f70b7 100644 --- a/mmv1/products/compute/RouterNat.yaml +++ b/mmv1/products/compute/RouterNat.yaml @@ -149,6 +149,7 @@ properties: resource: 'Address' imports: 'selfLink' description: 'A reference to an address associated with this NAT' + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Array name: 'drainNatIps' description: | @@ -161,6 +162,7 @@ properties: resource: 'Address' imports: 'selfLink' description: 'A reference to an address associated with this NAT' + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Enum name: 'sourceSubnetworkIpRangesToNat' required: true @@ -196,6 +198,7 @@ properties: imports: 'selfLink' description: 'Self-link of subnetwork to NAT' required: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Array name: 'sourceIpRangesToNat' description: | @@ -347,6 +350,7 @@ properties: imports: 'selfLink' description: 'A reference to an address associated with this NAT' + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Array name: 'sourceNatDrainIps' description: | @@ -363,6 +367,7 @@ properties: imports: 'selfLink' description: 'A reference to an address associated with this NAT' + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Boolean name: enableEndpointIndependentMapping description: | diff --git a/mmv1/products/compute/ServiceAttachment.yaml b/mmv1/products/compute/ServiceAttachment.yaml index 350b748aecaa..d1f10b09ab02 100644 --- a/mmv1/products/compute/ServiceAttachment.yaml +++ b/mmv1/products/compute/ServiceAttachment.yaml @@ -80,6 +80,7 @@ parameters: required: false immutable: true default_from_api: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::String name: 'name' @@ -135,6 +136,7 @@ properties: description: | The URL of a forwarding rule that represents the service identified by this service attachment. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Array name: 'natSubnets' required: true @@ -147,6 +149,7 @@ properties: imports: 'selfLink' description: | A subnet that is provided for NAT in this service attachment. + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Boolean name: 'enableProxyProtocol' required: true diff --git a/mmv1/products/compute/Snapshot.yaml b/mmv1/products/compute/Snapshot.yaml index 89ba5c1a4ecd..2f04ab0fb2a1 100644 --- a/mmv1/products/compute/Snapshot.yaml +++ b/mmv1/products/compute/Snapshot.yaml @@ -93,6 +93,7 @@ parameters: required: true # ignore_read in providers - this is only used in Create diff_suppress_func: 'tpgresource.CompareSelfLinkOrResourceName' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::ResourceRef name: 'zone' resource: 'Zone' @@ -102,6 +103,7 @@ parameters: ignore_read: true default_from_api: true required: false + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::NestedObject name: 'snapshotEncryptionKey' description: | @@ -233,6 +235,7 @@ properties: resource: 'License' imports: 'selfLink' description: 'A reference to a license associated with this snapshot' + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' - !ruby/object:Api::Type::KeyValuePairs name: 'labels' description: Labels to apply to this Snapshot. diff --git a/mmv1/products/compute/Subnetwork.yaml b/mmv1/products/compute/Subnetwork.yaml index 6a51e9beecdf..e1daa37918a4 100644 --- a/mmv1/products/compute/Subnetwork.yaml +++ b/mmv1/products/compute/Subnetwork.yaml @@ -160,6 +160,7 @@ properties: Only networks that are in the distributed mode can have subnetworks. immutable: true required: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::String name: 'purpose' immutable: true @@ -256,6 +257,7 @@ properties: immutable: true default_from_api: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::NestedObject name: 'logConfig' update_verb: :PATCH diff --git a/mmv1/products/compute/TargetHttpProxy.yaml b/mmv1/products/compute/TargetHttpProxy.yaml index 5fe03954c19c..b430b9913d15 100644 --- a/mmv1/products/compute/TargetHttpProxy.yaml +++ b/mmv1/products/compute/TargetHttpProxy.yaml @@ -100,6 +100,7 @@ properties: required: true update_verb: :POST update_url: 'projects/{{project}}/targetHttpProxies/{{name}}/setUrlMap' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Boolean name: 'proxyBind' description: | diff --git a/mmv1/products/compute/TargetHttpsProxy.yaml b/mmv1/products/compute/TargetHttpsProxy.yaml index f29c2cf17e5c..65202ce55a3b 100644 --- a/mmv1/products/compute/TargetHttpsProxy.yaml +++ b/mmv1/products/compute/TargetHttpsProxy.yaml @@ -116,6 +116,7 @@ properties: resource: 'SslCertificate' imports: 'selfLink' description: 'The SSL certificates used by this TargetHttpsProxy' + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' - !ruby/object:Api::Type::String name: 'certificateMap' description: | @@ -134,6 +135,7 @@ properties: resource will not have any SSL policy configured. update_verb: :POST update_url: 'projects/{{project}}/global/targetHttpsProxies/{{name}}/setSslPolicy' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::ResourceRef name: 'urlMap' resource: 'UrlMap' @@ -144,6 +146,7 @@ properties: required: true update_verb: :POST update_url: 'projects/{{project}}/targetHttpsProxies/{{name}}/setUrlMap' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Boolean name: 'proxyBind' description: | diff --git a/mmv1/products/compute/TargetInstance.yaml b/mmv1/products/compute/TargetInstance.yaml index 4146e355c310..3ff7681e4ea7 100644 --- a/mmv1/products/compute/TargetInstance.yaml +++ b/mmv1/products/compute/TargetInstance.yaml @@ -71,6 +71,7 @@ parameters: required: false immutable: true default_from_api: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::String name: 'name' diff --git a/mmv1/products/compute/TargetSslProxy.yaml b/mmv1/products/compute/TargetSslProxy.yaml index a8d221132251..cbd309ecfa02 100644 --- a/mmv1/products/compute/TargetSslProxy.yaml +++ b/mmv1/products/compute/TargetSslProxy.yaml @@ -100,6 +100,7 @@ properties: required: true update_verb: :POST update_url: 'projects/{{project}}/global/targetSslProxies/{{name}}/setBackendService' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Array name: 'sslCertificates' description: | @@ -116,6 +117,7 @@ properties: resource: 'SslCertificate' imports: 'selfLink' description: 'The SSL certificates used by this TargetSslProxy' + custom_expand: 'templates/terraform/custom_expand/array_resourceref_with_validation.go.erb' - !ruby/object:Api::Type::String name: 'certificateMap' description: | @@ -137,3 +139,4 @@ properties: resource will not have any SSL policy configured. update_verb: :POST update_url: 'projects/{{project}}/global/targetSslProxies/{{name}}/setSslPolicy' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' diff --git a/mmv1/products/compute/TargetTcpProxy.yaml b/mmv1/products/compute/TargetTcpProxy.yaml index 10dba50ba6fa..83f95b392044 100644 --- a/mmv1/products/compute/TargetTcpProxy.yaml +++ b/mmv1/products/compute/TargetTcpProxy.yaml @@ -99,6 +99,7 @@ properties: required: true update_verb: :POST update_url: 'projects/{{project}}/global/targetTcpProxies/{{name}}/setBackendService' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Boolean name: 'proxyBind' description: | diff --git a/mmv1/products/compute/TargetVpnGateway.yaml b/mmv1/products/compute/TargetVpnGateway.yaml index 6cb234d532d5..7087bb6be486 100644 --- a/mmv1/products/compute/TargetVpnGateway.yaml +++ b/mmv1/products/compute/TargetVpnGateway.yaml @@ -68,6 +68,7 @@ parameters: required: false default_from_api: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::Time name: 'creationTimestamp' @@ -101,4 +102,5 @@ properties: description: | The network this VPN gateway is accepting traffic for. required: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' immutable: true diff --git a/mmv1/products/compute/VpnGateway.yaml b/mmv1/products/compute/VpnGateway.yaml index acfed7fa62b6..a0435e33e39f 100644 --- a/mmv1/products/compute/VpnGateway.yaml +++ b/mmv1/products/compute/VpnGateway.yaml @@ -97,6 +97,7 @@ parameters: required: false default_from_api: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::String name: 'description' @@ -124,6 +125,7 @@ properties: The network this VPN gateway is accepting traffic for. required: true immutable: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Enum name: 'stackType' description: | @@ -161,4 +163,5 @@ properties: specified interconnect attachment resource. Not currently available publicly. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' immutable: true diff --git a/mmv1/products/compute/VpnTunnel.yaml b/mmv1/products/compute/VpnTunnel.yaml index 4d881b42cfd9..3020328720d5 100644 --- a/mmv1/products/compute/VpnTunnel.yaml +++ b/mmv1/products/compute/VpnTunnel.yaml @@ -94,6 +94,7 @@ parameters: required: false default_from_api: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: - !ruby/object:Api::Type::String name: 'tunnel_id' @@ -130,6 +131,7 @@ properties: resource: 'VpnGateway' imports: 'selfLink' immutable: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::ResourceRef name: 'vpnGateway' description: | @@ -139,6 +141,7 @@ properties: resource: 'HaVpnGateway' imports: 'selfLink' immutable: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Integer name: 'vpnGatewayInterface' description: | @@ -154,6 +157,7 @@ properties: - peer_gcp_gateway description: | URL of the peer side external VPN gateway to which this VPN tunnel is connected. + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Integer name: 'peerExternalGatewayInterface' description: | @@ -170,6 +174,7 @@ properties: This field must reference a `google_compute_ha_vpn_gateway` resource. resource: 'HaVpnGateway' imports: 'selfLink' + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::ResourceRef name: 'router' description: | diff --git a/mmv1/products/compute/Zone.yaml b/mmv1/products/compute/Zone.yaml index ab61e803370c..08f0095c5288 100644 --- a/mmv1/products/compute/Zone.yaml +++ b/mmv1/products/compute/Zone.yaml @@ -93,6 +93,7 @@ properties: imports: 'selfLink' description: 'The region where the zone is located.' output: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' - !ruby/object:Api::Type::Enum name: 'status' description: 'The status of the zone.' diff --git a/mmv1/products/dns/ResponsePolicy.yaml b/mmv1/products/dns/ResponsePolicy.yaml index 25fe304c82b8..dc25972ec748 100644 --- a/mmv1/products/dns/ResponsePolicy.yaml +++ b/mmv1/products/dns/ResponsePolicy.yaml @@ -20,7 +20,6 @@ description: | base_url: 'projects/{{project}}/responsePolicies' self_link: 'projects/{{project}}/responsePolicies/{{response_policy_name}}' update_verb: :PATCH -min_version: beta identity: - responsePolicyName examples: diff --git a/mmv1/products/dns/ResponsePolicyRule.yaml b/mmv1/products/dns/ResponsePolicyRule.yaml index 57c2af897f1f..a795f5b0c897 100644 --- a/mmv1/products/dns/ResponsePolicyRule.yaml +++ b/mmv1/products/dns/ResponsePolicyRule.yaml @@ -22,7 +22,6 @@ description: | base_url: 'projects/{{project}}/responsePolicies/{{response_policy}}/rules' self_link: 'projects/{{project}}/responsePolicies/{{response_policy}}/rules/{{rule_name}}' update_verb: :PATCH -min_version: beta identity: - ruleName id_format: 'projects/{{project}}/responsePolicies/{{response_policy}}/rules/{{rule_name}}' diff --git a/mmv1/products/firebase/Project.yaml b/mmv1/products/firebase/Project.yaml index ef9666da0e77..2bb11382be4b 100644 --- a/mmv1/products/firebase/Project.yaml +++ b/mmv1/products/firebase/Project.yaml @@ -38,6 +38,7 @@ examples: primary_resource_id: 'default' vars: instance_name: 'memory-cache' + project_name: "my-project" test_env_vars: org_id: :ORG_ID custom_code: !ruby/object:Provider::Terraform::CustomCode diff --git a/mmv1/products/firebase/ProjectLocation.yaml b/mmv1/products/firebase/ProjectLocation.yaml index 9574a7ea90d6..0c7706419dd2 100644 --- a/mmv1/products/firebase/ProjectLocation.yaml +++ b/mmv1/products/firebase/ProjectLocation.yaml @@ -44,6 +44,8 @@ examples: primary_resource_id: 'basic' test_env_vars: org_id: :ORG_ID + vars: + project_name: "my-project" properties: - !ruby/object:Api::Type::String name: locationId diff --git a/mmv1/products/firebase/WebApp.yaml b/mmv1/products/firebase/WebApp.yaml index b593af788709..5e11372645ac 100644 --- a/mmv1/products/firebase/WebApp.yaml +++ b/mmv1/products/firebase/WebApp.yaml @@ -65,6 +65,7 @@ examples: vars: display_name: 'Display Name Basic' bucket_name: 'fb-webapp-' + project_name: "my-project" test_env_vars: org_id: :ORG_ID test_vars_overrides: diff --git a/mmv1/products/iam2/DenyPolicy.yaml b/mmv1/products/iam2/DenyPolicy.yaml index eee80102cf8b..c73a17fb71b9 100644 --- a/mmv1/products/iam2/DenyPolicy.yaml +++ b/mmv1/products/iam2/DenyPolicy.yaml @@ -32,6 +32,7 @@ examples: vars: policy_name: 'my-deny-policy' account_id: 'svc-acc' + project_name: "my-project" test_env_vars: org_id: :ORG_ID billing_account: :BILLING_ACCT diff --git a/mmv1/products/monitoring/MonitoredProject.yaml b/mmv1/products/monitoring/MonitoredProject.yaml index 96a18785697e..b8dc6542cb06 100644 --- a/mmv1/products/monitoring/MonitoredProject.yaml +++ b/mmv1/products/monitoring/MonitoredProject.yaml @@ -27,6 +27,7 @@ references: !ruby/object:Api::Resource::ReferenceLinks nested_query: !ruby/object:Api::Resource::NestedQuery keys: - monitoredProjects +legacy_long_form_project: true description: "A [project being monitored](https://cloud.google.com/monitoring/settings/multiple-projects#create-multi) by a Metrics Scope." immutable: true custom_code: !ruby/object:Provider::Terraform::CustomCode diff --git a/mmv1/products/networksecurity/AddressGroup.yaml b/mmv1/products/networksecurity/AddressGroup.yaml index a883c74f853a..09177a4a472b 100644 --- a/mmv1/products/networksecurity/AddressGroup.yaml +++ b/mmv1/products/networksecurity/AddressGroup.yaml @@ -17,7 +17,6 @@ name: "AddressGroup" base_url: "{{parent}}/locations/{{location}}/addressGroups" create_url: "{{parent}}/locations/{{location}}/addressGroups?addressGroupId={{name}}" self_link: "{{parent}}/locations/{{location}}/addressGroups/{{name}}" -min_version: beta update_verb: :PATCH update_mask: true description: | @@ -32,7 +31,6 @@ autogen_async: false import_format: ["{{%parent}}/locations/{{location}}/addressGroups/{{name}}"] examples: - !ruby/object:Provider::Terraform::Examples - min_version: beta name: "network_security_address_groups_basic" primary_resource_id: "default" vars: @@ -40,7 +38,6 @@ examples: test_env_vars: project: :PROJECT_NAME - !ruby/object:Provider::Terraform::Examples - min_version: beta name: "network_security_address_groups_organization_basic" primary_resource_id: "default" vars: @@ -48,7 +45,6 @@ examples: test_env_vars: org_id: :ORG_ID - !ruby/object:Provider::Terraform::Examples - min_version: beta name: "network_security_address_groups_advanced" primary_resource_id: "default" vars: diff --git a/mmv1/products/networksecurity/GatewaySecurityPolicies.yaml b/mmv1/products/networksecurity/GatewaySecurityPolicies.yaml index e4a0eac2c96a..daab6b08b6ae 100644 --- a/mmv1/products/networksecurity/GatewaySecurityPolicies.yaml +++ b/mmv1/products/networksecurity/GatewaySecurityPolicies.yaml @@ -16,14 +16,13 @@ name: 'GatewaySecurityPolicy' base_url: 'projects/{{project}}/locations/{{location}}/gatewaySecurityPolicies' create_url: 'projects/{{project}}/locations/{{location}}/gatewaySecurityPolicies?gatewaySecurityPolicyId={{name}}' self_link: 'projects/{{project}}/locations/{{location}}/gatewaySecurityPolicies/{{name}}' -min_version: beta update_verb: :PATCH update_mask: true description: | The GatewaySecurityPolicy resource contains a collection of GatewaySecurityPolicyRules and associated metadata. references: !ruby/object:Api::Resource::ReferenceLinks - api: 'https://cloud.google.com/secure-web-proxy/docs/reference/network-security/rest/v1beta1/projects.locations.gatewaySecurityPolicies' + api: 'https://cloud.google.com/secure-web-proxy/docs/reference/network-security/rest/v1/projects.locations.gatewaySecurityPolicies' async: !ruby/object:Api::OpAsync operation: !ruby/object:Api::OpAsync::Operation path: 'name' @@ -51,7 +50,6 @@ import_format: ] examples: - !ruby/object:Provider::Terraform::Examples - min_version: beta name: 'network_security_gateway_security_policy_basic' primary_resource_id: 'default' vars: @@ -109,3 +107,4 @@ properties: ignore_read: true description: | Name of a TlsInspectionPolicy resource that defines how TLS inspection is performed for any rule that enables it. + min_version: beta diff --git a/mmv1/products/networksecurity/GatewaySecurityPoliciesRules.yaml b/mmv1/products/networksecurity/GatewaySecurityPoliciesRules.yaml index 65b2ba4cf434..5ab0a42fbae9 100644 --- a/mmv1/products/networksecurity/GatewaySecurityPoliciesRules.yaml +++ b/mmv1/products/networksecurity/GatewaySecurityPoliciesRules.yaml @@ -16,15 +16,14 @@ name: 'GatewaySecurityPolicyRule' base_url: 'projects/{{project}}/locations/{{location}}/gatewaySecurityPolicies/{{gateway_security_policy}}/rules' create_url: 'projects/{{project}}/locations/{{location}}/gatewaySecurityPolicies/{{gateway_security_policy}}/rules?gatewaySecurityPolicyRuleId={{name}}' self_link: 'projects/{{project}}/locations/{{location}}/gatewaySecurityPolicies/{{gateway_security_policy}}/rules/{{name}}' -min_version: beta update_verb: :PATCH update_mask: true description: | The GatewaySecurityPolicyRule resource is in a nested collection within a GatewaySecurityPolicy and represents a traffic matching condition and associated action to perform. references: - !ruby/object:Api::Resource::ReferenceLinks # TODO(felipegc): change the url to beta once it is available. - api: 'https://cloud.google.com/secure-web-proxy/docs/reference/network-security/rest/v1alpha1/projects.locations.gatewaySecurityPolicies.rules' + !ruby/object:Api::Resource::ReferenceLinks + api: 'https://cloud.google.com/secure-web-proxy/docs/reference/network-security/rest/v1/projects.locations.gatewaySecurityPolicies.rules' async: !ruby/object:Api::OpAsync operation: !ruby/object:Api::OpAsync::Operation path: 'name' @@ -52,14 +51,12 @@ import_format: ] examples: - !ruby/object:Provider::Terraform::Examples - min_version: beta name: 'network_security_gateway_security_policy_rules_basic' primary_resource_id: 'default' vars: gateway_security_policy_id: 'my-gateway-security-policy' resource_name: 'my-gateway-security-policy-rule' - !ruby/object:Provider::Terraform::Examples - min_version: beta name: 'network_security_gateway_security_policy_rules_advanced' primary_resource_id: 'default' vars: diff --git a/mmv1/products/networksecurity/UrlLists.yaml b/mmv1/products/networksecurity/UrlLists.yaml index 2dae75b6c30a..51a37c58e963 100644 --- a/mmv1/products/networksecurity/UrlLists.yaml +++ b/mmv1/products/networksecurity/UrlLists.yaml @@ -16,17 +16,16 @@ name: 'UrlLists' base_url: 'projects/{{project}}/locations/{{location}}/urlLists' create_url: 'projects/{{project}}/locations/{{location}}/urlLists?urlListId={{name}}' self_link: 'projects/{{project}}/locations/{{location}}/urlLists/{{name}}' -min_version: beta update_verb: :PATCH update_mask: true description: | UrlList proto helps users to set reusable, independently manageable lists of hosts, host patterns, URLs, URL patterns. references: - !ruby/object:Api::Resource::ReferenceLinks # TODO(diogoesteves): change the url to beta once it is available. + !ruby/object:Api::Resource::ReferenceLinks guides: 'Use UrlLists': ' https://cloud.google.com/secure-web-proxy/docs/use-url-list' - api: 'https://cloud.google.com/secure-web-proxy/docs/reference/network-security/rest/v1alpha1/projects.locations.urlLists' + api: 'https://cloud.google.com/secure-web-proxy/docs/reference/network-security/rest/v1/projects.locations.urlLists' async: !ruby/object:Api::OpAsync operation: !ruby/object:Api::OpAsync::Operation path: 'name' @@ -51,13 +50,11 @@ autogen_async: true import_format: ['projects/{{project}}/locations/{{location}}/urlLists/{{name}}'] examples: - !ruby/object:Provider::Terraform::Examples - min_version: beta name: 'network_security_url_lists_basic' primary_resource_id: 'default' vars: resource_name: 'my-url-lists' - !ruby/object:Provider::Terraform::Examples - min_version: beta name: 'network_security_url_lists_advanced' primary_resource_id: 'default' vars: diff --git a/mmv1/products/networksecurity/product.yaml b/mmv1/products/networksecurity/product.yaml index c668ed170ddd..85ae621d8459 100644 --- a/mmv1/products/networksecurity/product.yaml +++ b/mmv1/products/networksecurity/product.yaml @@ -17,6 +17,9 @@ versions: - !ruby/object:Api::Product::Version name: beta base_url: https://networksecurity.googleapis.com/v1beta1/ + - !ruby/object:Api::Product::Version + name: ga + base_url: https://networksecurity.googleapis.com/v1/ scopes: - https://www.googleapis.com/auth/cloud-platform apis_required: diff --git a/mmv1/products/networkservices/Gateway.yaml b/mmv1/products/networkservices/Gateway.yaml index a4c0d763cbdf..cb6e66f33d24 100644 --- a/mmv1/products/networkservices/Gateway.yaml +++ b/mmv1/products/networkservices/Gateway.yaml @@ -16,7 +16,6 @@ name: 'Gateway' base_url: 'projects/{{project}}/locations/{{location}}/gateways' create_url: 'projects/{{project}}/locations/{{location}}/gateways?gatewayId={{name}}' self_link: 'projects/{{project}}/locations/{{location}}/gateways/{{name}}' -min_version: beta update_verb: :PATCH update_mask: true description: | @@ -25,7 +24,7 @@ description: | along with any policy configurations. Routes have reference to to Gateways to dictate how requests should be routed by this Gateway. references: !ruby/object:Api::Resource::ReferenceLinks - api: 'https://cloud.google.com/traffic-director/docs/reference/network-services/rest/v1beta1/projects.locations.gateways' + api: 'https://cloud.google.com/traffic-director/docs/reference/network-services/rest/v1/projects.locations.gateways' async: !ruby/object:Api::OpAsync operation: !ruby/object:Api::OpAsync::Operation path: 'name' @@ -50,19 +49,16 @@ autogen_async: true import_format: ['projects/{{project}}/locations/{{location}}/gateways/{{name}}'] examples: - !ruby/object:Provider::Terraform::Examples - min_version: beta name: 'network_services_gateway_basic' primary_resource_id: 'default' vars: resource_name: 'my-gateway' - !ruby/object:Provider::Terraform::Examples - min_version: beta name: 'network_services_gateway_advanced' primary_resource_id: 'default' vars: resource_name: 'my-gateway' - !ruby/object:Provider::Terraform::Examples - min_version: beta name: 'network_services_gateway_secure_web_proxy' primary_resource_id: 'default' vars: @@ -77,7 +73,6 @@ examples: ignore_read_extra: - 'delete_swg_autogen_router_on_destroy' - !ruby/object:Provider::Terraform::Examples - min_version: beta name: 'network_services_gateway_multiple_swp_same_network' primary_resource_id: 'default' vars: diff --git a/mmv1/products/spanner/Database.yaml b/mmv1/products/spanner/Database.yaml index dbfe4060cd5a..4c203a389fd2 100644 --- a/mmv1/products/spanner/Database.yaml +++ b/mmv1/products/spanner/Database.yaml @@ -91,6 +91,7 @@ parameters: imports: 'name' description: 'The instance to create the database on.' required: true + custom_expand: 'templates/terraform/custom_expand/resourceref_with_validation.go.erb' properties: # This resource returns only one attribute ("name") from which we parse # "instance", "name", and "project". You will need custom code handling diff --git a/mmv1/products/storage/BucketAccessControl.yaml b/mmv1/products/storage/BucketAccessControl.yaml index cea19fe24a40..eb1d63e8e705 100644 --- a/mmv1/products/storage/BucketAccessControl.yaml +++ b/mmv1/products/storage/BucketAccessControl.yaml @@ -59,7 +59,6 @@ properties: description: 'The name of the bucket.' required: true immutable: true - custom_expand: 'templates/terraform/custom_expand/resourceref_as_string.go.erb' - !ruby/object:Api::Type::String name: 'domain' description: 'The domain associated with the entity.' diff --git a/mmv1/products/storage/DefaultObjectACL.yaml b/mmv1/products/storage/DefaultObjectACL.yaml index e5056d70b5a3..1e276fa2dada 100644 --- a/mmv1/products/storage/DefaultObjectACL.yaml +++ b/mmv1/products/storage/DefaultObjectACL.yaml @@ -51,7 +51,6 @@ properties: imports: 'name' description: 'The name of the bucket.' required: true - custom_expand: 'templates/terraform/custom_expand/resourceref_as_string.go.erb' ignore_read: true - !ruby/object:Api::Type::String name: 'domain' diff --git a/mmv1/products/storage/ObjectAccessControl.yaml b/mmv1/products/storage/ObjectAccessControl.yaml index bf367f05d125..f967bd51a2b1 100644 --- a/mmv1/products/storage/ObjectAccessControl.yaml +++ b/mmv1/products/storage/ObjectAccessControl.yaml @@ -51,7 +51,6 @@ properties: imports: 'name' description: 'The name of the bucket.' required: true - custom_expand: 'templates/terraform/custom_expand/resourceref_as_string.go.erb' - !ruby/object:Api::Type::String name: 'domain' description: 'The domain associated with the entity.' diff --git a/mmv1/products/vertexai/Index.yaml b/mmv1/products/vertexai/Index.yaml index f288a3b3c458..938893755581 100644 --- a/mmv1/products/vertexai/Index.yaml +++ b/mmv1/products/vertexai/Index.yaml @@ -131,6 +131,16 @@ properties: performed. Exact reordering is a procedure where results returned by an approximate search algorithm are reordered via a more expensive distance computation. Required if tree-AH algorithm is used. + - !ruby/object:Api::Type::String + name: 'shardSize' + description: |- + Index data is split into equal parts to be processed. These are called "shards". + The shard size must be specified when creating an index. The value must be one of the followings: + * SHARD_SIZE_SMALL: Small (2GB) + * SHARD_SIZE_MEDIUM: Medium (20GB) + * SHARD_SIZE_LARGE: Large (50GB) + immutable: true + default_from_api: true - !ruby/object:Api::Type::String name: 'distanceMeasureType' description: |- @@ -147,6 +157,7 @@ properties: * UNIT_L2_NORM: Unit L2 normalization type * NONE: No normalization type is specified. default_value: 'NONE' + ignore_read: true - !ruby/object:Api::Type::NestedObject name: 'algorithmConfig' description: diff --git a/mmv1/provider/terraform/common~compile.yaml b/mmv1/provider/terraform/common~compile.yaml index 3649796c4b86..495a0ad7efe8 100644 --- a/mmv1/provider/terraform/common~compile.yaml +++ b/mmv1/provider/terraform/common~compile.yaml @@ -131,6 +131,30 @@ -%> '<%= fname.delete_suffix(".erb") -%>': '<%= file_path -%>' <% end -%> +# the generated folder inside .teamcity/components is where any files that need to be generated for team city +# will live, ie the list of services +<% + Dir["third_party/terraform/.teamcity/components/generated/*.erb"].each do |file_path| + fname = file_path.delete_prefix("third_party/terraform/") +-%> +'<%= fname.delete_suffix(".erb") -%>.kt': '<%= file_path -%>' +<% end -%> +# the generated folder inside .teamcity/tests is where any files that need to be generated for team city tests +# will live, ie files that include calling Google[Version] +<% + Dir["third_party/terraform/.teamcity/tests/generated/*.erb"].each do |file_path| + fname = file_path.delete_prefix("third_party/terraform/") +-%> +'<%= fname.delete_suffix(".erb") -%>.kt': '<%= file_path -%>' +<% end -%> +# there exists one file at the top level of .teamcity that needs to be generated for team city +# we'll handle that here +<% + Dir["third_party/terraform/.teamcity/generated/*.erb"].each do |file_path| + fname = file_path.delete_prefix("third_party/terraform/") +-%> +'<%= fname.delete_suffix(".erb").gsub("generated/", "") -%>': '<%= file_path -%>' +<% end -%> 'main.go': 'third_party/terraform/main.go.erb' 'go.mod': 'third_party/terraform/go.mod.erb' '.goreleaser.yml': 'third_party/terraform/.goreleaser.yml.erb' diff --git a/mmv1/provider/terraform/common~copy.yaml b/mmv1/provider/terraform/common~copy.yaml index e157b19dbc35..b4c1223e913a 100644 --- a/mmv1/provider/terraform/common~copy.yaml +++ b/mmv1/provider/terraform/common~copy.yaml @@ -161,5 +161,13 @@ 'website/<%= fname -%>': 'third_party/terraform/website/<%= fname -%>' <% end -%> <% end -%> +<% + Dir["third_party/terraform/.teamcity/*/*.kt"].each do |file_path| + fname = file_path.delete_prefix("third_party/terraform/") +-%> +'<%= fname -%>': '<%= file_path -%>' +<% end -%> +'.teamcity/.gitignore': 'third_party/terraform/.teamcity/.gitignore' +'.teamcity/Makefile': 'third_party/terraform/.teamcity/Makefile' 'version/version.go': 'third_party/terraform/version/version.go' 'go.sum': 'third_party/terraform/go.sum' diff --git a/mmv1/spec/data/resourceref-missingresource.yaml b/mmv1/spec/data/resourceref-missingresource.yaml deleted file mode 100644 index 9a384c8732f1..000000000000 --- a/mmv1/spec/data/resourceref-missingresource.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright 2017 Google Inc. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - ---- !ruby/object:Api::Product -name: MyProduct -versions: - - !ruby/object:Api::Product::Version - name: ga - base_url: http://myproduct.google.com/api -scopes: - - http://scope-to-my-api/ -objects: - - !ruby/object:Api::Resource - name: 'AnotherResource' - kind: 'myproduct#anotherresource' - base_url: 'anotherResource' - description: 'blah blah' - parameters: - - !ruby/object:Api::Type::ResourceRef - resource: 'resource' - name: 'property5' - imports: 'name' - description: 'an explanation whats this about' - properties: - - !ruby/object:Api::Type::String - name: 'property1' - description: | - Some multiline - description for the property. diff --git a/mmv1/spec/type_spec.rb b/mmv1/spec/type_spec.rb index 7edb9d4e4ce0..8df507988846 100644 --- a/mmv1/spec/type_spec.rb +++ b/mmv1/spec/type_spec.rb @@ -203,25 +203,6 @@ class MyType < Api::Type end describe Api::Type::ResourceRef do - context 'requires valid resource' do - let(:spec_location) do - File.join(File.dirname(__FILE__), 'data', - 'resourceref-missingresource.yaml') - end - let(:spec) do - File.open(spec_location, 'r') - end - - after(:each) { spec.close } - subject do - lambda do - Google::YamlValidator.parse(spec.read).validate - end - end - - it { is_expected.to raise_error(StandardError, /Missing 'resource'/) } - end - context 'requires valid imports' do let(:spec_location) do File.join(File.dirname(__FILE__), 'data', diff --git a/mmv1/templates/terraform/custom_expand/array_resourceref_with_validation.go.erb b/mmv1/templates/terraform/custom_expand/array_resourceref_with_validation.go.erb new file mode 100644 index 000000000000..ad2b0e6a729d --- /dev/null +++ b/mmv1/templates/terraform/custom_expand/array_resourceref_with_validation.go.erb @@ -0,0 +1,31 @@ +<%# Copyright 2023 Google Inc. +# Licensed under the Apache License, Version 2.0 (the 'License'); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an 'AS IS' BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +-%> +func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { +<% if property.is_set -%> + v = v.(*schema.Set).List() +<% end -%> + l := v.([]interface{}) + req := make([]interface{}, 0, len(l)) + for _, raw := range l { + if raw == nil { + return nil, fmt.Errorf("Invalid value for <%= property.name.underscore -%>: nil") + } + f, err := <%= build_expand_resource_ref('raw.(string)', property.item_type, pwd) %> + if err != nil { + return nil, fmt.Errorf("Invalid value for <%= property.name.underscore -%>: %s", err) + } + req = append(req, f.RelativeLink()) + } + return req, nil +} diff --git a/mmv1/templates/terraform/custom_expand/resourceref_as_string.go.erb b/mmv1/templates/terraform/custom_expand/resourceref_as_string.go.erb deleted file mode 100644 index 2ced30c53298..000000000000 --- a/mmv1/templates/terraform/custom_expand/resourceref_as_string.go.erb +++ /dev/null @@ -1,17 +0,0 @@ -<%# The license inside this block applies to this file. - # Copyright 2018 Google Inc. - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. - # You may obtain a copy of the License at - # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - # See the License for the specific language governing permissions and - # limitations under the License. --%> -func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return v, nil -} diff --git a/mmv1/templates/terraform/custom_expand/resourceref_with_validation.go.erb b/mmv1/templates/terraform/custom_expand/resourceref_with_validation.go.erb new file mode 100644 index 000000000000..ceefe0c58dbe --- /dev/null +++ b/mmv1/templates/terraform/custom_expand/resourceref_with_validation.go.erb @@ -0,0 +1,20 @@ +<%# Copyright 2023 Google Inc. +# Licensed under the Apache License, Version 2.0 (the 'License'); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an 'AS IS' BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +-%> +func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + f, err := <%= build_expand_resource_ref('v.(string)', property, pwd) %> + if err != nil { + return nil, fmt.Errorf("Invalid value for <%= property.name.underscore -%>: %s", err) + } + return f.RelativeLink(), nil +} diff --git a/mmv1/templates/terraform/decoders/monitoring_monitored_project.go.erb b/mmv1/templates/terraform/decoders/monitoring_monitored_project.go.erb index 96e735c31d18..a05297c4df1a 100644 --- a/mmv1/templates/terraform/decoders/monitoring_monitored_project.go.erb +++ b/mmv1/templates/terraform/decoders/monitoring_monitored_project.go.erb @@ -20,6 +20,6 @@ if name != "" { if err != nil { return nil, err } - res["name"] = project.Name + res["name"] = project.ProjectId } return res, nil diff --git a/mmv1/templates/terraform/examples/dns_response_policy_basic.tf.erb b/mmv1/templates/terraform/examples/dns_response_policy_basic.tf.erb index 62b6bb326c08..6bfde1fe8964 100644 --- a/mmv1/templates/terraform/examples/dns_response_policy_basic.tf.erb +++ b/mmv1/templates/terraform/examples/dns_response_policy_basic.tf.erb @@ -1,21 +1,15 @@ # [START dns_response_policy_basic] resource "google_compute_network" "network-1" { - provider = google-beta - name = "<%= ctx[:vars]['network_1_name'] %>" auto_create_subnetworks = false } resource "google_compute_network" "network-2" { - provider = google-beta - name = "<%= ctx[:vars]['network_2_name'] %>" auto_create_subnetworks = false } resource "google_compute_subnetwork" "subnetwork-1" { - provider = google-beta - name = google_compute_network.network-1.name network = google_compute_network.network-1.name ip_cidr_range = "10.0.36.0/24" @@ -34,8 +28,6 @@ resource "google_compute_subnetwork" "subnetwork-1" { } resource "google_container_cluster" "cluster-1" { - provider = google-beta - name = "<%= ctx[:vars]['cluster_1_name'] %>" location = "us-central1-c" initial_node_count = 1 @@ -64,10 +56,8 @@ resource "google_container_cluster" "cluster-1" { } resource "google_dns_response_policy" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta - response_policy_name = "<%= ctx[:vars]['response_policy_name'] %>" - + networks { network_url = google_compute_network.network-1.id } @@ -78,4 +68,4 @@ resource "google_dns_response_policy" "<%= ctx[:primary_resource_id] %>" { gke_cluster_name = google_container_cluster.cluster-1.id } } -# [END dns_response_policy_basic] \ No newline at end of file +# [END dns_response_policy_basic] diff --git a/mmv1/templates/terraform/examples/dns_response_policy_rule_basic.tf.erb b/mmv1/templates/terraform/examples/dns_response_policy_rule_basic.tf.erb index be24888bd74e..1500979ee66e 100644 --- a/mmv1/templates/terraform/examples/dns_response_policy_rule_basic.tf.erb +++ b/mmv1/templates/terraform/examples/dns_response_policy_rule_basic.tf.erb @@ -1,23 +1,17 @@ # [START dns_response_policy_rule_basic] resource "google_compute_network" "network-1" { - provider = google-beta - name = "<%= ctx[:vars]['network_1_name'] %>" auto_create_subnetworks = false } resource "google_compute_network" "network-2" { - provider = google-beta - name = "<%= ctx[:vars]['network_2_name'] %>" auto_create_subnetworks = false } resource "google_dns_response_policy" "response-policy" { - provider = google-beta - response_policy_name = "<%= ctx[:vars]['response_policy_name'] %>" - + networks { network_url = google_compute_network.network-1.id } @@ -27,8 +21,6 @@ resource "google_dns_response_policy" "response-policy" { } resource "google_dns_response_policy_rule" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta - response_policy = google_dns_response_policy.response-policy.response_policy_name rule_name = "<%= ctx[:vars]['response_policy_rule_name'] %>" dns_name = "dns.example.com." @@ -40,7 +32,7 @@ resource "google_dns_response_policy_rule" "<%= ctx[:primary_resource_id] %>" { ttl = 300 rrdatas = ["192.0.2.91"] } - } + } } -# [END dns_response_policy_rule_basic] \ No newline at end of file +# [END dns_response_policy_rule_basic] diff --git a/mmv1/templates/terraform/examples/firebase_project_basic.tf.erb b/mmv1/templates/terraform/examples/firebase_project_basic.tf.erb index efe50d73cded..3334201307eb 100644 --- a/mmv1/templates/terraform/examples/firebase_project_basic.tf.erb +++ b/mmv1/templates/terraform/examples/firebase_project_basic.tf.erb @@ -1,8 +1,8 @@ resource "google_project" "default" { provider = google-beta - project_id = "tf-test%{random_suffix}" - name = "tf-test%{random_suffix}" + project_id = "<%= ctx[:vars]['project_name'] %>" + name = "<%= ctx[:vars]['project_name'] %>" org_id = "<%= ctx[:test_env_vars]['org_id'] %>" labels = { diff --git a/mmv1/templates/terraform/examples/firebase_project_location_basic.tf.erb b/mmv1/templates/terraform/examples/firebase_project_location_basic.tf.erb index e38e90aa9f2b..4cdebbe83a21 100644 --- a/mmv1/templates/terraform/examples/firebase_project_location_basic.tf.erb +++ b/mmv1/templates/terraform/examples/firebase_project_location_basic.tf.erb @@ -1,8 +1,8 @@ resource "google_project" "default" { provider = google-beta - project_id = "tf-test%{random_suffix}" - name = "tf-test%{random_suffix}" + project_id = "<%= ctx[:vars]['project_name'] %>" + name = "<%= ctx[:vars]['project_name'] %>" org_id = "<%= ctx[:test_env_vars]['org_id'] %>" labels = { diff --git a/mmv1/templates/terraform/examples/firebase_web_app_basic.tf.erb b/mmv1/templates/terraform/examples/firebase_web_app_basic.tf.erb index 87301333ee5b..c75c49c821d6 100644 --- a/mmv1/templates/terraform/examples/firebase_web_app_basic.tf.erb +++ b/mmv1/templates/terraform/examples/firebase_web_app_basic.tf.erb @@ -1,8 +1,8 @@ resource "google_project" "default" { provider = google-beta - project_id = "tf-test%{random_suffix}" - name = "tf-test%{random_suffix}" + project_id = "<%= ctx[:vars]['project_name'] %>" + name = "<%= ctx[:vars]['project_name'] %>" org_id = "<%= ctx[:test_env_vars]['org_id'] %>" labels = { diff --git a/mmv1/templates/terraform/examples/iam_deny_policy_basic.tf.erb b/mmv1/templates/terraform/examples/iam_deny_policy_basic.tf.erb index e98cc4ade771..f9aef33b1be2 100644 --- a/mmv1/templates/terraform/examples/iam_deny_policy_basic.tf.erb +++ b/mmv1/templates/terraform/examples/iam_deny_policy_basic.tf.erb @@ -1,7 +1,7 @@ resource "google_project" "project" { provider = google-beta - project_id = "tf-test%{random_suffix}" - name = "tf-test%{random_suffix}" + project_id = "<%= ctx[:vars]["project_name"] %>" + name = "<%= ctx[:vars]["project_name"] %>" org_id = "<%= ctx[:test_env_vars]['org_id'] %>" billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" } diff --git a/mmv1/templates/terraform/examples/network_security_address_groups_advanced.tf.erb b/mmv1/templates/terraform/examples/network_security_address_groups_advanced.tf.erb index f0361109bb51..4c69e316cea4 100644 --- a/mmv1/templates/terraform/examples/network_security_address_groups_advanced.tf.erb +++ b/mmv1/templates/terraform/examples/network_security_address_groups_advanced.tf.erb @@ -1,5 +1,4 @@ resource "google_network_security_address_group" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta name = "<%= ctx[:vars]['resource_name'] %>" parent = "projects/<%= ctx[:test_env_vars]['project'] %>" location = "us-central1" diff --git a/mmv1/templates/terraform/examples/network_security_address_groups_basic.tf.erb b/mmv1/templates/terraform/examples/network_security_address_groups_basic.tf.erb index 90bbf52ef9ec..00b78c6c92a0 100644 --- a/mmv1/templates/terraform/examples/network_security_address_groups_basic.tf.erb +++ b/mmv1/templates/terraform/examples/network_security_address_groups_basic.tf.erb @@ -1,5 +1,4 @@ resource "google_network_security_address_group" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta name = "<%= ctx[:vars]['resource_name'] %>" parent = "projects/<%= ctx[:test_env_vars]['project'] %>" location = "us-central1" diff --git a/mmv1/templates/terraform/examples/network_security_address_groups_organization_basic.tf.erb b/mmv1/templates/terraform/examples/network_security_address_groups_organization_basic.tf.erb index 1ea9532296b9..fa85ab60d26c 100644 --- a/mmv1/templates/terraform/examples/network_security_address_groups_organization_basic.tf.erb +++ b/mmv1/templates/terraform/examples/network_security_address_groups_organization_basic.tf.erb @@ -1,5 +1,4 @@ resource "google_network_security_address_group" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta name = "<%= ctx[:vars]['resource_name'] %>" parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>" location = "us-central1" diff --git a/mmv1/templates/terraform/examples/network_security_gateway_security_policy_basic.tf.erb b/mmv1/templates/terraform/examples/network_security_gateway_security_policy_basic.tf.erb index 467cedf51177..74b218af71a0 100644 --- a/mmv1/templates/terraform/examples/network_security_gateway_security_policy_basic.tf.erb +++ b/mmv1/templates/terraform/examples/network_security_gateway_security_policy_basic.tf.erb @@ -1,5 +1,4 @@ resource "google_network_security_gateway_security_policy" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta name = "<%= ctx[:vars]['resource_name'] %>" location = "us-central1" description = "my description" diff --git a/mmv1/templates/terraform/examples/network_security_gateway_security_policy_rules_advanced.tf.erb b/mmv1/templates/terraform/examples/network_security_gateway_security_policy_rules_advanced.tf.erb index 2dc4f297604a..0515e303da52 100644 --- a/mmv1/templates/terraform/examples/network_security_gateway_security_policy_rules_advanced.tf.erb +++ b/mmv1/templates/terraform/examples/network_security_gateway_security_policy_rules_advanced.tf.erb @@ -1,12 +1,10 @@ resource "google_network_security_gateway_security_policy" "default" { - provider = google-beta name = "<%= ctx[:vars]['gateway_security_policy_id'] %>" location = "us-central1" description = "gateway security policy created to be used as reference by the rule." } resource "google_network_security_gateway_security_policy_rule" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta name = "<%= ctx[:vars]['resource_name'] %>" location = "us-central1" gateway_security_policy = google_network_security_gateway_security_policy.default.name diff --git a/mmv1/templates/terraform/examples/network_security_gateway_security_policy_rules_basic.tf.erb b/mmv1/templates/terraform/examples/network_security_gateway_security_policy_rules_basic.tf.erb index d0dbb664cc2c..b3a989df1d46 100644 --- a/mmv1/templates/terraform/examples/network_security_gateway_security_policy_rules_basic.tf.erb +++ b/mmv1/templates/terraform/examples/network_security_gateway_security_policy_rules_basic.tf.erb @@ -1,12 +1,10 @@ resource "google_network_security_gateway_security_policy" "default" { - provider = google-beta name = "<%= ctx[:vars]['gateway_security_policy_id'] %>" location = "us-central1" description = "gateway security policy created to be used as reference by the rule." } resource "google_network_security_gateway_security_policy_rule" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta name = "<%= ctx[:vars]['resource_name'] %>" location = "us-central1" gateway_security_policy = google_network_security_gateway_security_policy.default.name diff --git a/mmv1/templates/terraform/examples/network_security_url_lists_advanced.tf.erb b/mmv1/templates/terraform/examples/network_security_url_lists_advanced.tf.erb index dbd19f9aa9f4..395f1596fd5f 100644 --- a/mmv1/templates/terraform/examples/network_security_url_lists_advanced.tf.erb +++ b/mmv1/templates/terraform/examples/network_security_url_lists_advanced.tf.erb @@ -1,5 +1,4 @@ resource "google_network_security_url_lists" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta name = "<%= ctx[:vars]['resource_name'] %>" location = "us-central1" description = "my description" diff --git a/mmv1/templates/terraform/examples/network_security_url_lists_basic.tf.erb b/mmv1/templates/terraform/examples/network_security_url_lists_basic.tf.erb index 97eba9702ced..363c6404930d 100644 --- a/mmv1/templates/terraform/examples/network_security_url_lists_basic.tf.erb +++ b/mmv1/templates/terraform/examples/network_security_url_lists_basic.tf.erb @@ -1,5 +1,4 @@ resource "google_network_security_url_lists" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta name = "<%= ctx[:vars]['resource_name'] %>" location = "us-central1" values = ["www.example.com"] diff --git a/mmv1/templates/terraform/examples/network_services_gateway_advanced.tf.erb b/mmv1/templates/terraform/examples/network_services_gateway_advanced.tf.erb index 9515c48c1ff7..9904d7685b8f 100644 --- a/mmv1/templates/terraform/examples/network_services_gateway_advanced.tf.erb +++ b/mmv1/templates/terraform/examples/network_services_gateway_advanced.tf.erb @@ -1,5 +1,4 @@ resource "google_network_services_gateway" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta name = "<%= ctx[:vars]['resource_name'] %>" labels = { foo = "bar" diff --git a/mmv1/templates/terraform/examples/network_services_gateway_basic.tf.erb b/mmv1/templates/terraform/examples/network_services_gateway_basic.tf.erb index 64070c7a2a3f..9d46fcc890d5 100644 --- a/mmv1/templates/terraform/examples/network_services_gateway_basic.tf.erb +++ b/mmv1/templates/terraform/examples/network_services_gateway_basic.tf.erb @@ -1,5 +1,4 @@ resource "google_network_services_gateway" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta name = "<%= ctx[:vars]['resource_name'] %>" scope = "default-scope-basic" type = "OPEN_MESH" diff --git a/mmv1/templates/terraform/examples/network_services_gateway_multiple_swp_same_network.tf.erb b/mmv1/templates/terraform/examples/network_services_gateway_multiple_swp_same_network.tf.erb index 8c86c2246a80..b144b75cee06 100644 --- a/mmv1/templates/terraform/examples/network_services_gateway_multiple_swp_same_network.tf.erb +++ b/mmv1/templates/terraform/examples/network_services_gateway_multiple_swp_same_network.tf.erb @@ -1,5 +1,4 @@ resource "google_certificate_manager_certificate" "default" { - provider = google-beta name = "<%= ctx[:vars]['certificate_name'] %>" location = "us-south1" self_managed { @@ -9,14 +8,12 @@ resource "google_certificate_manager_certificate" "default" { } resource "google_compute_network" "default" { - provider = google-beta name = "<%= ctx[:vars]['network_name'] %>" routing_mode = "REGIONAL" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { - provider = google-beta name = "<%= ctx[:vars]['subnetwork_name'] %>" purpose = "PRIVATE" ip_cidr_range = "10.128.0.0/20" @@ -26,7 +23,6 @@ resource "google_compute_subnetwork" "default" { } resource "google_compute_subnetwork" "proxyonlysubnet" { - provider = google-beta name = "<%= ctx[:vars]['proxy_only_subnetwork_name'] %>" purpose = "REGIONAL_MANAGED_PROXY" ip_cidr_range = "192.168.0.0/23" @@ -36,13 +32,11 @@ resource "google_compute_subnetwork" "proxyonlysubnet" { } resource "google_network_security_gateway_security_policy" "default" { - provider = google-beta name = "<%= ctx[:vars]['policy_name'] %>" location = "us-south1" } resource "google_network_security_gateway_security_policy_rule" "default" { - provider = google-beta name = "<%= ctx[:vars]['policy_rule_name'] %>" location = "us-south1" gateway_security_policy = google_network_security_gateway_security_policy.default.name @@ -53,7 +47,6 @@ resource "google_network_security_gateway_security_policy_rule" "default" { } resource "google_network_services_gateway" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta name = "<%= ctx[:vars]['gateway_name_1'] %>" location = "us-south1" addresses = ["10.128.0.99"] @@ -69,7 +62,6 @@ resource "google_network_services_gateway" "<%= ctx[:primary_resource_id] %>" { } resource "google_network_services_gateway" "gateway2" { - provider = google-beta name = "<%= ctx[:vars]['gateway_name_2'] %>" location = "us-south1" addresses = ["10.128.0.98"] diff --git a/mmv1/templates/terraform/examples/network_services_gateway_secure_web_proxy.tf.erb b/mmv1/templates/terraform/examples/network_services_gateway_secure_web_proxy.tf.erb index 9dfdd66e2486..ff952e77f3e9 100644 --- a/mmv1/templates/terraform/examples/network_services_gateway_secure_web_proxy.tf.erb +++ b/mmv1/templates/terraform/examples/network_services_gateway_secure_web_proxy.tf.erb @@ -1,5 +1,4 @@ resource "google_certificate_manager_certificate" "default" { - provider = google-beta name = "<%= ctx[:vars]['certificate_name'] %>" location = "us-central1" self_managed { @@ -9,14 +8,12 @@ resource "google_certificate_manager_certificate" "default" { } resource "google_compute_network" "default" { - provider = google-beta name = "<%= ctx[:vars]['network_name'] %>" routing_mode = "REGIONAL" auto_create_subnetworks = false } resource "google_compute_subnetwork" "default" { - provider = google-beta name = "<%= ctx[:vars]['subnetwork_name'] %>" purpose = "PRIVATE" ip_cidr_range = "10.128.0.0/20" @@ -26,7 +23,6 @@ resource "google_compute_subnetwork" "default" { } resource "google_compute_subnetwork" "proxyonlysubnet" { - provider = google-beta name = "<%= ctx[:vars]['proxy_only_subnetwork_name'] %>" purpose = "REGIONAL_MANAGED_PROXY" ip_cidr_range = "192.168.0.0/23" @@ -36,13 +32,11 @@ resource "google_compute_subnetwork" "proxyonlysubnet" { } resource "google_network_security_gateway_security_policy" "default" { - provider = google-beta name = "<%= ctx[:vars]['policy_name'] %>" location = "us-central1" } resource "google_network_security_gateway_security_policy_rule" "default" { - provider = google-beta name = "<%= ctx[:vars]['policy_rule_name'] %>" location = "us-central1" gateway_security_policy = google_network_security_gateway_security_policy.default.name @@ -53,7 +47,6 @@ resource "google_network_security_gateway_security_policy_rule" "default" { } resource "google_network_services_gateway" "<%= ctx[:primary_resource_id] %>" { - provider = google-beta name = "<%= ctx[:vars]['gateway_name_1'] %>" location = "us-central1" addresses = ["10.128.0.99"] diff --git a/mmv1/templates/terraform/examples/vertex_ai_index.tf.erb b/mmv1/templates/terraform/examples/vertex_ai_index.tf.erb index ccdfdad0126f..1a1e90b2c329 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_index.tf.erb +++ b/mmv1/templates/terraform/examples/vertex_ai_index.tf.erb @@ -27,6 +27,7 @@ resource "google_vertex_ai_index" "index" { config { dimensions = 2 approximate_neighbors_count = 150 + shard_size = "SHARD_SIZE_SMALL" distance_measure_type = "DOT_PRODUCT_DISTANCE" algorithm_config { tree_ah_config { diff --git a/mmv1/templates/terraform/examples/vertex_ai_index_streaming.tf.erb b/mmv1/templates/terraform/examples/vertex_ai_index_streaming.tf.erb index 181f3f14691a..acaf268b8254 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_index_streaming.tf.erb +++ b/mmv1/templates/terraform/examples/vertex_ai_index_streaming.tf.erb @@ -26,6 +26,7 @@ resource "google_vertex_ai_index" "index" { contents_delta_uri = "gs://${google_storage_bucket.bucket.name}/contents" config { dimensions = 2 + shard_size = "SHARD_SIZE_LARGE" distance_measure_type = "COSINE_DISTANCE" feature_norm_type = "UNIT_L2_NORM" algorithm_config { diff --git a/mmv1/templates/terraform/expand_property_method.erb b/mmv1/templates/terraform/expand_property_method.erb index c4b7824d843a..d3a034e84ca2 100644 --- a/mmv1/templates/terraform/expand_property_method.erb +++ b/mmv1/templates/terraform/expand_property_method.erb @@ -160,26 +160,13 @@ func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d t if raw == nil { return nil, fmt.Errorf("Invalid value for <%= property.name.underscore -%>: nil") } - f, err := <%= build_expand_resource_ref('raw.(string)', property.item_type, pwd) %> - if err != nil { - return nil, fmt.Errorf("Invalid value for <%= property.name.underscore -%>: %s", err) - } - req = append(req, f.RelativeLink()) + req = append(req, raw.(string)) } return req, nil } <% else -%> -<% if property.is_a?(Api::Type::ResourceRef) -%> - f, err := <%= build_expand_resource_ref('v.(string)', property, pwd) %> - if err != nil { - return nil, fmt.Errorf("Invalid value for <%= property.name.underscore -%>: %s", err) - } - return f.RelativeLink(), nil -} -<% else -%> return v, nil } -<% end -%> <% end # nested_properties, array of resourcerefs, else -%> <% else -%> // TODO: Property '<%= property.name -%>' of type <%= property.class -%> is not supported diff --git a/mmv1/third_party/terraform/.teamcity/.gitignore b/mmv1/third_party/terraform/.teamcity/.gitignore new file mode 100644 index 000000000000..ffac74e1ed27 --- /dev/null +++ b/mmv1/third_party/terraform/.teamcity/.gitignore @@ -0,0 +1,2 @@ +target/ +*.iml diff --git a/mmv1/third_party/terraform/.teamcity/Makefile b/mmv1/third_party/terraform/.teamcity/Makefile new file mode 100644 index 000000000000..25a2799b484a --- /dev/null +++ b/mmv1/third_party/terraform/.teamcity/Makefile @@ -0,0 +1,10 @@ +default: tools + +tools: + mvn -U dependency:sources + +test: validate + mvn test -DtestPackage=tests + +validate: + mvn teamcity-configs:generate diff --git a/mmv1/third_party/terraform/.teamcity/components/build_config_package.kt b/mmv1/third_party/terraform/.teamcity/components/build_config_package.kt new file mode 100644 index 000000000000..5214736b21be --- /dev/null +++ b/mmv1/third_party/terraform/.teamcity/components/build_config_package.kt @@ -0,0 +1,60 @@ +// this file is copied from mmv1, any changes made here will be overwritten + +import jetbrains.buildServer.configs.kotlin.* + +class packageDetails(name: String, displayName: String, environment: String) { + val packageName = name + val displayName = displayName + val environment = environment + + fun buildConfiguration(providerName : String, path : String, nightlyTestsEnabled: Boolean, startHour: Int, parallelism: Int, daysOfWeek: String, daysOfMonth: String) : BuildType { + return BuildType { + // TC needs a consistent ID for dynamically generated packages + id(uniqueID(providerName)) + + name = "%s - Acceptance Tests".format(displayName) + + vcs { + root(providerRepository) + cleanCheckout = true + } + + steps { + ConfigureGoEnv() + DownloadTerraformBinary() + // Adds steps: + // - Determine Working Directory for this Package + // - Pre-Sweeper + // - Compile Test Binary + // - Run via jen20/teamcity-go-test + // - Post-Sweeper + RunAcceptanceTests(path, packageName) + } + + failureConditions { + errorMessage = true + } + + features { + Golang() + } + + params { + TerraformAcceptanceTestParameters(parallelism, "TestAcc", "12", "us-central1", "") + TerraformAcceptanceTestsFlag() + TerraformCoreBinaryTesting() + TerraformShouldPanicForSchemaErrors() + ReadOnlySettings() + WorkingDirectory(path, packageName) + } + + triggers { + RunNightly(nightlyTestsEnabled, startHour, daysOfWeek, daysOfMonth) + } + } + } + + fun uniqueID(provider : String) : String { + return "%s_SERVICE_%s_%s".format(provider.replace("-", "").toUpperCase(), environment.toUpperCase(), packageName.toUpperCase()) + } +} diff --git a/mmv1/third_party/terraform/.teamcity/components/build_google.kt b/mmv1/third_party/terraform/.teamcity/components/build_google.kt new file mode 100644 index 000000000000..4baaddfc5225 --- /dev/null +++ b/mmv1/third_party/terraform/.teamcity/components/build_google.kt @@ -0,0 +1,38 @@ +// this file is copied from mmv1, any changes made here will be overwritten + +import jetbrains.buildServer.configs.kotlin.ParametrizedWithType + +class ClientConfiguration(var custId: String, + var org: String, + val org2 : String, + val billingAccount : String, + val billingAccount2: String, + val masterBillingAccount: String, + val credentials : String, + val project : String, + val orgDomain : String, + val projectNumber : String, + val region : String, + val serviceAccount : String, + val zone : String, + val firestoreProject : String, + val identityUser : String ) { +} + +fun ParametrizedWithType.ConfigureGoogleSpecificTestParameters(config: ClientConfiguration) { + hiddenPasswordVariable("env.GOOGLE_CUST_ID", config.custId, "The ID of the Google Identity Customer") + hiddenPasswordVariable("env.GOOGLE_ORG", config.org, "The Google Organization Id") + hiddenPasswordVariable("env.GOOGLE_ORG_2", config.org2, "The second Google Organization Id") + hiddenPasswordVariable("env.GOOGLE_BILLING_ACCOUNT", config.billingAccount, "The billing account associated with the first google organization") + hiddenPasswordVariable("env.GOOGLE_BILLING_ACCOUNT_2", config.billingAccount2, "The billing account associated with the second google organization") + hiddenPasswordVariable("env.GOOGLE_MASTER_BILLING_ACCOUNT", config.masterBillingAccount, "The master billing account") + hiddenVariable("env.GOOGLE_PROJECT", config.project, "The google project for this build") + hiddenVariable("env.GOOGLE_ORG_DOMAIN", config.orgDomain, "The org domain") + hiddenVariable("env.GOOGLE_PROJECT_NUMBER", config.projectNumber, "The project number associated with the project") + hiddenVariable("env.GOOGLE_REGION", config.region, "The google region to use") + hiddenVariable("env.GOOGLE_SERVICE_ACCOUNT", config.serviceAccount, "The service account") + hiddenVariable("env.GOOGLE_ZONE", config.zone, "The google zone to use") + hiddenVariable("env.GOOGLE_FIRESTORE_PROJECT", config.firestoreProject, "The project to use for firestore") + hiddenVariable("env.GOOGLE_IDENTITY_USER", config.identityUser, "The user for the identity platform") + hiddenPasswordVariable("env.GOOGLE_CREDENTIALS", config.credentials, "The Google credentials for this test runner") +} \ No newline at end of file diff --git a/mmv1/third_party/terraform/.teamcity/components/generated/build_components.erb b/mmv1/third_party/terraform/.teamcity/components/generated/build_components.erb new file mode 100644 index 000000000000..2539ba3970e3 --- /dev/null +++ b/mmv1/third_party/terraform/.teamcity/components/generated/build_components.erb @@ -0,0 +1,137 @@ +<% autogen_exception -%> +// this file is auto-generated with mmv1, any changes made here will be overwritten + +import jetbrains.buildServer.configs.kotlin.* +import jetbrains.buildServer.configs.kotlin.buildFeatures.GolangFeature +import jetbrains.buildServer.configs.kotlin.buildSteps.ScriptBuildStep +import jetbrains.buildServer.configs.kotlin.triggers.schedule + +// NOTE: in time this could be pulled out into a separate Kotlin package + +// The native Go test runner (which TeamCity shells out to) will fail +// the entire test suite when a single test panics, which isn't ideal. +// +// Until that changes, we'll continue to use `teamcity-go-test` to run +// each test individually +const val useTeamCityGoTest = false + +fun BuildFeatures.Golang() { + if (useTeamCityGoTest) { + feature(GolangFeature { + testFormat = "json" + }) + } +} + +fun BuildSteps.ConfigureGoEnv() { + step(ScriptBuildStep { + name = "Configure Go Version" + scriptContent = "goenv install -s \$(goenv local) && goenv rehash" + }) +} + +fun BuildSteps.DownloadTerraformBinary() { + // https://releases.hashicorp.com/terraform/0.12.28/terraform_0.12.28_linux_amd64.zip + var terraformUrl = "https://releases.hashicorp.com/terraform/%env.TERRAFORM_CORE_VERSION%/terraform_%env.TERRAFORM_CORE_VERSION%_linux_amd64.zip" + step(ScriptBuildStep { + name = "Download Terraform Core v%env.TERRAFORM_CORE_VERSION%.." + scriptContent = "mkdir -p tools && wget -O tf.zip %s && unzip tf.zip && mv terraform tools/".format(terraformUrl) + }) +} + +fun servicePath(path : String, packageName: String) : String { + return "./%s/%s".format(path, packageName) +} + +fun BuildSteps.RunAcceptanceTests(path : String, packageName: String) { + var packagePath = servicePath(path, packageName) + var withTestsDirectoryPath = "##teamcity[setParameter name='PACKAGE_PATH' value='%s/tests']".format(packagePath) + + // some packages use a ./tests folder, others don't - conditionally append that if needed + step(ScriptBuildStep { + name = "Determine Working Directory for this Package" + scriptContent = "if [ -d \"%s/tests\" ]; then echo \"%s\"; fi".format(packagePath, withTestsDirectoryPath) + }) + + step(ScriptBuildStep{ + name = "Pre-Sweeper" + scriptContent = "go test -v \"%PACKAGE_PATH%\" -sweep=\"%SWEEPER_REGIONS%\" -sweep-allow-failures -sweep-run=\"%SWEEP_RUN%\" -timeout 30m" + }) + + if (useTeamCityGoTest) { + step(ScriptBuildStep { + name = "Run Tests" + scriptContent = "go test -v \"%PACKAGE_PATH%\" -timeout=\"%TIMEOUT%h\" -test.parallel=\"%PARALLELISM%\" -run=\"%TEST_PREFIX%\" -json" + }) + } else { + step(ScriptBuildStep { + name = "Compile Test Binary" + scriptContent = "go test -c -o test-binary" + workingDir = "%PACKAGE_PATH%" + }) + + step(ScriptBuildStep { + // ./test-binary -test.list=TestAccComputeRegionDisk_ | teamcity-go-test -test ./test-binary -timeout 1s + name = "Run via jen20/teamcity-go-test" + scriptContent = "./test-binary -test.list=\"%TEST_PREFIX%\" | teamcity-go-test -test ./test-binary -parallelism \"%PARALLELISM%\" -timeout \"%TIMEOUT%h\"" + workingDir = "%PACKAGE_PATH%" + }) + } + + step(ScriptBuildStep{ + name = "Post-Sweeper" + scriptContent = "go test -v \"%PACKAGE_PATH%\" -sweep=\"%SWEEPER_REGIONS%\" -sweep-allow-failures -sweep-run=\"%SWEEP_RUN%\" -timeout 30m" + }) +} + +fun ParametrizedWithType.TerraformAcceptanceTestParameters(parallelism : Int, prefix : String, timeout: String, sweeperRegions: String, sweepRun: String) { + text("PARALLELISM", "%d".format(parallelism)) + text("TEST_PREFIX", prefix) + text("TIMEOUT", timeout) + text("SWEEPER_REGIONS", sweeperRegions) + text("SWEEP_RUN", sweepRun) +} + +fun ParametrizedWithType.ReadOnlySettings() { + hiddenVariable("teamcity.ui.settings.readOnly", "true", "Requires build configurations be edited via Kotlin") +} + +fun ParametrizedWithType.TerraformAcceptanceTestsFlag() { + hiddenVariable("env.TF_ACC", "1", "Set to a value to run the Acceptance Tests") +} + +fun ParametrizedWithType.TerraformCoreBinaryTesting() { + text("env.TERRAFORM_CORE_VERSION", defaultTerraformCoreVersion, "The version of Terraform Core which should be used for testing") + hiddenVariable("env.TF_ACC_TERRAFORM_PATH", "%system.teamcity.build.checkoutDir%/tools/terraform", "The path where the Terraform Binary is located") +} + +fun ParametrizedWithType.TerraformShouldPanicForSchemaErrors() { + hiddenVariable("env.TF_SCHEMA_PANIC_ON_ERROR", "1", "Panic if unknown/unmatched fields are set into the state") +} + +fun ParametrizedWithType.WorkingDirectory(path : String, packageName: String) { + text("PACKAGE_PATH", servicePath(path, packageName), "", "The path at which to run - automatically updated", ParameterDisplay.HIDDEN) +} + +fun ParametrizedWithType.hiddenVariable(name: String, value: String, description: String) { + text(name, value, "", description, ParameterDisplay.HIDDEN) +} + +fun ParametrizedWithType.hiddenPasswordVariable(name: String, value: String, description: String) { + password(name, value, "", description, ParameterDisplay.HIDDEN) +} + +fun Triggers.RunNightly(nightlyTestsEnabled: Boolean, startHour: Int, daysOfWeek: String, daysOfMonth: String) { + schedule{ + enabled = nightlyTestsEnabled + branchFilter = "+:refs/heads/main" + + schedulingPolicy = cron { + hours = startHour.toString() + timezone = "SERVER" + + dayOfWeek = daysOfWeek + dayOfMonth = daysOfMonth + } + } +} diff --git a/mmv1/third_party/terraform/.teamcity/components/generated/project.erb b/mmv1/third_party/terraform/.teamcity/components/generated/project.erb new file mode 100644 index 000000000000..a1eb8701e37e --- /dev/null +++ b/mmv1/third_party/terraform/.teamcity/components/generated/project.erb @@ -0,0 +1,47 @@ +<% autogen_exception -%> +// this file is auto-generated with mmv1, any changes made here will be overwritten + +import jetbrains.buildServer.configs.kotlin.BuildType +import jetbrains.buildServer.configs.kotlin.Project + +const val providerName = "google<%= "-" + version unless version == 'ga' -%>" + +fun Google<%= version.capitalize unless version == 'ga' -%>(environment: String, configuration : ClientConfiguration) : Project { + return Project{ + vcsRoot(providerRepository) + + var buildConfigs = buildConfigurationsForPackages(packages, providerName, "google<%= "-" + version unless version == 'ga' -%>", environment, configuration) + buildConfigs.forEach { buildConfiguration -> + buildType(buildConfiguration) + } + } +} + +fun buildConfigurationsForPackages(packages: Map, providerName : String, path : String, environment: String, config : ClientConfiguration): List { + var list = ArrayList() + + packages.forEach { (packageName, displayName) -> + if (packageName == "services") { + var serviceList = buildConfigurationsForPackages(services, providerName, path+"/"+packageName, environment, config) + list.addAll(serviceList) + } else { + var defaultTestConfig = testConfiguration() + + var pkg = packageDetails(packageName, displayName, environment) + var buildConfig = pkg.buildConfiguration(providerName, path, true, defaultTestConfig.startHour, defaultTestConfig.parallelism, defaultTestConfig.daysOfWeek, defaultTestConfig.daysOfMonth) + + buildConfig.params.ConfigureGoogleSpecificTestParameters(config) + + list.add(buildConfig) + } + } + + return list +} + +class testConfiguration(parallelism: Int = defaultParallelism, startHour: Int = defaultStartHour, daysOfWeek: String = defaultDaysOfWeek, daysOfMonth: String = defaultDaysOfMonth) { + var parallelism = parallelism + var startHour = startHour + var daysOfWeek = daysOfWeek + var daysOfMonth = daysOfMonth +} \ No newline at end of file diff --git a/mmv1/third_party/terraform/.teamcity/components/generated/services.erb b/mmv1/third_party/terraform/.teamcity/components/generated/services.erb new file mode 100644 index 000000000000..f98a9fef637f --- /dev/null +++ b/mmv1/third_party/terraform/.teamcity/components/generated/services.erb @@ -0,0 +1,15 @@ +<% autogen_exception -%> +// this file is auto-generated with mmv1, any changes made here will be overwritten +<% + service_names = [] + version_string = "-" + version unless version == 'ga' + Dir["google#{version_string}/services/**"].each do |service| + service_names.push service.split('/')[-1] + end +-%> + +var services = mapOf( +<% service_names.each_with_index do |service, i| -%> + "<%= service -%>" to "<%= service.space_separated -%>"<%= ',' if i < (service_names.size - 1) %> +<% end -%> +) \ No newline at end of file diff --git a/mmv1/third_party/terraform/.teamcity/components/generated/vcs_root.erb b/mmv1/third_party/terraform/.teamcity/components/generated/vcs_root.erb new file mode 100644 index 000000000000..ff485939eb59 --- /dev/null +++ b/mmv1/third_party/terraform/.teamcity/components/generated/vcs_root.erb @@ -0,0 +1,14 @@ +<% autogen_exception -%> +// this file is auto-generated with mmv1, any changes made here will be overwritten + +import jetbrains.buildServer.configs.kotlin.vcs.GitVcsRoot + +object providerRepository : GitVcsRoot({ + name = "terraform-provider-google<%= "-" + version unless version == 'ga' -%>" + url = "https://github.com/hashicorp/terraform-provider-google<%= "-" + version unless version == 'ga' -%>.git" + agentCleanPolicy = AgentCleanPolicy.ON_BRANCH_CHANGE + agentCleanFilesPolicy = AgentCleanFilesPolicy.ALL_UNTRACKED + branchSpec = "+:*" + branch = "refs/heads/main" + authMethod = anonymous() +}) diff --git a/mmv1/third_party/terraform/.teamcity/components/packages.kt b/mmv1/third_party/terraform/.teamcity/components/packages.kt new file mode 100644 index 000000000000..c1355e359852 --- /dev/null +++ b/mmv1/third_party/terraform/.teamcity/components/packages.kt @@ -0,0 +1,11 @@ +// this file is copied from mmv1, any changes made here will be overwritten + +var packages = mapOf( + "acctest" to "AccTest", + "services" to "Services", + "tpgdclresource" to "TPG DCL Resource", + "tpgiamresource" to "TPG IAM Resource", + "tpgresource" to "TPG Resource", + "transport" to "Transport", + "verify" to "Verify" +) \ No newline at end of file diff --git a/mmv1/third_party/terraform/.teamcity/components/settings.kt b/mmv1/third_party/terraform/.teamcity/components/settings.kt new file mode 100644 index 000000000000..44f98ded7b4d --- /dev/null +++ b/mmv1/third_party/terraform/.teamcity/components/settings.kt @@ -0,0 +1,16 @@ +// this file is copied from mmv1, any changes made here will be overwritten + +// specifies the default hour (UTC) at which tests should be triggered, if enabled +var defaultStartHour = 4 + +// specifies the default level of parallelism per-service-package +var defaultParallelism = 12 + +// specifies the default version of Terraform Core which should be used for testing +var defaultTerraformCoreVersion = "1.2.5" + +// This represents a cron view of days of the week, Monday - Friday. +const val defaultDaysOfWeek = "*" + +// Cron value for any day of month +const val defaultDaysOfMonth = "*" diff --git a/mmv1/third_party/terraform/.teamcity/generated/pom.xml.erb b/mmv1/third_party/terraform/.teamcity/generated/pom.xml.erb new file mode 100644 index 000000000000..640a4a7f7530 --- /dev/null +++ b/mmv1/third_party/terraform/.teamcity/generated/pom.xml.erb @@ -0,0 +1,138 @@ +<% autogen_exception -%> + + + + + 4.0.0 + Terraform-Provider-Google<%= version.capitalize unless version == 'ga' -%> Config DSL Script + TerraformProviderGoogle<%= version.capitalize unless version == 'ga' -%> + TerraformProviderGoogle<%= version.capitalize unless version == 'ga' -%> + 1.0-SNAPSHOT + + + org.jetbrains.teamcity + configs-dsl-kotlin-parent + 1.0-SNAPSHOT + + + + + jetbrains-all + https://download.jetbrains.com/teamcity-repository + + true + + + + teamcity-server + https://teamcity.jetbrains.com/app/dsl-plugins-repository + + true + + + + + + + JetBrains + https://download.jetbrains.com/teamcity-repository + + + + + tests + components + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + tests/*.class + + + + + compile + process-sources + + test + + + + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + + + + compile + process-sources + + compile + + + + test-compile + process-test-sources + + test-compile + + + + + + org.jetbrains.teamcity + teamcity-configs-maven-plugin + ${teamcity.dsl.version} + + kotlin + target/generated-configs + + public + + + + + + + + + org.jetbrains.teamcity + configs-dsl-kotlin-latest + ${teamcity.dsl.version} + compile + + + org.jetbrains.teamcity + configs-dsl-kotlin-plugins-latest + 1.0-SNAPSHOT + pom + compile + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + compile + + + junit + junit + 4.13.2 + + + org.jetbrains.kotlin + kotlin-script-runtime + ${kotlin.version} + compile + + + \ No newline at end of file diff --git a/mmv1/third_party/terraform/.teamcity/generated/settings.kts.erb b/mmv1/third_party/terraform/.teamcity/generated/settings.kts.erb new file mode 100644 index 000000000000..113c8a9b3a28 --- /dev/null +++ b/mmv1/third_party/terraform/.teamcity/generated/settings.kts.erb @@ -0,0 +1,30 @@ +<% autogen_exception -%> +// this file is auto-generated with mmv1, any changes made here will be overwritten + +import Google<%= version.capitalize unless version == 'ga' -%> + +import ClientConfiguration +import jetbrains.buildServer.configs.kotlin.* + +version = "2023.05" + +var custId = DslContext.getParameter("custId", "") +var org = DslContext.getParameter("org", "") +var org2 = DslContext.getParameter("org2", "") +var billingAccount = DslContext.getParameter("billingAccount", "") +var billingAccount2 = DslContext.getParameter("billingAccount2", "") +var masterBillingAccount = DslContext.getParameter("masterBillingAccount", "") +var project = DslContext.getParameter("project", "") +var orgDomain = DslContext.getParameter("orgDomain", "") +var projectNumber = DslContext.getParameter("projectNumber", "") +var region = DslContext.getParameter("region", "") +var serviceAccount = DslContext.getParameter("serviceAccount", "") +var zone = DslContext.getParameter("zone", "") +var credentials = DslContext.getParameter("credentials", "") +var environment = DslContext.getParameter("environment", "public") +var firestoreProject = DslContext.getParameter("firestoreProject", "") +var identityUser = DslContext.getParameter("identityUser", "") + +var clientConfig = ClientConfiguration(custId, org, org2, billingAccount, billingAccount2, masterBillingAccount, credentials, project, orgDomain, projectNumber, region, serviceAccount, zone, firestoreProject, identityUser) + +project(Google<%= version.capitalize unless version == 'ga' -%>(environment, clientConfig)) diff --git a/mmv1/third_party/terraform/.teamcity/tests/generated/configuration.erb b/mmv1/third_party/terraform/.teamcity/tests/generated/configuration.erb new file mode 100644 index 000000000000..75385974852e --- /dev/null +++ b/mmv1/third_party/terraform/.teamcity/tests/generated/configuration.erb @@ -0,0 +1,51 @@ +<% autogen_exception -%> +// this file is auto-generated with mmv1, any changes made here will be overwritten + +package tests + +import Google<%= version.capitalize unless version == 'ga' -%> + +import org.junit.Assert.assertTrue +import org.junit.Test +import useTeamCityGoTest + +class ConfigurationTests { + @Test + fun buildShouldFailOnError() { + val project = Google<%= version.capitalize unless version == 'ga' -%>("public", TestConfiguration()) + project.buildTypes.forEach { bt -> + assertTrue("Build '${bt.id}' should fail on errors!", bt.failureConditions.errorMessage) + } + } + + @Test + fun buildShouldHaveGoTestFeature() { + val project = Google<%= version.capitalize unless version == 'ga' -%>("public", TestConfiguration()) + project.buildTypes.forEach{ bt -> + var exists = false + bt.features.items.forEach { f -> + if (f.type == "golang") { + exists = true + } + } + + if (useTeamCityGoTest) { + assertTrue("Build %s doesn't have Go Test Json enabled".format(bt.name), exists) + } + } + } + + @Test + fun buildShouldHaveTrigger() { + val project = Google<%= version.capitalize unless version == 'ga' -%>("public", TestConfiguration()) + var exists = false + project.buildTypes.forEach{ bt -> + bt.triggers.items.forEach { t -> + if (t.type == "schedulingTrigger") { + exists = true + } + } + } + assertTrue("The Build Configuration should have a Trigger", exists) + } +} diff --git a/mmv1/third_party/terraform/.teamcity/tests/generated/vcs_roots.erb b/mmv1/third_party/terraform/.teamcity/tests/generated/vcs_roots.erb new file mode 100644 index 000000000000..ac315f6209ba --- /dev/null +++ b/mmv1/third_party/terraform/.teamcity/tests/generated/vcs_roots.erb @@ -0,0 +1,19 @@ +<% autogen_exception -%> +// this file is auto-generated with mmv1, any changes made here will be overwritten + +package tests + +import Google<%= version.capitalize unless version == 'ga' -%> + +import org.junit.Assert.assertTrue +import org.junit.Test + +class VcsTests { + @Test + fun buildsHaveCleanCheckOut() { + val project = Google<%= version.capitalize unless version == 'ga' -%>("public", TestConfiguration()) + project.buildTypes.forEach { bt -> + assertTrue("Build '${bt.id}' doesn't use clean checkout", bt.vcs.cleanCheckout) + } + } +} diff --git a/mmv1/third_party/terraform/.teamcity/tests/helpers.kt b/mmv1/third_party/terraform/.teamcity/tests/helpers.kt new file mode 100644 index 000000000000..390493a68d06 --- /dev/null +++ b/mmv1/third_party/terraform/.teamcity/tests/helpers.kt @@ -0,0 +1,9 @@ +// this file is copied from mmv1, any changes made here will be overwritten + +package tests + +import ClientConfiguration + +fun TestConfiguration() : ClientConfiguration { + return ClientConfiguration("custId", "org", "org2", "billingAccount", "billingAccount2", "masterBillingAccount", "credentials", "project", "orgDomain", "projectNumber", "region", "serviceAccount", "zone", "firestoreProject", "identityUser") +} \ No newline at end of file diff --git a/mmv1/third_party/terraform/go.mod.erb b/mmv1/third_party/terraform/go.mod.erb index 592b44785bf7..a259be3cff51 100644 --- a/mmv1/third_party/terraform/go.mod.erb +++ b/mmv1/third_party/terraform/go.mod.erb @@ -25,12 +25,12 @@ require ( github.com/mitchellh/go-homedir v1.1.0 github.com/mitchellh/hashstructure v1.1.0 github.com/sirupsen/logrus v1.8.1 - golang.org/x/net v0.10.0 - golang.org/x/oauth2 v0.8.0 - google.golang.org/api v0.128.0 - google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc - google.golang.org/grpc v1.55.0 - google.golang.org/protobuf v1.30.0 + golang.org/x/net v0.12.0 + golang.org/x/oauth2 v0.9.0 + google.golang.org/api v0.130.0 + google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529 + google.golang.org/grpc v1.56.1 + google.golang.org/protobuf v1.31.0 ) require ( @@ -46,9 +46,9 @@ require ( github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe // indirect - github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195 // indirect - github.com/envoyproxy/go-control-plane v0.11.0 // indirect - github.com/envoyproxy/protoc-gen-validate v0.10.0 // indirect + github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 // indirect + github.com/envoyproxy/go-control-plane v0.11.1-0.20230524094728-9239064ad72f // indirect + github.com/envoyproxy/protoc-gen-validate v0.10.1 // indirect github.com/fatih/color v1.13.0 // indirect github.com/gammazero/deque v0.0.0-20180920172122-f6adf94963e4 // indirect github.com/golang/glog v1.1.0 // indirect @@ -58,8 +58,8 @@ require ( github.com/google/go-cpy v0.0.0-20211218193943-a9c933c06932 // indirect github.com/google/s2a-go v0.1.4 // indirect github.com/google/uuid v1.3.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.4 // indirect - github.com/googleapis/gax-go/v2 v2.10.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect + github.com/googleapis/gax-go/v2 v2.11.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-hclog v1.2.1 // indirect github.com/hashicorp/go-plugin v1.4.8 // indirect @@ -86,9 +86,9 @@ require ( github.com/vmihailenco/tagparser v0.1.2 // indirect github.com/zclconf/go-cty v1.11.0 // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/crypto v0.9.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect + golang.org/x/crypto v0.11.0 // indirect + golang.org/x/sys v0.10.0 // indirect + golang.org/x/text v0.11.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect diff --git a/mmv1/third_party/terraform/go.sum b/mmv1/third_party/terraform/go.sum index 5a92ab6038cc..3988a1ed1a2f 100644 --- a/mmv1/third_party/terraform/go.sum +++ b/mmv1/third_party/terraform/go.sum @@ -53,8 +53,8 @@ github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195 h1:58f1tJ1ra+zFINPlwLWvQsR9CzAKt2e+EWV2yX9oXQ4= -github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= +github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/creachadair/staticfile v0.1.2/go.mod h1:a3qySzCIXEprDGxk6tSxSI+dBBdLzqeBOMhZ+o2d3pM= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -69,11 +69,11 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.11.0 h1:jtLewhRR2vMRNnq2ZZUoCjUlgut+Y0+sDDWPOfwOi1o= -github.com/envoyproxy/go-control-plane v0.11.0/go.mod h1:VnHyVMpzcLvCFt9yUz1UnCwHLhwx1WguiVDV7pTG/tI= +github.com/envoyproxy/go-control-plane v0.11.1-0.20230524094728-9239064ad72f h1:7T++XKzy4xg7PKy+bM+Sa9/oe1OC88yz2hXQUISoXfA= +github.com/envoyproxy/go-control-plane v0.11.1-0.20230524094728-9239064ad72f/go.mod h1:sfYdkwUW4BA3PbKjySwjJy+O4Pu0h62rlqCMHNk+K+Q= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v0.10.0 h1:oIfnZFdC0YhpNNEX+SuIqko4cqqVZeN9IGTrhZje83Y= -github.com/envoyproxy/protoc-gen-validate v0.10.0/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= +github.com/envoyproxy/protoc-gen-validate v0.10.1 h1:c0g45+xCJhdgFGw7a5QAfdS4byAbud7miNWJ1WwEVf8= +github.com/envoyproxy/protoc-gen-validate v0.10.1/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= @@ -140,12 +140,10 @@ github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkj github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= -github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/enterprise-certificate-proxy v0.2.4 h1:uGy6JWR/uMIILU8wbf+OkstIrNiMjGpEIyhx8f6W7s4= -github.com/googleapis/enterprise-certificate-proxy v0.2.4/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/gax-go/v2 v2.10.0 h1:ebSgKfMxynOdxw8QQuFOKMgomqeLGPqNLQox2bo42zg= -github.com/googleapis/gax-go/v2 v2.10.0/go.mod h1:4UOEnMCrxsSqQ940WnTiD6qJ63le2ev3xfyagutxiPw= +github.com/googleapis/enterprise-certificate-proxy v0.2.5 h1:UR4rDjcgpgEnqpIEvkiqTYKBCKLNmlge2eVjoZfySzM= +github.com/googleapis/enterprise-certificate-proxy v0.2.5/go.mod h1:RxW0N9901Cko1VOCW3SXCpWP+mlIEkk2tP7jnHy9a3w= +github.com/googleapis/gax-go/v2 v2.11.0 h1:9V9PWXEsWnPpQhu/PeQIkS4eGzMlTLGgt80cUUI8Ki4= +github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= @@ -272,8 +270,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= @@ -308,8 +306,8 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= +golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -337,13 +335,13 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8= -golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= +golang.org/x/oauth2 v0.9.0 h1:BPpt2kU7oMRq3kCHAA1tbSEshXRw1LpG2ztgDwrzuAs= +golang.org/x/oauth2 v0.9.0/go.mod h1:qYgFZaFiu6Wg24azG8bdV52QJXJGbZzIIsRCdVKzbLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -351,7 +349,7 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -376,11 +374,11 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= +golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -388,8 +386,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -405,10 +403,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -google.golang.org/api v0.125.0 h1:7xGvEY4fyWbhWMHf3R2/4w7L4fXyfpRGE9g6lp8+DCk= -google.golang.org/api v0.125.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= -google.golang.org/api v0.128.0 h1:RjPESny5CnQRn9V6siglged+DZCgfu9l6mO9dkX9VOg= -google.golang.org/api v0.128.0/go.mod h1:Y611qgqaE92On/7g65MQgxYul3c0rEB894kniWLY750= +google.golang.org/api v0.130.0 h1:A50ujooa1h9iizvfzA4rrJr2B7uRmWexwbekQ2+5FPQ= +google.golang.org/api v0.130.0/go.mod h1:J/LCJMYSDFvAVREGCbrESb53n4++NMBDetSHGL5I5RY= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= @@ -423,8 +419,8 @@ google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc h1:8DyZCyvI8mE1IdL google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64= google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529 h1:DEH99RbiLZhMxrpEJCZ0A+wdTe0EOgou/poSLx9vWf4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -434,8 +430,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= -google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= -google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= +google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= +google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -447,8 +443,8 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/mmv1/third_party/terraform/services/container/resource_container_cluster.go.erb b/mmv1/third_party/terraform/services/container/resource_container_cluster.go.erb index f46444945d0b..366d559ae162 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_cluster.go.erb +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster.go.erb @@ -1127,12 +1127,11 @@ func ResourceContainerCluster() *schema.Resource { Schema: map[string]*schema.Schema{ "enable_components": { Type: schema.TypeList, + Optional: true, + Computed: true, <% if version == "ga" -%> - Required: true, Description: `GKE components exposing metrics. Valid values include SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, and SCHEDULER.`, <% else -%> - Optional: true, - Computed: true, Description: `GKE components exposing metrics. Valid values include SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, SCHEDULER, and WORKLOADS.`, <% end -%> Elem: &schema.Schema{ diff --git a/mmv1/third_party/terraform/services/container/resource_container_node_pool.go.erb b/mmv1/third_party/terraform/services/container/resource_container_node_pool.go.erb index 4f473ee28778..92d26e90ce66 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_node_pool.go.erb +++ b/mmv1/third_party/terraform/services/container/resource_container_node_pool.go.erb @@ -191,6 +191,13 @@ var schemaNodePool = map[string]*schema.Schema{ Required: true, Description: `Type defines the type of placement policy`, }, +<% unless version == 'ga' -%> + "tpu_topology": { + Type: schema.TypeString, + Optional: true, + Description: `TPU placement topology for pod slice node pool. https://cloud.google.com/tpu/docs/types-topologies#tpu_topologies`, + }, +<% end -%> }, }, }, @@ -877,6 +884,9 @@ func expandNodePool(d *schema.ResourceData, prefix string) (*container.NodePool, placement_policy := v.([]interface{})[0].(map[string]interface{}) np.PlacementPolicy = &container.PlacementPolicy{ Type: placement_policy["type"].(string), +<% unless version == 'ga' -%> + TpuTopology: placement_policy["tpu_topology"].(string), +<% end -%> } } } @@ -1068,6 +1078,9 @@ func flattenNodePool(d *schema.ResourceData, config *transport_tpg.Config, np *c nodePool["placement_policy"] = []map[string]interface{}{ { "type": np.PlacementPolicy.Type, +<% unless version == 'ga' -%> + "tpu_topology": np.PlacementPolicy.TpuTopology, +<% end -%> }, } } diff --git a/mmv1/third_party/terraform/services/networksecurity/network_security_address_group_operation.go.erb b/mmv1/third_party/terraform/services/networksecurity/network_security_address_group_operation.go.erb index 3c9a27568db8..2f98e9be1803 100644 --- a/mmv1/third_party/terraform/services/networksecurity/network_security_address_group_operation.go.erb +++ b/mmv1/third_party/terraform/services/networksecurity/network_security_address_group_operation.go.erb @@ -1,6 +1,5 @@ <% autogen_exception -%> package networksecurity -<% unless version == 'ga' -%> import ( "time" @@ -13,4 +12,3 @@ func NetworkSecurityAddressGroupOperationWaitTime(config *transport_tpg.Config, // project is not necessary for this operation. return NetworkSecurityOperationWaitTime(config, op, "", activity, userAgent, timeout) } -<% end -%> diff --git a/mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.erb b/mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.erb index c2dd85ca7405..24b5485e9b7d 100644 --- a/mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.erb +++ b/mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.erb @@ -157,6 +157,12 @@ func ResourceSqlDatabaseInstance() *schema.Resource { Required: true, Description: `The machine type to use. See tiers for more details and supported versions. Postgres supports only shared-core machine types, and custom machine types such as db-custom-2-13312. See the Custom Machine Type Documentation to learn about specifying custom machine types.`, }, + "edition": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{"ENTERPRISE", "ENTERPRISE_PLUS"}, false), + Description: `The edition of the instance, can be ENTERPRISE or ENTERPRISE_PLUS.`, + }, "advanced_machine_features": { Type: schema.TypeList, Optional: true, @@ -171,6 +177,22 @@ func ResourceSqlDatabaseInstance() *schema.Resource { }, }, }, + "data_cache_config": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Description: `Data cache configurations.`, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "data_cache_enabled": { + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: `Whether data cache is enabled for the instance.`, + }, + }, + }, + }, "activation_policy": { Type: schema.TypeString, Optional: true, @@ -1186,7 +1208,9 @@ func expandSqlDatabaseInstanceSettings(configured []interface{}, databaseVersion settings := &sqladmin.Settings{ // Version is unset in Create but is set during update SettingsVersion: int64(_settings["version"].(int)), + DataCacheConfig: expandDataCacheConfig(_settings["data_cache_config"].([]interface{})), Tier: _settings["tier"].(string), + Edition: _settings["edition"].(string), AdvancedMachineFeatures: expandSqlServerAdvancedMachineFeatures(_settings["advanced_machine_features"].([]interface{})), ForceSendFields: []string{"StorageAutoResize"}, ActivationPolicy: _settings["activation_policy"].(string), @@ -1345,6 +1369,17 @@ func expandDatabaseFlags(configured []interface{}) []*sqladmin.DatabaseFlags { return databaseFlags } +func expandDataCacheConfig(configured interface{}) *sqladmin.DataCacheConfig { + l := configured.([]interface{}) + if len(l) == 0 { + return nil + } + config := l[0].(map[string]interface{}) + return &sqladmin.DataCacheConfig{ + DataCacheEnabled: config["data_cache_enabled"].(bool), + } +} + func expandBackupConfiguration(configured []interface{}) *sqladmin.BackupConfiguration { if len(configured) == 0 || configured[0] == nil { return nil @@ -1907,6 +1942,7 @@ func flattenSettings(settings *sqladmin.Settings) []map[string]interface{} { data := map[string]interface{}{ "version": settings.SettingsVersion, "tier": settings.Tier, + "edition": settings.Edition, "activation_policy": settings.ActivationPolicy, "availability_type": settings.AvailabilityType, "collation": settings.Collation, @@ -1967,6 +2003,10 @@ func flattenSettings(settings *sqladmin.Settings) []map[string]interface{} { data["password_validation_policy"] = flattenPasswordValidationPolicy(settings.PasswordValidationPolicy) } + if settings.DataCacheConfig != nil { + data["data_cache_config"] = flattenDataCacheConfig(settings.DataCacheConfig) + } + if settings.AdvancedMachineFeatures != nil { data["advanced_machine_features"] = flattenSqlServerAdvancedMachineFeatures(settings.AdvancedMachineFeatures) } @@ -1974,6 +2014,17 @@ func flattenSettings(settings *sqladmin.Settings) []map[string]interface{} { return []map[string]interface{}{data} } +func flattenDataCacheConfig(d *sqladmin.DataCacheConfig) []map[string]interface{} { + if d == nil { + return nil + } + return []map[string]interface{}{ + { + "data_cache_enabled": d.DataCacheEnabled, + }, + } +} + func flattenBackupConfiguration(backupConfiguration *sqladmin.BackupConfiguration) []map[string]interface{} { data := map[string]interface{}{ "binary_log_enabled": backupConfiguration.BinaryLogEnabled, diff --git a/mmv1/third_party/terraform/tests/resource_big_query_dataset_test.go b/mmv1/third_party/terraform/tests/resource_big_query_dataset_test.go index 466e5e6de6c4..0c3ed02f1af1 100644 --- a/mmv1/third_party/terraform/tests/resource_big_query_dataset_test.go +++ b/mmv1/third_party/terraform/tests/resource_big_query_dataset_test.go @@ -167,6 +167,28 @@ func TestAccBigQueryDataset_cmek(t *testing.T) { }) } +func TestAccBigQueryDataset_storageBillModel(t *testing.T) { + t.Parallel() + + datasetID := fmt.Sprintf("tf_test_%s", RandString(t, 10)) + + VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckBigQueryDatasetDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccBigQueryDatasetStorageBillingModel(datasetID), + }, + { + ResourceName: "google_bigquery_dataset.test", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAddTable(t *testing.T, datasetID string, tableID string) resource.TestCheckFunc { // Not actually a check, but adds a table independently of terraform return func(s *terraform.State) error { @@ -389,3 +411,22 @@ resource "google_bigquery_dataset" "test" { } `, pid, datasetID, kmsKey) } + +func testAccBigQueryDatasetStorageBillingModel(datasetID string) string { + return fmt.Sprintf(` +resource "google_bigquery_dataset" "test" { + dataset_id = "%s" + friendly_name = "foo" + description = "This is a foo description" + location = "EU" + default_partition_expiration_ms = 3600000 + default_table_expiration_ms = 3600000 + storage_billing_model = "PHYSICAL" + + labels = { + env = "foo" + default_table_expiration_ms = 3600000 + } +} +`, datasetID) +} diff --git a/mmv1/third_party/terraform/tests/resource_compute_external_vpn_gateway_test.go b/mmv1/third_party/terraform/tests/resource_compute_external_vpn_gateway_test.go new file mode 100644 index 000000000000..675e568fc6a7 --- /dev/null +++ b/mmv1/third_party/terraform/tests/resource_compute_external_vpn_gateway_test.go @@ -0,0 +1,65 @@ +package google + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" +) + +func TestAccComputeExternalVPNGateway_updateLabels(t *testing.T) { + t.Parallel() + + rnd := acctest.RandString(t, 10) + resourceName := "google_compute_external_vpn_gateway.external_gateway" + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Steps: []resource.TestStep{ + { + Config: testAccComputeExternalVPNGateway_updateLabels(rnd, "test", "test"), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "labels.%", "1"), + resource.TestCheckResourceAttr(resourceName, "labels.test", "test"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccComputeExternalVPNGateway_updateLabels(rnd, "test-updated", "test-updated"), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "labels.%", "1"), + resource.TestCheckResourceAttr(resourceName, "labels.test-updated", "test-updated"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccComputeExternalVPNGateway_updateLabels(suffix, key, value string) string { + return fmt.Sprintf(` +resource "google_compute_external_vpn_gateway" "external_gateway" { + name = "tf-test-external-gateway-%s" + redundancy_type = "SINGLE_IP_INTERNALLY_REDUNDANT" + description = "An externally managed VPN gateway" + interface { + id = 0 + ip_address = "8.8.8.8" + } + + labels = { + %s = "%s" + } +} +`, suffix, key, value) +} diff --git a/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_rule_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_rule_test.go.erb index 8c2daa357d25..0682692a9a6d 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_rule_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_firewall_policy_rule_test.go.erb @@ -97,7 +97,6 @@ resource "google_compute_firewall_policy" "default" { description = "Resource created for Terraform acceptance testing" } -<% if version != "ga" -%> resource "google_network_security_address_group" "basic_global_networksecurity_address_group" { name = "tf-test-policy%{random_suffix}" parent = "%{org_name}" @@ -107,7 +106,6 @@ resource "google_network_security_address_group" "basic_global_networksecurity_a type = "IPV4" capacity = 100 } -<% end -%> resource "google_compute_firewall_policy_rule" "default" { firewall_policy = google_compute_firewall_policy.default.id @@ -126,9 +124,7 @@ resource "google_compute_firewall_policy_rule" "default" { dest_fqdns = [] dest_region_codes = [] dest_threat_intelligences = [] -<% if version != "ga" -%> dest_address_groups = [google_network_security_address_group.basic_global_networksecurity_address_group.id] -<% end -%> } } `, context) @@ -165,7 +161,6 @@ resource "google_compute_firewall_policy" "default" { description = "Resource created for Terraform acceptance testing" } -<% if version != "ga" -%> resource "google_network_security_address_group" "basic_global_networksecurity_address_group" { name = "tf-test-policy%{random_suffix}" parent = "%{org_name}" @@ -175,7 +170,6 @@ resource "google_network_security_address_group" "basic_global_networksecurity_a type = "IPV4" capacity = 100 } -<% end -%> resource "google_compute_firewall_policy_rule" "default" { firewall_policy = google_compute_firewall_policy.default.id @@ -199,9 +193,7 @@ resource "google_compute_firewall_policy_rule" "default" { dest_region_codes = ["US"] dest_threat_intelligences = ["iplist-known-malicious-ips"] src_address_groups = [] -<% if version != "ga" -%> dest_address_groups = [google_network_security_address_group.basic_global_networksecurity_address_group.id] -<% end -%> } target_resources = [google_compute_network.network1.self_link, google_compute_network.network2.self_link] target_service_accounts = [google_service_account.service_account.email] @@ -240,7 +232,6 @@ resource "google_compute_firewall_policy" "default" { description = "Resource created for Terraform acceptance testing" } -<% if version != "ga" -%> resource "google_network_security_address_group" "basic_global_networksecurity_address_group" { name = "tf-test-policy%{random_suffix}" parent = "%{org_name}" @@ -250,7 +241,6 @@ resource "google_network_security_address_group" "basic_global_networksecurity_a type = "IPV4" capacity = 100 } -<% end -%> resource "google_compute_firewall_policy_rule" "default" { firewall_policy = google_compute_firewall_policy.default.id @@ -335,7 +325,6 @@ resource "google_compute_firewall_policy" "default" { description = "Resource created for Terraform acceptance testing" } -<% if version != "ga" -%> resource "google_network_security_address_group" "basic_global_networksecurity_address_group" { name = "tf-test-policy%{random_suffix}" parent = "%{org_name}" @@ -345,7 +334,6 @@ resource "google_network_security_address_group" "basic_global_networksecurity_a type = "IPV4" capacity = 100 } -<% end -%> resource "google_compute_firewall_policy_rule" "rule1" { firewall_policy = google_compute_firewall_policy.default.id @@ -364,9 +352,7 @@ resource "google_compute_firewall_policy_rule" "rule1" { dest_fqdns = ["google.com"] dest_region_codes = ["US"] dest_threat_intelligences = ["iplist-known-malicious-ips"] -<% if version != "ga" -%> dest_address_groups = [google_network_security_address_group.basic_global_networksecurity_address_group.id] -<% end -%> } } @@ -390,9 +376,7 @@ resource "google_compute_firewall_policy_rule" "rule2" { src_fqdns = ["google.com"] src_region_codes = ["US"] src_threat_intelligences = ["iplist-known-malicious-ips"] -<% if version != "ga" -%> src_address_groups = [google_network_security_address_group.basic_global_networksecurity_address_group.id] -<% end -%> } } `, context) @@ -411,7 +395,6 @@ resource "google_compute_firewall_policy" "default" { description = "Description Update" } -<% if version != "ga" -%> resource "google_network_security_address_group" "basic_global_networksecurity_address_group" { name = "tf-test-policy%{random_suffix}" parent = "%{org_name}" @@ -421,7 +404,6 @@ resource "google_network_security_address_group" "basic_global_networksecurity_a type = "IPV4" capacity = 100 } -<% end -%> resource "google_compute_firewall_policy_rule" "rule1" { firewall_policy = google_compute_firewall_policy.default.id @@ -439,9 +421,7 @@ resource "google_compute_firewall_policy_rule" "rule1" { dest_fqdns = ["google.com"] dest_region_codes = ["US"] dest_threat_intelligences = ["iplist-known-malicious-ips"] -<% if version != "ga" -%> dest_address_groups = [google_network_security_address_group.basic_global_networksecurity_address_group.id] -<% end -%> } } @@ -465,9 +445,7 @@ resource "google_compute_firewall_policy_rule" "rule2" { src_fqdns = ["google.com"] src_region_codes = ["US"] src_threat_intelligences = ["iplist-known-malicious-ips"] -<% if version != "ga" -%> src_address_groups = [google_network_security_address_group.basic_global_networksecurity_address_group.id] -<% end -%> } } @@ -488,9 +466,7 @@ resource "google_compute_firewall_policy_rule" "rule3" { src_fqdns = ["google.com"] src_region_codes = ["US"] src_threat_intelligences = ["iplist-known-malicious-ips"] -<% if version != "ga" -%> src_address_groups = [google_network_security_address_group.basic_global_networksecurity_address_group.id] -<% end -%> } } `, context) @@ -509,7 +485,6 @@ resource "google_compute_firewall_policy" "default" { description = "Resource created for Terraform acceptance testing" } -<% if version != "ga" -%> resource "google_network_security_address_group" "basic_global_networksecurity_address_group" { name = "tf-test-policy%{random_suffix}" parent = "%{org_name}" @@ -519,7 +494,6 @@ resource "google_network_security_address_group" "basic_global_networksecurity_a type = "IPV4" capacity = 100 } -<% end -%> resource "google_compute_firewall_policy_rule" "rule1" { firewall_policy = google_compute_firewall_policy.default.id diff --git a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb b/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb index 36aa886a4066..3ed25346a93e 100644 --- a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb @@ -2693,6 +2693,15 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"min_master_version"}, }, + { + Config: testAccContainerCluster_withMonitoringConfigPrometheusOnly2(clusterName), + }, + { + ResourceName: "google_container_cluster.primary", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"min_master_version"}, + }, { Config: testAccContainerCluster_basic(clusterName), }, @@ -7451,6 +7460,20 @@ resource "google_container_cluster" "primary" { `, name) } +func testAccContainerCluster_withMonitoringConfigPrometheusOnly2(name string) string { + return fmt.Sprintf(` +resource "google_container_cluster" "primary" { + name = "%s" + location = "us-central1-a" + initial_node_count = 1 + monitoring_config { + managed_prometheus { + enabled = true + } + } +} +`, name) +} func testAccContainerCluster_withSoleTenantGroup(name string) string { return fmt.Sprintf(` diff --git a/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb b/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb index 508e06da0f77..f8c51ab791f3 100644 --- a/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_container_node_pool_test.go.erb @@ -3076,3 +3076,74 @@ resource "google_container_node_pool" "with_sole_tenant_config" { } `, cluster, np) } + +<% unless version == 'ga' -%> +func TestAccContainerNodePool_tpuTopology(t *testing.T) { + t.Parallel() + acctest.SkipIfVcr(t) + + cluster := fmt.Sprintf("tf-test-cluster-%s", RandString(t, 10)) + np1 := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + np2 := fmt.Sprintf("tf-test-nodepool-%s", RandString(t, 10)) + + VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckContainerNodePoolDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccContainerNodePool_tpuTopology(cluster, np1, np2, "2x2x2"), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("google_container_node_pool.regular_pool", "node_config.0.machine_type", "n1-standard-4"), + resource.TestCheckResourceAttr("google_container_node_pool.with_tpu_topology", "node_config.0.machine_type", "ct4p-hightpu-4t"), + resource.TestCheckResourceAttr("google_container_node_pool.with_tpu_topology", "placement_policy.0.tpu_topology", "2x2x2"), + resource.TestCheckResourceAttr("google_container_node_pool.with_tpu_topology", "placement_policy.0.type", "COMPACT"), + ), + }, + { + ResourceName: "google_container_node_pool.with_tpu_topology", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccContainerNodePool_tpuTopology(cluster, np1, np2, tpuTopology string) string { + return fmt.Sprintf(` +resource "google_container_cluster" "cluster" { + name = "%s" + location = "us-central2-b" + initial_node_count = 1 +} + +resource "google_container_node_pool" "regular_pool" { + name = "%s" + location = "us-central2-b" + cluster = google_container_cluster.cluster.name + initial_node_count = 1 + + node_config { + machine_type = "n1-standard-4" + + } + } + +resource "google_container_node_pool" "with_tpu_topology" { + name = "%s" + location = "us-central2-b" + cluster = google_container_cluster.cluster.name + initial_node_count = 2 + + node_config { + machine_type = "ct4p-hightpu-4t" + + } + placement_policy { + type = "COMPACT" + tpu_topology = "%s" + } +} +`, cluster, np1, np2, tpuTopology) +} +<% end -%> \ No newline at end of file diff --git a/mmv1/third_party/terraform/tests/resource_firebase_project_test.go.erb b/mmv1/third_party/terraform/tests/resource_firebase_project_test.go.erb index bd73c4c773fc..cd400d7de56a 100644 --- a/mmv1/third_party/terraform/tests/resource_firebase_project_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_firebase_project_test.go.erb @@ -45,8 +45,8 @@ func testAccFirebaseProject_firebaseProjectBasicExampleDestroyed(context map[str resource "google_project" "default" { provider = google-beta - project_id = "tf-test%{random_suffix}" - name = "tf-test%{random_suffix}" + project_id = "tf-test-my-project%{random_suffix}" + name = "tf-test-my-project%{random_suffix}" org_id = "%{org_id}" labels = { diff --git a/mmv1/third_party/terraform/tests/resource_network_security_address_groups_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_security_address_groups_test.go similarity index 78% rename from mmv1/third_party/terraform/tests/resource_network_security_address_groups_test.go.erb rename to mmv1/third_party/terraform/tests/resource_network_security_address_groups_test.go index 2594a163324a..492d320dd0f1 100644 --- a/mmv1/third_party/terraform/tests/resource_network_security_address_groups_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_security_address_groups_test.go @@ -1,25 +1,24 @@ -<% autogen_exception -%> package google -<% unless version == 'ga' -%> import ( "fmt" - "github.com/hashicorp/terraform-provider-google/google/acctest" "testing" + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccNetworkSecurityAddressGroups_update(t *testing.T){ - t.Parallel() +func TestAccNetworkSecurityAddressGroups_update(t *testing.T) { + t.Parallel() - addressGroupsName := fmt.Sprintf("tf-test-address-group-%s", acctest.RandString(t, 10)) + addressGroupsName := fmt.Sprintf("tf-test-address-group-%s", acctest.RandString(t, 10)) projectName := GetTestProjectFromEnv() - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckNetworkSecurityAddressGroupDestroyProducer(t), + CheckDestroy: testAccCheckNetworkSecurityAddressGroupDestroyProducer(t), Steps: []resource.TestStep{ { Config: testAccNetworkSecurityAddressGroups_basic(addressGroupsName, projectName), @@ -42,7 +41,7 @@ func TestAccNetworkSecurityAddressGroups_update(t *testing.T){ } func testAccNetworkSecurityAddressGroups_basic(addressGroupsName, projectName string) string { - return fmt.Sprintf(` + return fmt.Sprintf(` resource "google_network_security_address_group" "foobar" { name = "%s" parent = "projects/%s" @@ -59,7 +58,7 @@ resource "google_network_security_address_group" "foobar" { } func testAccNetworkSecurityAddressGroups_update(addressGroupsName, projectName string) string { - return fmt.Sprintf(` + return fmt.Sprintf(` resource "google_network_security_address_group" "foobar" { name = "%s" parent = "projects/%s" @@ -74,5 +73,3 @@ resource "google_network_security_address_group" "foobar" { } `, addressGroupsName, projectName) } - -<% end -%> \ No newline at end of file diff --git a/mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_rule_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_rule_test.go similarity index 94% rename from mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_rule_test.go.erb rename to mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_rule_test.go index 45252ea227f5..5872603ec406 100644 --- a/mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_rule_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_rule_test.go @@ -1,6 +1,4 @@ -<% autogen_exception -%> package google -<% unless version == 'ga' -%> import ( "fmt" @@ -17,9 +15,9 @@ func TestAccNetworkSecurityGatewaySecurityPolicyRule_update(t *testing.T) { gatewaySecurityPolicyRuleName := fmt.Sprintf("tf-test-gateway-sp-rule-%s", acctest.RandString(t, 10)) acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, + PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckNetworkSecurityGatewaySecurityPolicyRuleDestroyProducer(t), + CheckDestroy: testAccCheckNetworkSecurityGatewaySecurityPolicyRuleDestroyProducer(t), Steps: []resource.TestStep{ { Config: testAccNetworkSecurityGatewaySecurityPolicyRule_basic(gatewaySecurityPolicyName, gatewaySecurityPolicyRuleName), @@ -93,5 +91,3 @@ resource "google_network_security_gateway_security_policy_rule" "foobar" { } `, gatewaySecurityPolicyName, gatewaySecurityPolicyRuleName) } - -<% end -%> diff --git a/mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_test.go similarity index 88% rename from mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_test.go.erb rename to mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_test.go index dd5e388ad124..431a3007988c 100644 --- a/mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_security_gateway_security_policies_test.go @@ -1,6 +1,4 @@ -<% autogen_exception -%> package google -<% unless version == 'ga' -%> import ( "fmt" @@ -16,9 +14,9 @@ func TestAccNetworkSecurityGatewaySecurityPolicy_update(t *testing.T) { gatewaySecurityPolicyName := fmt.Sprintf("tf-test-gateway-sp-%s", acctest.RandString(t, 10)) acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, + PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckNetworkSecurityGatewaySecurityPolicyDestroyProducer(t), + CheckDestroy: testAccCheckNetworkSecurityGatewaySecurityPolicyDestroyProducer(t), Steps: []resource.TestStep{ { Config: testAccNetworkSecurityGatewaySecurityPolicy_basic(gatewaySecurityPolicyName), @@ -59,5 +57,3 @@ resource "google_network_security_gateway_security_policy" "foobar" { } `, gatewaySecurityPolicyName) } - -<% end -%> diff --git a/mmv1/third_party/terraform/tests/resource_network_security_url_lists_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_security_url_lists_test.go similarity index 74% rename from mmv1/third_party/terraform/tests/resource_network_security_url_lists_test.go.erb rename to mmv1/third_party/terraform/tests/resource_network_security_url_lists_test.go index 011e878fb6c9..be0738a66b04 100644 --- a/mmv1/third_party/terraform/tests/resource_network_security_url_lists_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_security_url_lists_test.go @@ -1,6 +1,4 @@ -<% autogen_exception -%> package google -<% unless version == 'ga' -%> import ( "fmt" @@ -10,15 +8,15 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) -func TestAccNetworkSecurityUrlLists_update(t *testing.T){ - t.Parallel() +func TestAccNetworkSecurityUrlLists_update(t *testing.T) { + t.Parallel() - urlListsName := fmt.Sprintf("tf-test-url-lists-%s", acctest.RandString(t, 10)) + urlListsName := fmt.Sprintf("tf-test-url-lists-%s", acctest.RandString(t, 10)) - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckNetworkSecurityUrlListsDestroyProducer(t), + CheckDestroy: testAccCheckNetworkSecurityUrlListsDestroyProducer(t), Steps: []resource.TestStep{ { Config: testAccNetworkSecurityUrlLists_basic(urlListsName), @@ -41,7 +39,7 @@ func TestAccNetworkSecurityUrlLists_update(t *testing.T){ } func testAccNetworkSecurityUrlLists_basic(urlListsName string) string { - return fmt.Sprintf(` + return fmt.Sprintf(` resource "google_network_security_url_lists" "foobar" { name = "%s" location = "us-central1" @@ -51,7 +49,7 @@ resource "google_network_security_url_lists" "foobar" { } func testAccNetworkSecurityUrlLists_update(urlListsName string) string { - return fmt.Sprintf(` + return fmt.Sprintf(` resource "google_network_security_url_lists" "foobar" { name = "%s" location = "us-central1" @@ -60,5 +58,3 @@ resource "google_network_security_url_lists" "foobar" { } `, urlListsName) } - -<% end -%> \ No newline at end of file diff --git a/mmv1/third_party/terraform/tests/resource_network_services_gateway_test.go.erb b/mmv1/third_party/terraform/tests/resource_network_services_gateway_test.go similarity index 98% rename from mmv1/third_party/terraform/tests/resource_network_services_gateway_test.go.erb rename to mmv1/third_party/terraform/tests/resource_network_services_gateway_test.go index ef460ed39f06..d9daf50b3a4f 100644 --- a/mmv1/third_party/terraform/tests/resource_network_services_gateway_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_network_services_gateway_test.go @@ -1,6 +1,4 @@ -<% autogen_exception -%> package google -<% unless version == 'ga' -%> import ( "fmt" @@ -16,9 +14,9 @@ func TestAccNetworkServicesGateway_update(t *testing.T) { gatewayName := fmt.Sprintf("tf-test-gateway-%s", acctest.RandString(t, 10)) acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, + PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckNetworkServicesGatewayDestroyProducer(t), + CheckDestroy: testAccCheckNetworkServicesGatewayDestroyProducer(t), Steps: []resource.TestStep{ { Config: testAccNetworkServicesGateway_basic(gatewayName), @@ -153,12 +151,12 @@ resource "google_network_services_gateway" "foobar" { // name = "%s" // location = "us-east1" // gateway_security_policy = google_network_security_gateway_security_policy.default.name -// enabled = true +// enabled = true // priority = 1 // session_matcher = "host() == 'example.com'" // basic_profile = "ALLOW" //} -// +// //resource "google_network_services_gateway" "foobar" { // name = "%s" // location = "us-east1" @@ -231,7 +229,7 @@ resource "google_network_services_gateway" "foobar" { // name = "%s" // location = "us-east1" // gateway_security_policy = google_network_security_gateway_security_policy.default.name -// enabled = true +// enabled = true // priority = 1 // session_matcher = "host() == 'example.com'" // basic_profile = "ALLOW" @@ -247,12 +245,12 @@ resource "google_network_services_gateway" "foobar" { //# name = "%s" //# location = "us-east1" //# gateway_security_policy = google_network_security_gateway_security_policy.newpolicy.name -//# enabled = true +//# enabled = true //# priority = 1 //# session_matcher = "host() == 'example.com'" //# basic_profile = "ALLOW" //# } -// +// //resource "google_network_services_gateway" "foobar" { // name = "%s" // location = "us-east1" @@ -733,5 +731,3 @@ resource "google_compute_subnetwork" "proxyonlysubnet2" { `, cmName, netName, subnetName, pSubnetName, policyName, ruleName, gatewayName, gatewayScope, net2Name, subnet2Name, pSubnet2Name) } - -<% end -%> \ No newline at end of file diff --git a/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go b/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go index 48c9b46d9440..2e0941754f01 100644 --- a/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go +++ b/mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go @@ -1308,6 +1308,60 @@ func TestAccSQLDatabaseInstance_DenyMaintenancePeriod(t *testing.T) { }) } +func TestAccSqlDatabaseInstance_Edition(t *testing.T) { + t.Parallel() + enterprisePlusName := "tf-test-enterprise-plus" + acctest.RandString(t, 10) + enterprisePlusTier := "db-perf-optimized-N-2" + enterpriseName := "tf-test-enterprise-" + acctest.RandString(t, 10) + enterpriseTier := "db-custom-2-13312" + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testGoogleSqlDatabaseInstance_EditionConfig(enterprisePlusName, enterprisePlusTier, "ENTERPRISE_PLUS"), + }, + { + ResourceName: "google_sql_database_instance.instance", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"deletion_protection"}, + }, + { + Config: testGoogleSqlDatabaseInstance_EditionConfig(enterpriseName, enterpriseTier, "ENTERPRISE"), + }, + { + ResourceName: "google_sql_database_instance.instance", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"deletion_protection"}, + }, + }, + }) +} + +func TestAccSQLDatabaseInstance_sqlMysqlDataCacheConfig(t *testing.T) { + t.Parallel() + instanceName := "tf-test-enterprise-plus" + acctest.RandString(t, 10) + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testGoogleSqlDatabaseInstance_sqlMysqlDataCacheConfig(instanceName), + }, + { + ResourceName: "google_sql_database_instance.instance", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"deletion_protection"}, + }, + }, + }) +} + func TestAccSqlDatabaseInstance_SqlServerAuditConfig(t *testing.T) { // Service Networking acctest.SkipIfVcr(t) @@ -1968,6 +2022,39 @@ resource "google_sql_database_instance" "instance" { }`, databaseName, endDate, startDate, time) } +func testGoogleSqlDatabaseInstance_EditionConfig(databaseName, tier, edition string) string { + return fmt.Sprintf(` + +resource "google_sql_database_instance" "instance" { + name = "%s" + region = "us-east1" + database_version = "POSTGRES_14" + deletion_protection = false + settings { + tier = "%s" + edition = "%s" + } +}`, databaseName, tier, edition) +} + +func testGoogleSqlDatabaseInstance_sqlMysqlDataCacheConfig(instanceName string) string { + return fmt.Sprintf(` + +resource "google_sql_database_instance" "instance" { + name = "%s" + region = "us-east1" + database_version = "MYSQL_8_0_31" + deletion_protection = false + settings { + tier = "db-perf-optimized-N-2" + edition = "ENTERPRISE_PLUS" + data_cache_config { + data_cache_enabled = true + } + } +}`, instanceName) +} + func testGoogleSqlDatabaseInstance_SqlServerAuditConfig(databaseName, rootPassword, bucketName, uploadInterval, retentionInterval string) string { return fmt.Sprintf(` resource "google_storage_bucket" "gs-bucket" { diff --git a/mmv1/third_party/terraform/tests/resource_vertex_ai_index_test.go b/mmv1/third_party/terraform/tests/resource_vertex_ai_index_test.go index b896ff0fe563..e737d6d5a75b 100644 --- a/mmv1/third_party/terraform/tests/resource_vertex_ai_index_test.go +++ b/mmv1/third_party/terraform/tests/resource_vertex_ai_index_test.go @@ -89,6 +89,7 @@ resource "google_vertex_ai_index" "index" { config { dimensions = 2 approximate_neighbors_count = 150 + shard_size = "SHARD_SIZE_SMALL" distance_measure_type = "DOT_PRODUCT_DISTANCE" algorithm_config { tree_ah_config { @@ -145,6 +146,7 @@ resource "google_vertex_ai_index" "index" { config { dimensions = 2 approximate_neighbors_count = 150 + shard_size = "SHARD_SIZE_SMALL" distance_measure_type = "DOT_PRODUCT_DISTANCE" algorithm_config { tree_ah_config { diff --git a/mmv1/third_party/terraform/utils/network_security_address_group_operation.go.erb b/mmv1/third_party/terraform/utils/network_security_address_group_operation.go.erb index aa4b6aef5e9b..944bd6e5ecea 100644 --- a/mmv1/third_party/terraform/utils/network_security_address_group_operation.go.erb +++ b/mmv1/third_party/terraform/utils/network_security_address_group_operation.go.erb @@ -1,6 +1,5 @@ <% autogen_exception -%> package google -<% unless version == 'ga' -%> import ( "time" @@ -14,4 +13,3 @@ func NetworkSecurityAddressGroupOperationWaitTime(config *transport_tpg.Config, // project is not necessary for this operation. return networksecurity.NetworkSecurityAddressGroupOperationWaitTime(config, op, activity, userAgent, timeout) } -<% end -%> diff --git a/mmv1/third_party/terraform/website/docs/r/container_node_pool.html.markdown b/mmv1/third_party/terraform/website/docs/r/container_node_pool.html.markdown index 9456e67efb58..96f15535e856 100644 --- a/mmv1/third_party/terraform/website/docs/r/container_node_pool.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/container_node_pool.html.markdown @@ -241,6 +241,8 @@ cluster. Specifying COMPACT placement policy type places node pool's nodes in a closer physical proximity in order to reduce network latency between nodes. +* `tpu_topology` - (Optional, Beta) The [TPU placement topology](https://cloud.google.com/tpu/docs/types-topologies#tpu_topologies) for pod slice node pool. + ## Attributes Reference In addition to the arguments listed above, the following computed attributes are exported: diff --git a/mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown b/mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown index 97da2dd5ddc7..4ba8f5b721ce 100644 --- a/mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown @@ -157,6 +157,22 @@ provider "google-beta" { } ``` +### ENTERPRISE_PLUS Instance with data_cache_config + +```hcl +resource "google_sql_database_instance" "main" { + name = "enterprise-plus-main-instance" + database_version = "MYSQL_8_0_31" + settings { + tier = "db-perf-optimized-N-2" + edition = "ENTERPRISE_PLUS" + data_cache_config { + data_cache_enabled = true + } + } +} +``` + ## Argument Reference The following arguments are supported: @@ -228,6 +244,8 @@ The `settings` block supports: for more details and supported versions. Postgres supports only shared-core machine types, and custom machine types such as `db-custom-2-13312`. See the [Custom Machine Type Documentation](https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type#create) to learn about specifying custom machine types. +* `edition` - (Optional) The edition of the instance, can be `ENTERPRISE` or `ENTERPRISE_PLUS`. + The optional `settings.advanced_machine_features` subblock supports: * `threads_per_core` - (Optional) The number of threads per core. The value of this flag can be 1 or 2. To disable SMT, set this flag to 1. Only available in Cloud SQL for SQL Server instances. See [smt](https://cloud.google.com/sql/docs/sqlserver/create-instance#smt-create-instance) for more details. @@ -273,6 +291,11 @@ The optional `settings.active_directory_config` subblock supports: * `domain` - (Required) The domain name for the active directory (e.g., mydomain.com). Can only be used with SQL Server. +The optional `settings.data_cache_config` subblock supports: + +* `data_cache_enabled` - (Optional) Whether data cache is enabled for the instance. Defaults to `false` + Can only be used with MYSQL. + The optional `settings.deny_maintenance_period` subblock supports: * `end_date` - (Required) "deny maintenance period" end date. If the year of the end date is empty, the year of the start date also must be empty. In this case, it means the no maintenance interval recurs every year. The date is in format yyyy-mm-dd i.e., 2020-11-01, or mm-dd, i.e., 11-01 diff --git a/tools/issue-labeler/enrolled_teams.yaml b/tools/issue-labeler/enrolled_teams.yaml index 88bb6997b58a..e29ef4565eca 100755 --- a/tools/issue-labeler/enrolled_teams.yaml +++ b/tools/issue-labeler/enrolled_teams.yaml @@ -14,6 +14,13 @@ services/bigquery: - google_bigquery_ services/bigtableadmin: - google_bigtable_ +services/billingbudgets: +- google_billing_budget +services/certificatemanager: +- google_certificate_manager_ +services/cloudbilling: +- google_billing_account +- google_billing_subaccount services/cloudbuild: - google_cloudbuild_ - google_cloudbuildv2_ @@ -30,6 +37,13 @@ services/composer: - google_composer_ services/compute-nat: - google_compute_router_nat +services/compute-regional-l7-load-balancer: +- google_compute_region_target_http_proxy +- google_compute_region_target_https_proxy +services/container: +- google_container_cluster +- google_container_engine_versions +- google_container_node_pool services/dataproc: - google_dataproc_cluster - google_dataproc_autoscaling_policy @@ -38,6 +52,8 @@ services/dataproc: - google_dataproc_batch services/dlp: - google_data_loss_prevention_ +services/edgenetwork: +- google_edgenetwork_ services/eventarc: - google_eventarc_ services/filestore: @@ -55,8 +71,14 @@ services/gkebackup: - google_gke_backup_ services/gkehub: - google_gke_hub_ +services/gkemulticloud: +- google_container_aws_ +- google_container_azure_ +- google_container_attached_ services/gkeonprem: - google_gkeonprem_ +services/healthcare: +- google_healthcare_ services/iam-core: - google_organization_iam_custom_role - google_project_iam_custom_role @@ -94,6 +116,10 @@ services/orgpolicy: - google_org_policy_ services/privateca: - google_privateca_ +services/pubsublite: +- google_pubsub_lite_ +services/redis-instance: +- google_redis_instance services/run: - google_cloud_run_ - google_cloud_run_v2_ diff --git a/tools/issue-labeler/labels.go b/tools/issue-labeler/labels.go index b15414c04494..912a8ffe320e 100644 --- a/tools/issue-labeler/labels.go +++ b/tools/issue-labeler/labels.go @@ -23,6 +23,7 @@ func labels(issueBody string, enrolledTeams map[string][]string) string { } if len(labels) > 0 { + labels = append(labels, "\"forward/review\"") sort.Strings(labels) return "[" + strings.Join(labels, ", ") + "]" } diff --git a/tools/issue-labeler/labels_test.go b/tools/issue-labeler/labels_test.go index 20481b1841c6..3e7ae98916eb 100644 --- a/tools/issue-labeler/labels_test.go +++ b/tools/issue-labeler/labels_test.go @@ -27,7 +27,7 @@ func TestLabels(t *testing.T) { google_gke_hub_feature google_storage_hmac_key #`, - expectedLabels: `["services/gkehub", "services/storage"]`, + expectedLabels: `["forward/review", "services/gkehub", "services/storage"]`, }, { issueBody: `### New or Affected Resource(s): diff --git a/tools/missing-test-detector/reader.go b/tools/missing-test-detector/reader.go index 7c37dcac9306..2846efe7b7a5 100644 --- a/tools/missing-test-detector/reader.go +++ b/tools/missing-test-detector/reader.go @@ -101,7 +101,9 @@ func readTestFunc(testFunc *ast.FuncDecl, funcDecls map[string]*ast.FuncDecl, va if exprStmt, ok := stmt.(*ast.ExprStmt); ok { if callExpr, ok := exprStmt.X.(*ast.CallExpr); ok { // This is a call expression. - if ident, ok := callExpr.Fun.(*ast.Ident); ok && ident.Name == "VcrTest" { + ident, isIdent := callExpr.Fun.(*ast.Ident) + selExpr, isSelExpr := callExpr.Fun.(*ast.SelectorExpr) + if isIdent && ident.Name == "VcrTest" || isSelExpr && selExpr.Sel.Name == "VcrTest" { return readVcrTestCall(callExpr, funcDecls, varDecls) } } diff --git a/tools/missing-test-detector/testdata/covered_resource_test.go b/tools/missing-test-detector/testdata/covered_resource_test.go index eff1b1ceee67..ab21e801bd57 100644 --- a/tools/missing-test-detector/testdata/covered_resource_test.go +++ b/tools/missing-test-detector/testdata/covered_resource_test.go @@ -5,10 +5,11 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google-beta/google-beta/acctest" ) func TestAccCoveredResource(t *testing.T) { - VcrTest(t, resource.TestCase{ + acctest.VcrTest(t, resource.TestCase{ Steps: []resource.TestStep{ { Config: testAccCoveredResource(), diff --git a/tools/missing-test-detector/testdata/multiple_resource_test.go b/tools/missing-test-detector/testdata/multiple_resource_test.go index a9e6fff7dd15..1a4c3eeb0a21 100644 --- a/tools/missing-test-detector/testdata/multiple_resource_test.go +++ b/tools/missing-test-detector/testdata/multiple_resource_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google-beta/google-beta/acctest" ) func TestAccMultipleResources(t *testing.T) { diff --git a/tools/missing-test-detector/testdata/uncovered_resource_test.go b/tools/missing-test-detector/testdata/uncovered_resource_test.go index 7bc0090d544d..feaa11ce27d7 100644 --- a/tools/missing-test-detector/testdata/uncovered_resource_test.go +++ b/tools/missing-test-detector/testdata/uncovered_resource_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google-beta/google-beta/acctest" ) func TestAccUncoveredResource(t *testing.T) { diff --git a/tpgtools/api/clouddeploy/samples/basic.delivery_pipeline.json b/tpgtools/api/clouddeploy/samples/basic.delivery_pipeline.json index 0d569904fbfd..ba6a8b6f7260 100644 --- a/tpgtools/api/clouddeploy/samples/basic.delivery_pipeline.json +++ b/tpgtools/api/clouddeploy/samples/basic.delivery_pipeline.json @@ -19,6 +19,16 @@ "profiles": [ "example-profile-one", "example-profile-two" + ], + "deployParameters": [ + { + "values": { + "deployParameterKey": "deployParameterValue" + }, + "match_target_labels": { + "my_first_label": "example-label-1" + } + } ] }, { diff --git a/tpgtools/api/clouddeploy/samples/basic.target.json b/tpgtools/api/clouddeploy/samples/basic.target.json index 0f32d945c923..d185d12184f6 100644 --- a/tpgtools/api/clouddeploy/samples/basic.target.json +++ b/tpgtools/api/clouddeploy/samples/basic.target.json @@ -15,5 +15,8 @@ "requireApproval": false, "gke": { "cluster": "projects/{{project}}/locations/{{region}}/clusters/example-cluster-name" + }, + "deployParameters": { + "deployParameterKey": "deployParameterValue" } } diff --git a/tpgtools/handwritten/orgpolicy_utils.go b/tpgtools/handwritten/orgpolicy_utils.go index 24e0d70283bf..2cf61cf67ad1 100644 --- a/tpgtools/handwritten/orgpolicy_utils.go +++ b/tpgtools/handwritten/orgpolicy_utils.go @@ -24,6 +24,11 @@ func ResourceOrgPolicyPolicyCustomImport(d *schema.ResourceData, meta interface{ if err != nil { return fmt.Errorf("Error constructing id: %s", err) } + + // reset name to match the one from resourceOrgPolicyPolicyRead + if err := d.Set("name", id); err != nil { + return fmt.Errorf("Error setting name: %s", err) + } d.SetId(id) return nil diff --git a/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule.tf.tmpl b/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule.tf.tmpl index a4a888d77273..e3176d43aee0 100644 --- a/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule.tf.tmpl +++ b/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule.tf.tmpl @@ -1,3 +1,13 @@ +resource "google_network_security_address_group" "basic_global_networksecurity_address_group" { + name = "{{policy}}" + parent = "organizations/{{org_id}}" + description = "Sample global networksecurity_address_group" + location = "global" + items = ["208.80.154.224/32"] + type = "IPV4" + capacity = 100 +} + resource "google_folder" "folder" { display_name = "{{policy}}" parent = "organizations/{{org_id}}" @@ -11,12 +21,12 @@ resource "google_compute_firewall_policy" "default" { resource "google_compute_firewall_policy_rule" "primary" { firewall_policy = google_compute_firewall_policy.default.name - description = "Resource created for Terraform acceptance testing" - priority = 9000 - enable_logging = true - action = "allow" - direction = "EGRESS" - disabled = false + description = "Resource created for Terraform acceptance testing" + priority = 9000 + enable_logging = true + action = "allow" + direction = "EGRESS" + disabled = false match { layer4_configs { ip_protocol = "tcp" @@ -28,8 +38,10 @@ resource "google_compute_firewall_policy_rule" "primary" { } dest_ip_ranges = ["11.100.0.1/32"] dest_fqdns = [] - dest_region_codes = [] + dest_region_codes = ["US"] dest_threat_intelligences = ["iplist-known-malicious-ips"] + src_address_groups = [] + dest_address_groups = [google_network_security_address_group.basic_global_networksecurity_address_group.id] } target_service_accounts = ["{{test_service_account}}"] } diff --git a/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule.yaml b/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule.yaml index 4668ac6536d8..60902db46a36 100644 --- a/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule.yaml +++ b/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule.yaml @@ -1,5 +1,3 @@ -versions: -- ga updates: - resource: ./basic_fir_sec_rule_update.tf.tmpl variables: diff --git a/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule_addr_groups.tf.tmpl b/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule_addr_groups.tf.tmpl deleted file mode 100644 index 39ec8e783ffd..000000000000 --- a/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule_addr_groups.tf.tmpl +++ /dev/null @@ -1,51 +0,0 @@ -resource "google_network_security_address_group" "basic_global_networksecurity_address_group" { - provider = google-beta - name = "{{policy}}" - parent = "organizations/{{org_id}}" - description = "Sample global networksecurity_address_group" - location = "global" - items = ["208.80.154.224/32"] - type = "IPV4" - capacity = 100 -} - -resource "google_folder" "folder" { - provider = google-beta - display_name = "{{policy}}" - parent = "organizations/{{org_id}}" -} - -resource "google_compute_firewall_policy" "default" { - provider = google-beta - parent = google_folder.folder.id - short_name = "{{policy}}" - description = "Resource created for Terraform acceptance testing" -} - -resource "google_compute_firewall_policy_rule" "primary" { - provider = google-beta - firewall_policy = google_compute_firewall_policy.default.name - description = "Resource created for Terraform acceptance testing" - priority = 9000 - enable_logging = true - action = "allow" - direction = "EGRESS" - disabled = false - match { - layer4_configs { - ip_protocol = "tcp" - ports = [8080] - } - layer4_configs { - ip_protocol = "udp" - ports = [22] - } - dest_ip_ranges = ["11.100.0.1/32"] - dest_fqdns = [] - dest_region_codes = ["US"] - dest_threat_intelligences = ["iplist-known-malicious-ips"] - src_address_groups = [] - dest_address_groups = [google_network_security_address_group.basic_global_networksecurity_address_group.id] - } - target_service_accounts = ["{{test_service_account}}"] -} diff --git a/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule_addr_groups.yaml b/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule_addr_groups.yaml deleted file mode 100644 index 846942638493..000000000000 --- a/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule_addr_groups.yaml +++ /dev/null @@ -1,19 +0,0 @@ -versions: -- beta -updates: -- resource: ./basic_fir_sec_rule_addr_groups_update.tf.tmpl -variables: -- name: policy - type: resource_name -- name: tagkey - type: resource_name -- name: tagvalue - type: resource_name -- name: project - type: project -- name: network - type: resource_name -- name: org_id - type: org_id -- name: test_service_account - type: test_service_account diff --git a/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule_addr_groups_update.tf.tmpl b/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule_addr_groups_update.tf.tmpl deleted file mode 100644 index c906aadd7519..000000000000 --- a/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule_addr_groups_update.tf.tmpl +++ /dev/null @@ -1,51 +0,0 @@ -resource "google_network_security_address_group" "basic_global_networksecurity_address_group" { - provider = google-beta - name = "{{policy}}" - parent = "organizations/{{org_id}}" - description = "Sample global networksecurity_address_group" - location = "global" - items = ["208.80.154.224/32"] - type = "IPV4" - capacity = 100 -} - -resource "google_folder" "folder" { - provider = google-beta - display_name = "{{policy}}" - parent = "organizations/{{org_id}}" -} - -resource "google_compute_firewall_policy" "default" { - provider = google-beta - parent = google_folder.folder.id - short_name = "{{policy}}" - description = "Resource created for Terraform acceptance testing" -} - -resource "google_compute_firewall_policy_rule" "primary" { - provider = google-beta - firewall_policy = google_compute_firewall_policy.default.name - description = "Resource created for Terraform acceptance testing - Updated" - priority = 9000 - enable_logging = true - action = "allow" - direction = "EGRESS" - disabled = false - match { - layer4_configs { - ip_protocol = "tcp" - ports = [8080] - } - layer4_configs { - ip_protocol = "udp" - ports = [22] - } - dest_ip_ranges = ["11.100.0.1/32", "10.0.0.0/24"] - dest_fqdns = ["google.com"] - dest_region_codes = ["US"] - dest_threat_intelligences = ["iplist-known-malicious-ips"] - src_address_groups = [] - dest_address_groups = [google_network_security_address_group.basic_global_networksecurity_address_group.id] - } - target_service_accounts = ["{{test_service_account}}"] -} diff --git a/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule_update.tf.tmpl b/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule_update.tf.tmpl index 8de3d046aab6..82930ce33b3f 100644 --- a/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule_update.tf.tmpl +++ b/tpgtools/overrides/compute/samples/firewallpolicyrule/basic_fir_sec_rule_update.tf.tmpl @@ -1,3 +1,13 @@ +resource "google_network_security_address_group" "basic_global_networksecurity_address_group" { + name = "{{policy}}" + parent = "organizations/{{org_id}}" + description = "Sample global networksecurity_address_group" + location = "global" + items = ["208.80.154.224/32"] + type = "IPV4" + capacity = 100 +} + resource "google_folder" "folder" { display_name = "{{policy}}" parent = "organizations/{{org_id}}" @@ -11,12 +21,12 @@ resource "google_compute_firewall_policy" "default" { resource "google_compute_firewall_policy_rule" "primary" { firewall_policy = google_compute_firewall_policy.default.name - description = "Resource created for Terraform acceptance testing - Updated" - priority = 9000 - enable_logging = true - action = "allow" - direction = "EGRESS" - disabled = false + description = "Resource created for Terraform acceptance testing - Updated" + priority = 9000 + enable_logging = true + action = "allow" + direction = "EGRESS" + disabled = false match { layer4_configs { ip_protocol = "tcp" @@ -30,6 +40,8 @@ resource "google_compute_firewall_policy_rule" "primary" { dest_fqdns = ["google.com"] dest_region_codes = ["US"] dest_threat_intelligences = ["iplist-known-malicious-ips"] + src_address_groups = [] + dest_address_groups = [google_network_security_address_group.basic_global_networksecurity_address_group.id] } target_service_accounts = ["{{test_service_account}}"] } diff --git a/tpgtools/overrides/compute/samples/firewallpolicyrule/meta.yaml b/tpgtools/overrides/compute/samples/firewallpolicyrule/meta.yaml index 1715b9ed6c41..0c276ef1daa2 100644 --- a/tpgtools/overrides/compute/samples/firewallpolicyrule/meta.yaml +++ b/tpgtools/overrides/compute/samples/firewallpolicyrule/meta.yaml @@ -9,11 +9,8 @@ test_hide: doc_hide_conditional: - location: global file_name: basic_fir_sec_rule.tf.tmpl - - location: global - file_name: basic_fir_sec_rule_addr_groups.tf.tmpl test_hide_conditional: - location: global file_name: basic_fir_sec_rule.tf.tmpl - - location: global - file_name: basic_fir_sec_rule_addr_groups.tf.tmpl + diff --git a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global.tf.tmpl b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global.tf.tmpl index bf2032c494e0..ed57eefc5625 100644 --- a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global.tf.tmpl +++ b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global.tf.tmpl @@ -1,3 +1,13 @@ +resource "google_network_security_address_group" "basic_global_networksecurity_address_group" { + name = "{{policy}}" + parent = "projects/{{project}}" + description = "Sample global networksecurity_address_group" + location = "global" + items = ["208.80.154.224/32"] + type = "IPV4" + capacity = 100 +} + resource "google_compute_network_firewall_policy" "basic_network_firewall_policy" { name = "{{policy}}" description = "Sample global network firewall policy" @@ -28,6 +38,8 @@ resource "google_compute_network_firewall_policy_rule" "primary" { layer4_configs { ip_protocol = "all" } + + src_address_groups = [google_network_security_address_group.basic_global_networksecurity_address_group.id] } } diff --git a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global.yaml b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global.yaml index 97e1eff0caf1..3893967d7a29 100644 --- a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global.yaml +++ b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global.yaml @@ -1,7 +1,5 @@ -versions: -- ga updates: -- resource: ./global_net_sec_rule_update.tf.tmpl +- resource: ./global_update.tf.tmpl variables: - name: policy type: resource_name diff --git a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global_net_sec_rule.tf.tmpl b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global_net_sec_rule.tf.tmpl deleted file mode 100644 index 5cc4f328078b..000000000000 --- a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global_net_sec_rule.tf.tmpl +++ /dev/null @@ -1,76 +0,0 @@ -resource "google_network_security_address_group" "basic_global_networksecurity_address_group" { - provider = google-beta - - name = "{{policy}}" - parent = "projects/{{project}}" - description = "Sample global networksecurity_address_group" - location = "global" - items = ["208.80.154.224/32"] - type = "IPV4" - capacity = 100 -} - -resource "google_compute_network_firewall_policy" "basic_network_firewall_policy" { - provider = google-beta - - name = "{{policy}}" - description = "Sample global network firewall policy" - project = "{{project}}" -} - -resource "google_compute_network_firewall_policy_rule" "primary" { - provider = google-beta - - action = "allow" - description = "This is a simple rule description" - direction = "INGRESS" - disabled = false - enable_logging = true - firewall_policy = google_compute_network_firewall_policy.basic_network_firewall_policy.name - priority = 1000 - rule_name = "test-rule" - target_service_accounts = ["{{test_service_account}}"] - - match { - src_ip_ranges = ["10.100.0.1/32"] - src_fqdns = ["google.com"] - src_region_codes = ["US"] - src_threat_intelligences = ["iplist-known-malicious-ips"] - - src_secure_tags { - name = "tagValues/${google_tags_tag_value.basic_value.name}" - } - - layer4_configs { - ip_protocol = "all" - } - - src_address_groups = [google_network_security_address_group.basic_global_networksecurity_address_group.id] - } -} - -resource "google_compute_network" "basic_network" { - provider = google-beta - - name = "{{network}}" -} - -resource "google_tags_tag_key" "basic_key" { - provider = google-beta - - description = "For keyname resources." - parent = "organizations/{{org_id}}" - purpose = "GCE_FIREWALL" - short_name = "{{tagkey}}" - purpose_data = { - network = "{{project}}/${google_compute_network.basic_network.name}" - } -} - -resource "google_tags_tag_value" "basic_value" { - provider = google-beta - - description = "For valuename resources." - parent = "tagKeys/${google_tags_tag_key.basic_key.name}" - short_name = "{{tagvalue}}" -} diff --git a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global_net_sec_rule.yaml b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global_net_sec_rule.yaml deleted file mode 100644 index c4f4e370840f..000000000000 --- a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global_net_sec_rule.yaml +++ /dev/null @@ -1,19 +0,0 @@ -versions: -- beta -updates: -- resource: ./global_net_sec_rule_update.tf.tmpl -variables: -- name: policy - type: resource_name -- name: tagkey - type: resource_name -- name: tagvalue - type: resource_name -- name: project - type: project -- name: network - type: resource_name -- name: org_id - type: org_id -- name: test_service_account - type: test_service_account diff --git a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global_net_sec_rule_update.tf.tmpl b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global_net_sec_rule_update.tf.tmpl deleted file mode 100644 index 9dea865e152f..000000000000 --- a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global_net_sec_rule_update.tf.tmpl +++ /dev/null @@ -1,79 +0,0 @@ -resource "google_network_security_address_group" "basic_global_networksecurity_address_group" { - provider = google-beta - - name = "{{policy}}" - parent = "projects/{{project}}" - description = "Sample global networksecurity_address_group. Update" - location = "global" - items = ["208.80.154.224/32"] - type = "IPV4" - capacity = 100 -} - -resource "google_compute_network_firewall_policy" "basic_network_firewall_policy" { - provider = google-beta - - name = "{{policy}}" - description = "Sample global network firewall policy" - project = "{{project}}" -} - -resource "google_compute_network_firewall_policy_rule" "primary" { - provider = google-beta - - action = "deny" - description = "This is an updated rule description" - direction = "EGRESS" - disabled = true - enable_logging = false - firewall_policy = google_compute_network_firewall_policy.basic_network_firewall_policy.name - priority = 1000 - rule_name = "updated-test-rule" - - match { - dest_ip_ranges = ["0.0.0.0/0"] - dest_fqdns = ["example.com"] - dest_region_codes = ["US"] - dest_threat_intelligences = ["iplist-known-malicious-ips"] - - layer4_configs { - ip_protocol = "tcp" - ports = ["123"] - } - - dest_address_groups = [google_network_security_address_group.basic_global_networksecurity_address_group.id] - - } - - target_secure_tags { - name = "tagValues/${google_tags_tag_value.basic_value.name}" - } -} - -resource "google_compute_network" "basic_network" { - provider = google-beta - - name = "{{network}}" -} - -resource "google_tags_tag_key" "basic_key" { - provider = google-beta - - description = "For keyname resources." - parent = "organizations/{{org_id}}" - purpose = "GCE_FIREWALL" - short_name = "{{tagkey}}" - - purpose_data = { - network = "{{project}}/${google_compute_network.basic_network.name}" - } -} - - -resource "google_tags_tag_value" "basic_value" { - provider = google-beta - - description = "For valuename resources." - parent = "tagKeys/${google_tags_tag_key.basic_key.name}" - short_name = "{{tagvalue}}" -} diff --git a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global_update.tf.tmpl b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global_update.tf.tmpl index fdf63563aefe..b177dc952550 100644 --- a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global_update.tf.tmpl +++ b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/global_update.tf.tmpl @@ -1,3 +1,13 @@ +resource "google_network_security_address_group" "basic_global_networksecurity_address_group" { + name = "{{policy}}" + parent = "projects/{{project}}" + description = "Sample global networksecurity_address_group. Update" + location = "global" + items = ["208.80.154.224/32"] + type = "IPV4" + capacity = 100 +} + resource "google_compute_network_firewall_policy" "basic_network_firewall_policy" { name = "{{policy}}" description = "Sample global network firewall policy" @@ -24,6 +34,9 @@ resource "google_compute_network_firewall_policy_rule" "primary" { ip_protocol = "tcp" ports = ["123"] } + + dest_address_groups = [google_network_security_address_group.basic_global_networksecurity_address_group.id] + } target_secure_tags { diff --git a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/meta.yaml b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/meta.yaml index 2c793adba081..b94a2dd59dae 100644 --- a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/meta.yaml +++ b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/meta.yaml @@ -9,20 +9,12 @@ test_hide: - basic_regional_network_firewall_policy_rule.yaml doc_hide_conditional: - - location: global - file_name: regional_net_sec_rule.tf.tmpl - - location: region - file_name: global_net_sec_rule.tf.tmpl - location: global file_name: regional.tf.tmpl - location: region file_name: global.tf.tmpl test_hide_conditional: - - location: global - file_name: regional_net_sec_rule.tf.tmpl - - location: region - file_name: global_net_sec_rule.tf.tmpl - location: global file_name: regional.tf.tmpl - location: region diff --git a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional.tf.tmpl b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional.tf.tmpl index 701ca410afa4..61e09cc75f35 100644 --- a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional.tf.tmpl +++ b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional.tf.tmpl @@ -1,3 +1,13 @@ +resource "google_network_security_address_group" "basic_regional_networksecurity_address_group" { + name = "{{policy}}" + parent = "projects/{{project}}" + description = "Sample regional networksecurity_address_group" + location = "{{region}}" + items = ["208.80.154.224/32"] + type = "IPV4" + capacity = 100 +} + resource "google_compute_region_network_firewall_policy" "basic_regional_network_firewall_policy" { name = "{{policy}}" description = "Sample regional network firewall policy" @@ -30,6 +40,8 @@ resource "google_compute_region_network_firewall_policy_rule" "primary" { src_secure_tags { name = "tagValues/${google_tags_tag_value.basic_value.name}" } + + src_address_groups = [google_network_security_address_group.basic_regional_networksecurity_address_group.id] } } diff --git a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional.yaml b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional.yaml index 34793f81da44..4a11a12854c4 100644 --- a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional.yaml +++ b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional.yaml @@ -1,7 +1,5 @@ -versions: -- ga updates: -- resource: ./regional_net_sec_rule_update.tf.tmpl +- resource: ./regional_update.tf.tmpl variables: - name: policy type: resource_name diff --git a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional_net_sec_rule.tf.tmpl b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional_net_sec_rule.tf.tmpl deleted file mode 100644 index 09c03b1bc2cb..000000000000 --- a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional_net_sec_rule.tf.tmpl +++ /dev/null @@ -1,79 +0,0 @@ -resource "google_network_security_address_group" "basic_regional_networksecurity_address_group" { - provider = google-beta - - name = "{{policy}}" - parent = "projects/{{project}}" - description = "Sample regional networksecurity_address_group" - location = "{{region}}" - items = ["208.80.154.224/32"] - type = "IPV4" - capacity = 100 -} - -resource "google_compute_region_network_firewall_policy" "basic_regional_network_firewall_policy" { - provider = google-beta - - name = "{{policy}}" - description = "Sample regional network firewall policy" - project = "{{project}}" - region = "{{region}}" -} - -resource "google_compute_region_network_firewall_policy_rule" "primary" { - provider = google-beta - - action = "allow" - description = "This is a simple rule description" - direction = "INGRESS" - disabled = false - enable_logging = true - firewall_policy = google_compute_region_network_firewall_policy.basic_regional_network_firewall_policy.name - priority = 1000 - region = "{{region}}" - rule_name = "test-rule" - target_service_accounts = ["{{test_service_account}}"] - - match { - src_ip_ranges = ["10.100.0.1/32"] - src_fqdns = ["example.com"] - src_region_codes = ["US"] - src_threat_intelligences = ["iplist-known-malicious-ips"] - - layer4_configs { - ip_protocol = "all" - } - - src_secure_tags { - name = "tagValues/${google_tags_tag_value.basic_value.name}" - } - - src_address_groups = [google_network_security_address_group.basic_regional_networksecurity_address_group.id] - } -} - -resource "google_compute_network" "basic_network" { - provider = google-beta - - name = "{{network}}" -} - -resource "google_tags_tag_key" "basic_key" { - provider = google-beta - - description = "For keyname resources." - parent = "organizations/{{org_id}}" - purpose = "GCE_FIREWALL" - short_name = "{{tagkey}}" - - purpose_data = { - network = "{{project}}/${google_compute_network.basic_network.name}" - } -} - -resource "google_tags_tag_value" "basic_value" { - provider = google-beta - - description = "For valuename resources." - parent = "tagKeys/${google_tags_tag_key.basic_key.name}" - short_name = "{{tagvalue}}" -} diff --git a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional_net_sec_rule.yaml b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional_net_sec_rule.yaml deleted file mode 100644 index 90160519b47a..000000000000 --- a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional_net_sec_rule.yaml +++ /dev/null @@ -1,21 +0,0 @@ -versions: -- beta -updates: -- resource: ./regional_net_sec_rule_update.tf.tmpl -variables: -- name: policy - type: resource_name -- name: project - type: project -- name: region - type: region -- name: tagkey - type: resource_name -- name: tagvalue - type: resource_name -- name: network - type: resource_name -- name: org_id - type: org_id -- name: test_service_account - type: test_service_account diff --git a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional_net_sec_rule_update.tf.tmpl b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional_net_sec_rule_update.tf.tmpl deleted file mode 100644 index c9620bfd79f1..000000000000 --- a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional_net_sec_rule_update.tf.tmpl +++ /dev/null @@ -1,79 +0,0 @@ -resource "google_network_security_address_group" "basic_regional_networksecurity_address_group" { - provider = google-beta - - name = "{{policy}}" - parent = "projects/{{project}}" - description = "Sample regional networksecurity_address_group. Update" - location = "{{region}}" - items = ["208.80.154.224/32"] - type = "IPV4" - capacity = 100 -} - -resource "google_compute_region_network_firewall_policy" "basic_regional_network_firewall_policy" { - provider = google-beta - - name = "{{policy}}" - description = "Sample regional network firewall policy" - project = "{{project}}" - region = "{{region}}" -} - -resource "google_compute_region_network_firewall_policy_rule" "primary" { - provider = google-beta - - action = "deny" - description = "This is an updated rule description" - direction = "EGRESS" - disabled = true - enable_logging = false - firewall_policy = google_compute_region_network_firewall_policy.basic_regional_network_firewall_policy.name - priority = 1000 - region = "{{region}}" - rule_name = "updated-test-rule" - - match { - dest_ip_ranges = ["0.0.0.0/0"] - dest_fqdns = ["example.com"] - dest_region_codes = ["US"] - dest_threat_intelligences = ["iplist-known-malicious-ips"] - - layer4_configs { - ip_protocol = "tcp" - ports = ["123"] - } - - dest_address_groups = [google_network_security_address_group.basic_regional_networksecurity_address_group.id] - } - - target_secure_tags { - name = "tagValues/${google_tags_tag_value.basic_value.name}" - } -} - -resource "google_compute_network" "basic_network" { - provider = google-beta - - name = "{{network}}" -} - -resource "google_tags_tag_key" "basic_key" { - provider = google-beta - - description = "For keyname resources." - parent = "organizations/{{org_id}}" - purpose = "GCE_FIREWALL" - short_name = "{{tagkey}}" - - purpose_data = { - network = "{{project}}/${google_compute_network.basic_network.name}" - } -} - -resource "google_tags_tag_value" "basic_value" { - provider = google-beta - - description = "For valuename resources." - parent = "tagKeys/${google_tags_tag_key.basic_key.name}" - short_name = "{{tagvalue}}" -} diff --git a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional_update.tf.tmpl b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional_update.tf.tmpl index 0b84e25b4c96..d03bda6407a9 100644 --- a/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional_update.tf.tmpl +++ b/tpgtools/overrides/compute/samples/networkfirewallpolicyrule/regional_update.tf.tmpl @@ -1,3 +1,13 @@ +resource "google_network_security_address_group" "basic_regional_networksecurity_address_group" { + name = "{{policy}}" + parent = "projects/{{project}}" + description = "Sample regional networksecurity_address_group. Update" + location = "{{region}}" + items = ["208.80.154.224/32"] + type = "IPV4" + capacity = 100 +} + resource "google_compute_region_network_firewall_policy" "basic_regional_network_firewall_policy" { name = "{{policy}}" description = "Sample regional network firewall policy" @@ -26,6 +36,8 @@ resource "google_compute_region_network_firewall_policy_rule" "primary" { ip_protocol = "tcp" ports = ["123"] } + + dest_address_groups = [google_network_security_address_group.basic_regional_networksecurity_address_group.id] } target_secure_tags {