@@ -58,7 +58,15 @@ func (r *logicallyAirGappedVaultResource) Schema(ctx context.Context, request re
5858 response .Schema = schema.Schema {
5959 Attributes : map [string ]schema.Attribute {
6060 names .AttrARN : framework .ARNAttributeComputedOnly (),
61- names .AttrID : framework .IDAttribute (),
61+ "encryption_key_arn" : schema.StringAttribute {
62+ CustomType : fwtypes .ARNType ,
63+ Optional : true ,
64+ Computed : true ,
65+ PlanModifiers : []planmodifier.String {
66+ stringplanmodifier .RequiresReplace (),
67+ },
68+ },
69+ names .AttrID : framework .IDAttribute (),
6270 "max_retention_days" : schema.Int64Attribute {
6371 Required : true ,
6472 PlanModifiers : []planmodifier.Int64 {
@@ -74,14 +82,6 @@ func (r *logicallyAirGappedVaultResource) Schema(ctx context.Context, request re
7482 int64planmodifier .RequiresReplace (),
7583 },
7684 },
77- "encryption_key_arn" : schema.StringAttribute {
78- CustomType : fwtypes .ARNType ,
79- Optional : true ,
80- Computed : true ,
81- PlanModifiers : []planmodifier.String {
82- stringplanmodifier .RequiresReplace (),
83- },
84- },
8585 names .AttrName : schema.StringAttribute {
8686 Required : true ,
8787 Validators : []validator.String {
@@ -111,9 +111,9 @@ func (r *logicallyAirGappedVaultResource) Create(ctx context.Context, request re
111111
112112 conn := r .Meta ().BackupClient (ctx )
113113
114- name := data .BackupVaultName . ValueString ( )
115- input := & backup.CreateLogicallyAirGappedBackupVaultInput {}
116- response .Diagnostics .Append (fwflex .Expand (ctx , data , input )... )
114+ name := fwflex . StringValueFromFramework ( ctx , data .BackupVaultName )
115+ var input backup.CreateLogicallyAirGappedBackupVaultInput
116+ response .Diagnostics .Append (fwflex .Expand (ctx , data , & input )... )
117117 if response .Diagnostics .HasError () {
118118 return
119119 }
@@ -122,7 +122,7 @@ func (r *logicallyAirGappedVaultResource) Create(ctx context.Context, request re
122122 input .BackupVaultTags = getTagsIn (ctx )
123123 input .CreatorRequestId = aws .String (sdkid .UniqueId ())
124124
125- output , err := conn .CreateLogicallyAirGappedBackupVault (ctx , input )
125+ output , err := conn .CreateLogicallyAirGappedBackupVault (ctx , & input )
126126
127127 if err != nil {
128128 response .Diagnostics .AddError (fmt .Sprintf ("creating Backup Logically Air Gapped Vault (%s)" , name ), err .Error ())
@@ -132,12 +132,12 @@ func (r *logicallyAirGappedVaultResource) Create(ctx context.Context, request re
132132
133133 // Set values for unknowns.
134134 data .BackupVaultARN = fwflex .StringToFramework (ctx , output .BackupVaultArn )
135- data .ID = fwflex .StringToFramework (ctx , output . BackupVaultName )
135+ data .ID = fwflex .StringValueToFramework (ctx , name )
136136
137- vault , err := waitLogicallyAirGappedVaultCreated (ctx , conn , data . ID . ValueString () , r .CreateTimeout (ctx , data .Timeouts ))
137+ vault , err := waitLogicallyAirGappedVaultCreated (ctx , conn , name , r .CreateTimeout (ctx , data .Timeouts ))
138138 if err != nil {
139139 response .State .SetAttribute (ctx , path .Root (names .AttrID ), data .ID ) // Set 'id' so as to taint the resource.
140- response .Diagnostics .AddError (fmt .Sprintf ("waiting for Backup Logically Air Gapped Vault (%s) create" , data . ID . ValueString () ), err .Error ())
140+ response .Diagnostics .AddError (fmt .Sprintf ("waiting for Backup Logically Air Gapped Vault (%s) create" , name ), err .Error ())
141141
142142 return
143143 }
@@ -159,7 +159,8 @@ func (r *logicallyAirGappedVaultResource) Read(ctx context.Context, request reso
159159
160160 conn := r .Meta ().BackupClient (ctx )
161161
162- output , err := findLogicallyAirGappedBackupVaultByName (ctx , conn , data .ID .ValueString ())
162+ name := fwflex .StringValueFromFramework (ctx , data .ID )
163+ output , err := findLogicallyAirGappedBackupVaultByName (ctx , conn , name )
163164
164165 if tfresource .NotFound (err ) {
165166 response .Diagnostics .Append (fwdiag .NewResourceNotFoundWarningDiagnostic (err ))
@@ -169,7 +170,7 @@ func (r *logicallyAirGappedVaultResource) Read(ctx context.Context, request reso
169170 }
170171
171172 if err != nil {
172- response .Diagnostics .AddError (fmt .Sprintf ("reading Backup Logically Air Gapped Vault (%s)" , data . ID . ValueString () ), err .Error ())
173+ response .Diagnostics .AddError (fmt .Sprintf ("reading Backup Logically Air Gapped Vault (%s)" , name ), err .Error ())
173174
174175 return
175176 }
@@ -192,8 +193,9 @@ func (r *logicallyAirGappedVaultResource) Delete(ctx context.Context, request re
192193
193194 conn := r .Meta ().BackupClient (ctx )
194195
196+ name := fwflex .StringValueFromFramework (ctx , data .ID )
195197 input := backup.DeleteBackupVaultInput {
196- BackupVaultName : fwflex . StringFromFramework ( ctx , data . ID ),
198+ BackupVaultName : aws . String ( name ),
197199 }
198200 _ , err := conn .DeleteBackupVault (ctx , & input )
199201
@@ -202,7 +204,7 @@ func (r *logicallyAirGappedVaultResource) Delete(ctx context.Context, request re
202204 }
203205
204206 if err != nil {
205- response .Diagnostics .AddError (fmt .Sprintf ("deleting Backup Logically Air Gapped Vault (%s)" , data . ID . ValueString () ), err .Error ())
207+ response .Diagnostics .AddError (fmt .Sprintf ("deleting Backup Logically Air Gapped Vault (%s)" , name ), err .Error ())
206208
207209 return
208210 }
@@ -212,10 +214,10 @@ type logicallyAirGappedVaultResourceModel struct {
212214 framework.WithRegionModel
213215 BackupVaultARN types.String `tfsdk:"arn"`
214216 BackupVaultName types.String `tfsdk:"name"`
217+ EncryptionKeyARN fwtypes.ARN `tfsdk:"encryption_key_arn"`
215218 ID types.String `tfsdk:"id"`
216219 MaxRetentionDays types.Int64 `tfsdk:"max_retention_days"`
217220 MinRetentionDays types.Int64 `tfsdk:"min_retention_days"`
218- EncryptionKeyArn fwtypes.ARN `tfsdk:"encryption_key_arn"`
219221 Tags tftags.Map `tfsdk:"tags"`
220222 TagsAll tftags.Map `tfsdk:"tags_all"`
221223 Timeouts timeouts.Value `tfsdk:"timeouts"`
@@ -261,7 +263,6 @@ func waitLogicallyAirGappedVaultCreated(ctx context.Context, conn *backup.Client
261263 }
262264
263265 outputRaw , err := stateConf .WaitForStateContext (ctx )
264-
265266 if output , ok := outputRaw .(* backup.DescribeBackupVaultOutput ); ok {
266267 return output , err
267268 }
0 commit comments