Skip to content

Commit

Permalink
added boot_disk_kms_key to node_config (#3044) (#5615)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Feb 7, 2020
1 parent 333abb0 commit 8b94581
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .changelog/3044.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
container: added `boot_disk_kms_key` to `node_config` block.
```
1 change: 0 additions & 1 deletion google/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import (
"google.golang.org/api/serviceusage/v1"
"google.golang.org/api/sourcerepo/v1"
"google.golang.org/api/spanner/v1"
sqladmin "google.golang.org/api/sqladmin/v1beta4"
"google.golang.org/api/storage/v1"
"google.golang.org/api/storagetransfer/v1"
)
Expand Down
9 changes: 3 additions & 6 deletions google/resource_sql_database_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"

"google.golang.org/api/googleapi"
sqladmin "google.golang.org/api/sqladmin/v1beta4"
)

Expand Down Expand Up @@ -610,7 +609,7 @@ func resourceSqlDatabaseInstanceCreate(d *schema.ResourceData, meta interface{})
for _, u := range users.Items {
if u.Name == "root" && u.Host == "%" {
err = retry(func() error {
op, err = config.clientSqlAdmin.Users.Delete(project, instance.Name, u.Host, u.Name).Do()
op, err = config.clientSqlAdmin.Users.Delete(project, instance.Name).Do()
if err == nil {
err = sqlAdminOperationWaitTime(config, op, project, "Delete default root User", int(d.Timeout(schema.TimeoutCreate).Minutes()))
}
Expand Down Expand Up @@ -656,7 +655,7 @@ func expandSqlDatabaseInstanceSettings(configured []interface{}, secondGen bool)
// 1st Generation instances don't support the disk_autoresize parameter
// and it defaults to true - so we shouldn't set it if this is first gen
if secondGen {
settings.StorageAutoResize = googleapi.Bool(_settings["disk_autoresize"].(bool))
settings.StorageAutoResize = _settings["disk_autoresize"].(bool)
}

return settings
Expand Down Expand Up @@ -967,9 +966,7 @@ func flattenSettings(settings *sqladmin.Settings) []map[string]interface{} {
data["maintenance_window"] = flattenMaintenanceWindow(settings.MaintenanceWindow)
}

if settings.StorageAutoResize != nil {
data["disk_autoresize"] = *settings.StorageAutoResize
}
data["disk_autoresize"] = settings.StorageAutoResize

if settings.UserLabels != nil {
data["user_labels"] = settings.UserLabels
Expand Down
5 changes: 2 additions & 3 deletions google/resource_sql_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func resourceSqlUserUpdate(d *schema.ResourceData, meta interface{}) error {
defer mutexKV.Unlock(instanceMutexKey(project, instance))
var op *sqladmin.Operation
updateFunc := func() error {
op, err = config.clientSqlAdmin.Users.Update(project, instance, name,
op, err = config.clientSqlAdmin.Users.Update(project, instance,
user).Host(host).Do()
return err
}
Expand Down Expand Up @@ -213,14 +213,13 @@ func resourceSqlUserDelete(d *schema.ResourceData, meta interface{}) error {

name := d.Get("name").(string)
instance := d.Get("instance").(string)
host := d.Get("host").(string)

mutexKV.Lock(instanceMutexKey(project, instance))
defer mutexKV.Unlock(instanceMutexKey(project, instance))

var op *sqladmin.Operation
err = retryTimeDuration(func() error {
op, err = config.clientSqlAdmin.Users.Delete(project, instance, host, name).Do()
op, err = config.clientSqlAdmin.Users.Delete(project, instance).Do()
return err
}, d.Timeout(schema.TimeoutDelete))

Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/container_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,8 @@ The `node_config` block supports:
* `sandbox_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) [GKE Sandbox](https://cloud.google.com/kubernetes-engine/docs/how-to/sandbox-pods) configuration. When enabling this feature you must specify `image_type = "COS_CONTAINERD"` and `node_version = "1.12.7-gke.17"` or later to use it.
Structure is documented below.

* `boot_disk_kms_key` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) The Customer Managed Encryption Key used to encrypt the boot disk attached to each node in the node pool. This should be of the form projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. For more information about protecting resources with Cloud KMS Keys please see: https://cloud.google.com/compute/docs/disks/customer-managed-encryption

* `service_account` - (Optional) The service account to be used by the Node VMs.
If not specified, the "default" service account is used.
In order to use the configured `oauth_scopes` for logging and monitoring, the service account being used needs the
Expand Down

0 comments on commit 8b94581

Please sign in to comment.