Skip to content

Commit

Permalink
Merge branch 'FEATURE-BRANCH-major-release-6.0.0' into FEATURE-BRANCH…
Browse files Browse the repository at this point in the history
…-major-release-6.0.0
  • Loading branch information
wj-chen authored Jul 10, 2024
2 parents 5b647ab + f8834bc commit d3d9a91
Show file tree
Hide file tree
Showing 475 changed files with 8,970 additions and 1,368 deletions.
33 changes: 17 additions & 16 deletions .ci/magician/cmd/generate_downstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,24 @@ func execGenerateDownstream(baseBranch, command, repo, version, ref string, gh G
if baseBranch == "" {
baseBranch = "main"
}

var syncBranchPrefix string
if repo == "terraform" {
if version == "beta" {
syncBranchPrefix = "tpgb-sync"
} else if version == "ga" {
syncBranchPrefix = "tpg-sync"
if command == "downstream" {
var syncBranchPrefix string
if repo == "terraform" {
if version == "beta" {
syncBranchPrefix = "tpgb-sync"
} else if version == "ga" {
syncBranchPrefix = "tpg-sync"
}
} else if repo == "terraform-google-conversion" {
syncBranchPrefix = "tgc-sync"
} else if repo == "tf-oics" {
syncBranchPrefix = "tf-oics-sync"
}
syncBranch := getSyncBranch(syncBranchPrefix, baseBranch)
if syncBranchHasCommit(ref, syncBranch, rnr) {
fmt.Printf("Sync branch %s already has commit %s, skipping generation\n", syncBranch, ref)
os.Exit(0)
}
} else if repo == "terraform-google-conversion" {
syncBranchPrefix = "tgc-sync"
} else if repo == "tf-oics" {
syncBranchPrefix = "tf-oics-sync"
}
syncBranch := getSyncBranch(syncBranchPrefix, baseBranch)
if syncBranchHasCommit(ref, syncBranch, rnr) {
fmt.Printf("Sync branch %s already has commit %s, skipping generation\n", syncBranch, ref)
os.Exit(0)
}

mmLocalPath := filepath.Join(rnr.GetCWD(), "..", "..")
Expand Down
10 changes: 5 additions & 5 deletions .ci/magician/github/membership.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ var (
startDate: newDate(2024, 4, 11, pdtLoc),
endDate: newDate(2024, 6, 14, pdtLoc),
},
{
id: "slevenick",
startDate: newDate(2024, 4, 20, pdtLoc),
endDate: newDate(2024, 4, 27, pdtLoc),
},
{
id: "ScottSuarez",
startDate: newDate(2024, 4, 30, pdtLoc),
Expand All @@ -87,6 +82,11 @@ var (
startDate: newDate(2024, 6, 26, pdtLoc),
endDate: newDate(2024, 7, 22, pdtLoc),
},
{
id: "slevenick",
startDate: newDate(2024, 7, 5, pdtLoc),
endDate: newDate(2024, 7, 16, pdtLoc),
},
}
)

Expand Down
6 changes: 6 additions & 0 deletions mmv1/api/resource/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ func ExecuteTemplate(e any, templatePath string, appendNewline bool) string {
templates := []string{
templatePath,
"templates/terraform/expand_resource_ref.tmpl",
"templates/terraform/custom_flatten/go/bigquery_table_ref.go.tmpl",
"templates/terraform/flatten_property_method.go.tmpl",
"templates/terraform/expand_property_method.go.tmpl",
"templates/terraform/update_mask.go.tmpl",
"templates/terraform/nested_query.go.tmpl",
"templates/terraform/unordered_list_customize_diff.go.tmpl",
}
templateFileName := filepath.Base(templatePath)

Expand Down
2 changes: 1 addition & 1 deletion mmv1/api/resource/iam_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def validate
check :import_format, type: Array, item_type: String
check(
:example_config_body,
type: String, default: 'templates/terraform/iam/iam_attributes.tf.erb'
type: String, default: 'templates/terraform/iam/iam_attributes.go.erb'
)
check :iam_policy_version, type: String
check :min_version, type: String
Expand Down
5 changes: 4 additions & 1 deletion mmv1/api/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ type Type struct {
ItemType *Type `yaml:"item_type"`
MinSize string `yaml:"min_size"`
MaxSize string `yaml:"max_size"`
// Adds a ValidateFunc to the item schema
ItemValidation resource.Validation `yaml:"item_validation"`

// __name
ParentName string

Expand Down Expand Up @@ -585,7 +588,7 @@ func (t Type) ExactlyOneOfList() []string {
// Returns list of properties that needs required with their fields set.
// func (t *Type) required_with_list() {
func (t Type) RequiredWithList() []string {
if t.ResourceMetadata == nil || t.Parent() != nil {
if t.ResourceMetadata == nil {
return []string{}
}

Expand Down
29 changes: 18 additions & 11 deletions mmv1/products/alloydb/Cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ docs: !ruby/object:Provider::Terraform::Docs
Users can promote a secondary cluster to a primary cluster with the help of `cluster_type`.
To promote, users have to set the `cluster_type` property as `PRIMARY` and remove the `secondary_config` field from cluster configuration.
[See Example](https://github.com/hashicorp/terraform-provider-google/pull/16413).
Switchover is supported in terraform by refreshing the state of the terraform configurations.
The switchover operation still needs to be called outside of terraform.
After the switchover operation is completed successfully:
1. Refresh the state of the AlloyDB resources by running `terraform apply -refresh-only --auto-approve` .
2. Manually update the terraform configuration file(s) to match the actual state of the resources by modifying the `cluster_type` and `secondary_config` fields.
3. Verify the sync of terraform state by running `terraform plan` and ensure that the infrastructure matches the configuration and no changes are required.
self_link: 'projects/{{project}}/locations/{{location}}/clusters/{{cluster_id}}'
base_url: 'projects/{{project}}/locations/{{location}}/clusters'
create_url: 'projects/{{project}}/locations/{{location}}/clusters?clusterId={{cluster_id}}'
Expand Down Expand Up @@ -106,6 +113,17 @@ custom_code: !ruby/object:Provider::Terraform::CustomCode
pre_create: templates/terraform/pre_create/alloydb_cluster.go.erb
pre_update: templates/terraform/pre_update/alloydb_cluster.go.erb
pre_delete: templates/terraform/pre_delete/alloydb_cluster.go.erb
virtual_fields:
- !ruby/object:Api::Type::Enum
name: 'deletion_policy'
description: |
Policy to determine if the cluster should be deleted forcefully.
Deleting a cluster forcefully, deletes the cluster and all its associated instances within the cluster.
Deleting a Secondary cluster with a secondary instance REQUIRES setting deletion_policy = "FORCE" otherwise an error is returned. This is needed as there is no support to delete just the secondary instance, and the only way to delete secondary instance is to delete the associated secondary cluster forcefully which also deletes the secondary instance.
values:
- :DEFAULT
- :FORCE
default_value: :DEFAULT
parameters:
- !ruby/object:Api::Type::String
name: 'clusterId'
Expand Down Expand Up @@ -556,14 +574,3 @@ properties:
name: nanos
description: |
Fractions of seconds in nanoseconds. Currently, only the value 0 is supported.
virtual_fields:
- !ruby/object:Api::Type::Enum
name: 'deletion_policy'
description: |
Policy to determine if the cluster should be deleted forcefully.
Deleting a cluster forcefully, deletes the cluster and all its associated instances within the cluster.
Deleting a Secondary cluster with a secondary instance REQUIRES setting deletion_policy = "FORCE" otherwise an error is returned. This is needed as there is no support to delete just the secondary instance, and the only way to delete secondary instance is to delete the associated secondary cluster forcefully which also deletes the secondary instance.
values:
- :DEFAULT
- :FORCE
default_value: :DEFAULT
246 changes: 246 additions & 0 deletions mmv1/products/alloydb/go_Backup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
# Copyright 2024 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.

# Warning: This is a temporary file, and should not be edited directly
---
name: 'Backup'
description: 'An AlloyDB Backup.'
references:
guides:
'AlloyDB': 'https://cloud.google.com/alloydb/docs/'
api: 'https://cloud.google.com/alloydb/docs/reference/rest/v1/projects.locations.backups/create'
docs:
base_url: 'projects/{{project}}/locations/{{location}}/backups'
self_link: 'projects/{{project}}/locations/{{location}}/backups/{{backup_id}}'
create_url: 'projects/{{project}}/locations/{{location}}/backups?backupId={{backup_id}}'
update_verb: 'PATCH'
update_mask: true
import_format:
- 'projects/{{project}}/locations/{{location}}/backups/{{backup_id}}'
timeouts:
insert_minutes: 10
update_minutes: 10
delete_minutes: 10
autogen_async: true
async:
type: 'OpAsync'
operation:
base_url: '{{op_id}}'
result:
resource_inside_response: false
custom_code:
encoder: 'templates/terraform/encoders/go/alloydb_backup.tmpl'
examples:
- name: 'alloydb_backup_basic'
primary_resource_id: 'default'
vars:
alloydb_backup_id: 'alloydb-backup'
alloydb_cluster_name: 'alloydb-cluster'
alloydb_instance_name: 'alloydb-instance'
network_name: 'alloydb-network'
ignore_read_extra:
- 'reconciling'
- 'update_time'
skip_test: true
- name: 'alloydb_backup_basic_test'
primary_resource_id: 'default'
vars:
alloydb_backup_id: 'alloydb-backup'
alloydb_cluster_name: 'alloydb-cluster'
alloydb_instance_name: 'alloydb-instance'
network_name: 'alloydb-network'
test_vars_overrides:
'network_name': 'acctest.BootstrapSharedServiceNetworkingConnection(t, "alloydbinstance-network-config-1")'
ignore_read_extra:
- 'reconciling'
- 'update_time'
skip_docs: true
- name: 'alloydb_backup_full'
primary_resource_id: 'default'
vars:
alloydb_backup_id: 'alloydb-backup'
alloydb_cluster_name: 'alloydb-cluster'
alloydb_instance_name: 'alloydb-instance'
network_name: 'alloydb-network'
ignore_read_extra:
- 'reconciling'
- 'update_time'
skip_test: true
- name: 'alloydb_backup_full_test'
primary_resource_id: 'default'
vars:
alloydb_backup_id: 'alloydb-backup'
alloydb_cluster_name: 'alloydb-cluster'
alloydb_instance_name: 'alloydb-instance'
network_name: 'alloydb-network'
test_vars_overrides:
'network_name': 'acctest.BootstrapSharedServiceNetworkingConnection(t, "alloydbinstance-network-config-1")'
ignore_read_extra:
- 'reconciling'
- 'update_time'
skip_docs: true
skip_vcr: true
parameters:
- name: 'backupId'
type: String
description: |
The ID of the alloydb backup.
url_param_only: true
required: true
immutable: true
- name: 'location'
type: String
description: |
The location where the alloydb backup should reside.
url_param_only: true
required: true
immutable: true
properties:
- name: 'name'
type: String
description: |
Output only. The name of the backup resource with the format: * projects/{project}/locations/{region}/backups/{backupId}
output: true
- name: 'displayName'
type: String
description: |
User-settable and human-readable display name for the Backup.
- name: 'uid'
type: String
description: |
Output only. The system-generated UID of the resource. The UID is assigned when the resource is created, and it is retained until it is deleted.
output: true
- name: 'createTime'
type: Time
description: |
Output only. Create time stamp. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
output: true
- name: 'updateTime'
type: Time
description: |
Output only. Update time stamp. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
output: true
- name: 'deleteTime'
type: Time
description: |
Output only. Delete time stamp. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
output: true
- name: 'labels'
type: KeyValueLabels
description: |
User-defined labels for the alloydb backup. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
immutable: false
- name: 'state'
type: String
description: Output only. The current state of the backup.
output: true
- name: 'type'
type: Enum
description: 'The backup type, which suggests the trigger for the backup.'
default_from_api: true
enum_values:
- 'TYPE_UNSPECIFIED'
- 'ON_DEMAND'
- 'AUTOMATED'
- 'CONTINUOUS'
- name: 'description'
type: String
description: 'User-provided description of the backup.'
- name: 'clusterUid'
type: String
description: 'Output only. The system-generated UID of the cluster which was used to create this resource.'
output: true
- name: 'clusterName'
type: String
description:
'The full resource name of the backup source cluster (e.g.,
projects/{project}/locations/{location}/clusters/{clusterId}).'
required: true
immutable: true
diff_suppress_func: 'tpgresource.ProjectNumberDiffSuppress'
- name: 'reconciling'
type: Boolean
description: |
Output only. Reconciling (https://google.aip.dev/128#reconciliation), if true, indicates that the service is actively updating the resource.
This can happen due to user-triggered updates or system actions like failover or maintenance.
output: true
- name: 'encryptionConfig'
type: NestedObject
description: |
EncryptionConfig describes the encryption config of a cluster or a backup that is encrypted with a CMEK (customer-managed encryption key).
properties:
- name: 'kmsKeyName'
type: String
description: |
The fully-qualified resource name of the KMS key. Each Cloud KMS key is regionalized and has the following format: projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME].
immutable: true
- name: 'encryptionInfo'
type: NestedObject
description: |
EncryptionInfo describes the encryption information of a cluster or a backup.
output: true
properties:
- name: 'encryptionType'
type: Enum
description: 'Output only. Type of encryption.'
output: true
enum_values:
- 'TYPE_UNSPECIFIED'
- 'GOOGLE_DEFAULT_ENCRYPTION'
- 'CUSTOMER_MANAGED_ENCRYPTION'
- name: 'kmsKeyVersions'
type: Array
description: |
Output only. Cloud KMS key versions that are being used to protect the database or the backup.
output: true
item_type:
type: String
- name: 'etag'
type: String
description: 'For Resource freshness validation (https://google.aip.dev/154)'
output: true
- name: 'annotations'
type: KeyValueAnnotations
description: |
Annotations to allow client tools to store small amount of arbitrary data. This is distinct from labels. https://google.aip.dev/128
An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
- name: 'sizeBytes'
type: String
description: 'Output only. The size of the backup in bytes.'
output: true
- name: 'expiryTime'
type: String
description: |
Output only. The time at which after the backup is eligible to be garbage collected.
It is the duration specified by the backup's retention policy, added to the backup's createTime.
output: true
- name: 'expiryQuantity'
type: NestedObject
description: |
Output only. The QuantityBasedExpiry of the backup, specified by the backup's retention policy.
Once the expiry quantity is over retention, the backup is eligible to be garbage collected.
output: true
properties:
- name: 'retentionCount'
type: Integer
description: |
Output only. The backup's position among its backups with the same source cluster and type, by descending chronological order create time (i.e. newest first).
output: true
- name: 'totalRetentionCount'
type: Integer
description: |
Output only. The length of the quantity-based queue, specified by the backup's retention policy.
output: true
Loading

0 comments on commit d3d9a91

Please sign in to comment.