@@ -606,7 +606,23 @@ func resourceComputeInstance() *schema.Resource {
606606 },
607607 },
608608 },
609-
609+ "confidential_instance_config" : {
610+ Type : schema .TypeList ,
611+ MaxItems : 1 ,
612+ Optional : true ,
613+ ForceNew : true ,
614+ Computed : true ,
615+ Description : `The Confidential VM config being used by the instance. on_host_maintenance has to be set to TERMINATE or this will fail to create.` ,
616+ Elem : & schema.Resource {
617+ Schema : map [string ]* schema.Schema {
618+ "enable_confidential_compute" : {
619+ Type : schema .TypeBool ,
620+ Required : true ,
621+ Description : `Defines whether the instance should have confidential compute enabled.` ,
622+ },
623+ },
624+ },
625+ },
610626 "desired_status" : {
611627 Type : schema .TypeString ,
612628 Optional : true ,
@@ -795,25 +811,26 @@ func expandComputeInstance(project string, d *schema.ResourceData, config *Confi
795811
796812 // Create the instance information
797813 return & computeBeta.Instance {
798- CanIpForward : d .Get ("can_ip_forward" ).(bool ),
799- Description : d .Get ("description" ).(string ),
800- Disks : disks ,
801- MachineType : machineTypeUrl ,
802- Metadata : metadata ,
803- Name : d .Get ("name" ).(string ),
804- NetworkInterfaces : networkInterfaces ,
805- Tags : resourceInstanceTags (d ),
806- Labels : expandLabels (d ),
807- ServiceAccounts : expandServiceAccounts (d .Get ("service_account" ).([]interface {})),
808- GuestAccelerators : accels ,
809- MinCpuPlatform : d .Get ("min_cpu_platform" ).(string ),
810- Scheduling : scheduling ,
811- DeletionProtection : d .Get ("deletion_protection" ).(bool ),
812- Hostname : d .Get ("hostname" ).(string ),
813- ForceSendFields : []string {"CanIpForward" , "DeletionProtection" },
814- ShieldedInstanceConfig : expandShieldedVmConfigs (d ),
815- DisplayDevice : expandDisplayDevice (d ),
816- ResourcePolicies : convertStringArr (d .Get ("resource_policies" ).([]interface {})),
814+ CanIpForward : d .Get ("can_ip_forward" ).(bool ),
815+ Description : d .Get ("description" ).(string ),
816+ Disks : disks ,
817+ MachineType : machineTypeUrl ,
818+ Metadata : metadata ,
819+ Name : d .Get ("name" ).(string ),
820+ NetworkInterfaces : networkInterfaces ,
821+ Tags : resourceInstanceTags (d ),
822+ Labels : expandLabels (d ),
823+ ServiceAccounts : expandServiceAccounts (d .Get ("service_account" ).([]interface {})),
824+ GuestAccelerators : accels ,
825+ MinCpuPlatform : d .Get ("min_cpu_platform" ).(string ),
826+ Scheduling : scheduling ,
827+ DeletionProtection : d .Get ("deletion_protection" ).(bool ),
828+ Hostname : d .Get ("hostname" ).(string ),
829+ ForceSendFields : []string {"CanIpForward" , "DeletionProtection" },
830+ ConfidentialInstanceConfig : expandConfidentialInstanceConfig (d ),
831+ ShieldedInstanceConfig : expandShieldedVmConfigs (d ),
832+ DisplayDevice : expandDisplayDevice (d ),
833+ ResourcePolicies : convertStringArr (d .Get ("resource_policies" ).([]interface {})),
817834 }, nil
818835}
819836
@@ -1106,7 +1123,7 @@ func resourceComputeInstanceRead(d *schema.ResourceData, meta interface{}) error
11061123 d .Set ("description" , instance .Description )
11071124 d .Set ("hostname" , instance .Hostname )
11081125 d .Set ("current_status" , instance .Status )
1109-
1126+ d . Set ( "confidential_instance_config" , flattenConfidentialInstanceConfig ( instance . ConfidentialInstanceConfig ))
11101127 if d .Get ("desired_status" ) != "" {
11111128 d .Set ("desired_status" , instance .Status )
11121129 }
0 commit comments