@@ -69,6 +69,11 @@ func resourceMWSWorkspaces() *schema.Resource {
6969 Type : schema .TypeBool ,
7070 Required : true ,
7171 },
72+ "customer_managed_key_id" : {
73+ Type : schema .TypeString ,
74+ Default : "" ,
75+ Optional : true ,
76+ },
7277 "network_id" : {
7378 Type : schema .TypeString ,
7479 Optional : true ,
@@ -127,14 +132,15 @@ func resourceMWSWorkspacesCreate(d *schema.ResourceData, m interface{}) error {
127132 credentialsID := d .Get ("credentials_id" ).(string )
128133 storageConfigurationID := d .Get ("storage_configuration_id" ).(string )
129134 networkID := d .Get ("network_id" ).(string )
135+ customerManagedKeyId := d .Get ("customer_managed_key_id" ).(string )
130136 isNoPublicIpEnabled := d .Get ("is_no_public_ip_enabled" ).(bool )
131137 var workspace model.MWSWorkspace
132138 var err error
133- workspace , err = client .MWSWorkspaces ().Create (mwsAcctId , workspaceName , deploymentName , awsRegion , credentialsID , storageConfigurationID , networkID , "" , isNoPublicIpEnabled )
139+ workspace , err = client .MWSWorkspaces ().Create (mwsAcctId , workspaceName , deploymentName , awsRegion , credentialsID , storageConfigurationID , networkID , customerManagedKeyId , isNoPublicIpEnabled )
134140 // Sometimes workspaces api is buggy
135141 if err != nil {
136142 time .Sleep (15 * time .Second )
137- workspace , err = client .MWSWorkspaces ().Create (mwsAcctId , workspaceName , deploymentName , awsRegion , credentialsID , storageConfigurationID , networkID , "" , isNoPublicIpEnabled )
143+ workspace , err = client .MWSWorkspaces ().Create (mwsAcctId , workspaceName , deploymentName , awsRegion , credentialsID , storageConfigurationID , networkID , customerManagedKeyId , isNoPublicIpEnabled )
138144 if err != nil {
139145 return err
140146 }
@@ -214,6 +220,10 @@ func resourceMWSWorkspacesRead(d *schema.ResourceData, m interface{}) error {
214220 if err != nil {
215221 return err
216222 }
223+ err = d .Set ("customer_managed_key_id" , workspace .CustomerManagedKeyID )
224+ if err != nil {
225+ return err
226+ }
217227 err = d .Set ("account_id" , workspace .AccountID )
218228 if err != nil {
219229 return err
@@ -272,9 +282,10 @@ func resourceMWSWorkspacePatch(d *schema.ResourceData, m interface{}) error {
272282 credentialsID := d .Get ("credentials_id" ).(string )
273283 storageConfigurationID := d .Get ("storage_configuration_id" ).(string )
274284 networkID := d .Get ("network_id" ).(string )
285+ customerManagedKeyId := d .Get ("customer_managed_key_id" ).(string )
275286 isNoPublicIpEnabled := d .Get ("is_no_public_ip_enabled" ).(bool )
276287
277- err = client .MWSWorkspaces ().Patch (packagedMwsId .MwsAcctId , idInt64 , awsRegion , credentialsID , storageConfigurationID , networkID , isNoPublicIpEnabled )
288+ err = client .MWSWorkspaces ().Patch (packagedMwsId .MwsAcctId , idInt64 , awsRegion , credentialsID , storageConfigurationID , networkID , customerManagedKeyId , isNoPublicIpEnabled )
278289 if err != nil {
279290 return err
280291 }
0 commit comments