@@ -1016,21 +1016,18 @@ func resourceContainerCluster() *schema.Resource {
10161016 Type : schema .TypeList ,
10171017 MaxItems : 1 ,
10181018 Optional : true ,
1019- ForceNew : true ,
10201019 Computed : true ,
10211020 Description : `Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: "ENCRYPTED"; "DECRYPTED". key_name is the name of a CloudKMS key.` ,
10221021 Elem : & schema.Resource {
10231022 Schema : map [string ]* schema.Schema {
10241023 "state" : {
10251024 Type : schema .TypeString ,
1026- ForceNew : true ,
10271025 Required : true ,
10281026 ValidateFunc : validation .StringInSlice ([]string {"ENCRYPTED" , "DECRYPTED" }, false ),
10291027 Description : `ENCRYPTED or DECRYPTED.` ,
10301028 },
10311029 "key_name" : {
10321030 Type : schema .TypeString ,
1033- ForceNew : true ,
10341031 Optional : true ,
10351032 Description : `The key to use to encrypt/decrypt secrets.` ,
10361033 },
@@ -2098,6 +2095,31 @@ func resourceContainerClusterUpdate(d *schema.ResourceData, meta interface{}) er
20982095 }
20992096 }
21002097
2098+ if d .HasChange ("database_encryption" ) {
2099+ c := d .Get ("database_encryption" )
2100+ req := & containerBeta.UpdateClusterRequest {
2101+ Update : & containerBeta.ClusterUpdate {
2102+ DesiredDatabaseEncryption : expandDatabaseEncryption (c ),
2103+ },
2104+ }
2105+
2106+ updateF := func () error {
2107+ name := containerClusterFullName (project , location , clusterName )
2108+ op , err := config .clientContainerBeta .Projects .Locations .Clusters .Update (name , req ).Do ()
2109+ if err != nil {
2110+ return err
2111+ }
2112+ // Wait until it's updated
2113+ return containerOperationWait (config , op , project , location , "updating GKE cluster database encryption config" , d .Timeout (schema .TimeoutUpdate ))
2114+ }
2115+ if err := lockedCall (lockKey , updateF ); err != nil {
2116+ return err
2117+ }
2118+ log .Printf ("[INFO] GKE cluster %s database encryption config has been updated" , d .Id ())
2119+
2120+ d .SetPartial ("database_encryption" )
2121+ }
2122+
21012123 if d .HasChange ("pod_security_policy_config" ) {
21022124 c := d .Get ("pod_security_policy_config" )
21032125 req := & containerBeta.UpdateClusterRequest {
0 commit comments