@@ -66,6 +66,7 @@ type awsModel struct {
6666
6767type gcpModel struct {
6868 ProjectID types.String `tfsdk:"project_id"`
69+ InstanceServiceAccount types.String `tfsdk:"instance_service_account"`
6970 ClientServiceAccountJSONBase64WO types.String `tfsdk:"client_service_account_json_base64_wo"`
7071 NetworkName types.String `tfsdk:"network_name"`
7172 SubnetName types.String `tfsdk:"subnet_name"`
@@ -108,7 +109,8 @@ func (m gcpModel) Equal(other *gcpModel) bool {
108109 return m .ProjectID .Equal (other .ProjectID ) &&
109110 m .NetworkName .Equal (other .NetworkName ) &&
110111 m .SubnetName .Equal (other .SubnetName ) &&
111- m .NetworkTags .Equal (other .NetworkTags )
112+ m .NetworkTags .Equal (other .NetworkTags ) &&
113+ m .InstanceServiceAccount .Equal (other .InstanceServiceAccount )
112114}
113115
114116func (m ociModel ) credentials () types.String {
@@ -260,6 +262,10 @@ func (r *edgeLocationResource) Schema(_ context.Context, _ resource.SchemaReques
260262 Required : true ,
261263 Description : "GCP project ID where edges run" ,
262264 },
265+ "instance_service_account" : schema.StringAttribute {
266+ Optional : true ,
267+ Description : "GCP service account email to be attached to edge instances. It can be used to grant permissions to access other GCP resources." ,
268+ },
263269 "client_service_account_json_base64_wo" : schema.StringAttribute {
264270 Required : true ,
265271 Sensitive : true ,
@@ -736,8 +742,14 @@ func (r *edgeLocationResource) toGCP(ctx context.Context, plan, config *gcpModel
736742 return nil , diags
737743 }
738744
745+ var instanceServiceAccount * string
746+ if ! plan .InstanceServiceAccount .IsNull () && plan .InstanceServiceAccount .ValueString () != "" {
747+ instanceServiceAccount = lo .ToPtr (plan .InstanceServiceAccount .ValueString ())
748+ }
749+
739750 out := & omni.GCPParam {
740- ProjectId : plan .ProjectID .ValueString (),
751+ ProjectId : plan .ProjectID .ValueString (),
752+ InstanceServiceAccount : instanceServiceAccount ,
741753 Credentials : & omni.GCPParamCredentials {
742754 ClientServiceAccountJsonBase64 : config .ClientServiceAccountJSONBase64WO .ValueString (),
743755 },
@@ -759,12 +771,17 @@ func (r *edgeLocationResource) toGCPModel(ctx context.Context, config *omni.GCPP
759771
760772 gcp := & gcpModel {
761773 ProjectID : types .StringValue (config .ProjectId ),
774+ InstanceServiceAccount : types .StringNull (),
762775 ClientServiceAccountJSONBase64WO : types .StringNull (),
763776 NetworkName : types .StringNull (),
764777 SubnetName : types .StringNull (),
765778 NetworkTags : types .SetNull (types .StringType ),
766779 }
767780
781+ if config .InstanceServiceAccount != nil {
782+ gcp .InstanceServiceAccount = types .StringValue (* config .InstanceServiceAccount )
783+ }
784+
768785 if config .Networking != nil {
769786 gcp .NetworkName = types .StringValue (config .Networking .NetworkName )
770787 gcp .SubnetName = types .StringValue (config .Networking .SubnetName )
0 commit comments