@@ -56,6 +56,7 @@ type zoneModel struct {
5656
5757type awsModel struct {
5858 AccountID types.String `tfsdk:"account_id"`
59+ InstanceProfile types.String `tfsdk:"instance_profile"`
5960 AccessKeyIDWO types.String `tfsdk:"access_key_id_wo"`
6061 SecretAccessKeyWO types.String `tfsdk:"secret_access_key_wo"`
6162 VpcID types.String `tfsdk:"vpc_id"`
@@ -97,7 +98,8 @@ func (m awsModel) Equal(other *awsModel) bool {
9798 m .VpcID .Equal (other .VpcID ) &&
9899 m .VpcPeered .Equal (other .VpcPeered ) &&
99100 m .SecurityGroupID .Equal (other .SecurityGroupID ) &&
100- m .SubnetIDs .Equal (other .SubnetIDs )
101+ m .SubnetIDs .Equal (other .SubnetIDs ) &&
102+ m .InstanceProfile .Equal (other .InstanceProfile )
101103}
102104
103105func (m gcpModel ) credentials () types.String {
@@ -225,6 +227,10 @@ func (r *edgeLocationResource) Schema(_ context.Context, _ resource.SchemaReques
225227 Required : true ,
226228 Description : "AWS account ID" ,
227229 },
230+ "instance_profile" : schema.StringAttribute {
231+ Optional : true ,
232+ Description : "AWS IAM instance profile ARN to be attached to edge instances. It can be used to grant permissions to access other AWS resources such as ECR." ,
233+ },
228234 "access_key_id_wo" : schema.StringAttribute {
229235 Required : true ,
230236 WriteOnly : true ,
@@ -688,8 +694,14 @@ func (r *edgeLocationResource) toAWS(ctx context.Context, plan, config *awsModel
688694 return nil , diags
689695 }
690696
697+ var instanceProfile * string
698+ if ! plan .InstanceProfile .IsNull () && plan .InstanceProfile .ValueString () != "" {
699+ instanceProfile = lo .ToPtr (plan .InstanceProfile .ValueString ())
700+ }
701+
691702 out := & omni.AWSParam {
692- AccountId : toPtr (plan .AccountID .ValueString ()),
703+ AccountId : toPtr (plan .AccountID .ValueString ()),
704+ InstanceProfile : instanceProfile ,
693705 Credentials : & omni.AWSParamCredentials {
694706 AccessKeyId : config .AccessKeyIDWO .ValueString (),
695707 SecretAccessKey : config .SecretAccessKeyWO .ValueString (),
@@ -716,6 +728,7 @@ func (r *edgeLocationResource) toAWSModel(ctx context.Context, config *omni.AWSP
716728
717729 aws := & awsModel {
718730 AccountID : types .StringValue (lo .FromPtr (config .AccountId )),
731+ InstanceProfile : types .StringNull (),
719732 VpcID : types .StringNull (),
720733 SecurityGroupID : types .StringNull (),
721734 VpcPeered : types .BoolNull (),
@@ -725,6 +738,10 @@ func (r *edgeLocationResource) toAWSModel(ctx context.Context, config *omni.AWSP
725738 SecretAccessKeyWO : types .StringNull (),
726739 }
727740
741+ if config .InstanceProfile != nil && * config .InstanceProfile != "" {
742+ aws .InstanceProfile = types .StringValue (* config .InstanceProfile )
743+ }
744+
728745 if config .Networking != nil {
729746 aws .VpcID = types .StringValue (config .Networking .VpcId )
730747 aws .VpcPeered = types .BoolPointerValue (config .Networking .VpcPeered )
0 commit comments