Skip to content

Commit

Permalink
Merge pull request #9107 from GoogleCloudPlatform/main_sync (#16022)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Sep 27, 2023
1 parent 930c63d commit 0879a4c
Show file tree
Hide file tree
Showing 63 changed files with 5,865 additions and 427 deletions.
3 changes: 3 additions & 0 deletions .changelog/9107.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
1 change: 1 addition & 0 deletions .copywrite.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ project {
"scripts/**",
"google/**/test-fixtures/**",
"META.d/*.yml",
"META.d/*.yaml",
".golangci.yml",
".goreleaser.yml",
]
Expand Down
12 changes: 12 additions & 0 deletions META.d/_summary.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---

schema: 1.1

partition: tf-ecosystem

summary:
owner: team-tf-hybrid-cloud
description: |
The Terraform Google provider is a plugin that allows Terraform to manage resources on Google Cloud Platform.
visibility: external
7 changes: 7 additions & 0 deletions META.d/links.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
runbooks: []
#- name: <Link name>
# link: <Link URL>

other_links: []
#- name: <Link name>
# link: <Link URL>
6 changes: 4 additions & 2 deletions google/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -990,9 +990,9 @@ func DatasourceMapWithErrors() (map[string]*schema.Resource, error) {
})
}

// Generated resources: 319
// Generated resources: 321
// Generated IAM resources: 207
// Total generated resources: 526
// Total generated resources: 528
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -1462,8 +1462,10 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_secret_manager_secret_iam_member": tpgiamresource.ResourceIamMember(secretmanager.SecretManagerSecretIamSchema, secretmanager.SecretManagerSecretIamUpdaterProducer, secretmanager.SecretManagerSecretIdParseFunc),
"google_secret_manager_secret_iam_policy": tpgiamresource.ResourceIamPolicy(secretmanager.SecretManagerSecretIamSchema, secretmanager.SecretManagerSecretIamUpdaterProducer, secretmanager.SecretManagerSecretIdParseFunc),
"google_secret_manager_secret_version": secretmanager.ResourceSecretManagerSecretVersion(),
"google_scc_folder_custom_module": securitycenter.ResourceSecurityCenterFolderCustomModule(),
"google_scc_mute_config": securitycenter.ResourceSecurityCenterMuteConfig(),
"google_scc_notification_config": securitycenter.ResourceSecurityCenterNotificationConfig(),
"google_scc_organization_custom_module": securitycenter.ResourceSecurityCenterOrganizationCustomModule(),
"google_scc_project_custom_module": securitycenter.ResourceSecurityCenterProjectCustomModule(),
"google_scc_source": securitycenter.ResourceSecurityCenterSource(),
"google_scc_source_iam_binding": tpgiamresource.ResourceIamBinding(securitycenter.SecurityCenterSourceIamSchema, securitycenter.SecurityCenterSourceIamUpdaterProducer, securitycenter.SecurityCenterSourceIdParseFunc),
Expand Down
345 changes: 267 additions & 78 deletions google/services/alloydb/resource_alloydb_backup.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestAccAlloydbBackup_alloydbBackupBasicExample(t *testing.T) {
ResourceName: "google_alloydb_backup.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"backup_id", "location", "reconciling", "update_time", "labels", "terraform_labels"},
ImportStateVerifyIgnore: []string{"backup_id", "location", "reconciling", "update_time"},
},
},
})
Expand Down Expand Up @@ -118,7 +118,7 @@ func TestAccAlloydbBackup_alloydbBackupFullExample(t *testing.T) {
ResourceName: "google_alloydb_backup.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"backup_id", "location", "reconciling", "update_time", "labels", "terraform_labels"},
ImportStateVerifyIgnore: []string{"backup_id", "location", "reconciling", "update_time"},
},
},
})
Expand All @@ -132,6 +132,7 @@ resource "google_alloydb_backup" "default" {
cluster_name = google_alloydb_cluster.default.name
description = "example description"
type = "ON_DEMAND"
labels = {
"label" = "key"
}
Expand Down
99 changes: 99 additions & 0 deletions google/services/alloydb/resource_alloydb_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ func ResourceAlloydbCluster() *schema.Resource {
ForceNew: true,
Description: `The location where the alloydb cluster should reside.`,
},
"annotations": {
Type: schema.TypeMap,
Optional: true,
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" }.`,
Elem: &schema.Schema{Type: schema.TypeString},
},
"automated_backup_policy": {
Type: schema.TypeList,
Computed: true,
Expand Down Expand Up @@ -267,6 +274,11 @@ If not set, defaults to 14 days.`,
},
},
},
"etag": {
Type: schema.TypeString,
Optional: true,
Description: `For Resource freshness validation (https://google.aip.dev/154)`,
},
"initial_user": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -500,6 +512,18 @@ It is specified in the form: "projects/{projectNumber}/global/networks/{network_
Computed: true,
Description: `The name of the cluster resource.`,
},
"reconciling": {
Type: schema.TypeBool,
Computed: true,
Description: `Output only. Reconciling (https://google.aip.dev/128#reconciliation).
Set to true if the current state of Cluster does not match the user's intended state, and the service is actively updating the resource to reconcile them.
This can happen due to user-triggered updates or system actions like failover or maintenance.`,
},
"state": {
Type: schema.TypeString,
Computed: true,
Description: `Output only. The current serving state of the cluster.`,
},
"terraform_labels": {
Type: schema.TypeMap,
Computed: true,
Expand Down Expand Up @@ -555,6 +579,18 @@ func resourceAlloydbClusterCreate(d *schema.ResourceData, meta interface{}) erro
} else if v, ok := d.GetOkExists("display_name"); !tpgresource.IsEmptyValue(reflect.ValueOf(displayNameProp)) && (ok || !reflect.DeepEqual(v, displayNameProp)) {
obj["displayName"] = displayNameProp
}
etagProp, err := expandAlloydbClusterEtag(d.Get("etag"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("etag"); !tpgresource.IsEmptyValue(reflect.ValueOf(etagProp)) && (ok || !reflect.DeepEqual(v, etagProp)) {
obj["etag"] = etagProp
}
annotationsProp, err := expandAlloydbClusterAnnotations(d.Get("annotations"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("annotations"); !tpgresource.IsEmptyValue(reflect.ValueOf(annotationsProp)) && (ok || !reflect.DeepEqual(v, annotationsProp)) {
obj["annotations"] = annotationsProp
}
initialUserProp, err := expandAlloydbClusterInitialUser(d.Get("initial_user"), d, config)
if err != nil {
return err
Expand Down Expand Up @@ -746,6 +782,18 @@ func resourceAlloydbClusterRead(d *schema.ResourceData, meta interface{}) error
if err := d.Set("display_name", flattenAlloydbClusterDisplayName(res["displayName"], d, config)); err != nil {
return fmt.Errorf("Error reading Cluster: %s", err)
}
if err := d.Set("etag", flattenAlloydbClusterEtag(res["etag"], d, config)); err != nil {
return fmt.Errorf("Error reading Cluster: %s", err)
}
if err := d.Set("reconciling", flattenAlloydbClusterReconciling(res["reconciling"], d, config)); err != nil {
return fmt.Errorf("Error reading Cluster: %s", err)
}
if err := d.Set("state", flattenAlloydbClusterState(res["state"], d, config)); err != nil {
return fmt.Errorf("Error reading Cluster: %s", err)
}
if err := d.Set("annotations", flattenAlloydbClusterAnnotations(res["annotations"], d, config)); err != nil {
return fmt.Errorf("Error reading Cluster: %s", err)
}
if err := d.Set("database_version", flattenAlloydbClusterDatabaseVersion(res["databaseVersion"], d, config)); err != nil {
return fmt.Errorf("Error reading Cluster: %s", err)
}
Expand Down Expand Up @@ -811,6 +859,18 @@ func resourceAlloydbClusterUpdate(d *schema.ResourceData, meta interface{}) erro
} else if v, ok := d.GetOkExists("display_name"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, displayNameProp)) {
obj["displayName"] = displayNameProp
}
etagProp, err := expandAlloydbClusterEtag(d.Get("etag"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("etag"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, etagProp)) {
obj["etag"] = etagProp
}
annotationsProp, err := expandAlloydbClusterAnnotations(d.Get("annotations"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("annotations"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, annotationsProp)) {
obj["annotations"] = annotationsProp
}
initialUserProp, err := expandAlloydbClusterInitialUser(d.Get("initial_user"), d, config)
if err != nil {
return err
Expand Down Expand Up @@ -860,6 +920,14 @@ func resourceAlloydbClusterUpdate(d *schema.ResourceData, meta interface{}) erro
updateMask = append(updateMask, "displayName")
}

if d.HasChange("etag") {
updateMask = append(updateMask, "etag")
}

if d.HasChange("annotations") {
updateMask = append(updateMask, "annotations")
}

if d.HasChange("initial_user") {
updateMask = append(updateMask, "initialUser")
}
Expand Down Expand Up @@ -1136,6 +1204,22 @@ func flattenAlloydbClusterDisplayName(v interface{}, d *schema.ResourceData, con
return v
}

func flattenAlloydbClusterEtag(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}

func flattenAlloydbClusterReconciling(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}

func flattenAlloydbClusterState(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}

func flattenAlloydbClusterAnnotations(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}

func flattenAlloydbClusterDatabaseVersion(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
Expand Down Expand Up @@ -1541,6 +1625,21 @@ func expandAlloydbClusterDisplayName(v interface{}, d tpgresource.TerraformResou
return v, nil
}

func expandAlloydbClusterEtag(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}

func expandAlloydbClusterAnnotations(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) {
if v == nil {
return map[string]string{}, nil
}
m := make(map[string]string)
for k, val := range v.(map[string]interface{}) {
m[k] = val.(string)
}
return m, nil
}

func expandAlloydbClusterInitialUser(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
Expand Down
Loading

0 comments on commit 0879a4c

Please sign in to comment.