Skip to content

Commit

Permalink
r/aws_elasticache_reserved_cache_node: fix start_time schema type
Browse files Browse the repository at this point in the history
The `StartTime` value returned from AWS is a `time.Time` type, so the corresponding Terraform schema should use a custom `timetypes.RFC3339` type for AutoFlex to function properly. This change should prevent `Provider returned invalid result object after apply` errors during creation.
  • Loading branch information
jar-b committed Nov 11, 2024
1 parent 0c6d8bc commit 2a09a76
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/40090.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_elasticache_reserved_cache_node: Fix `Provider returned invalid result object after apply` errors
```
6 changes: 4 additions & 2 deletions internal/service/elasticache/reserved_cache_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/elasticache"
awstypes "github.com/aws/aws-sdk-go-v2/service/elasticache/types"
"github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts"
"github.com/hashicorp/terraform-plugin-framework-timetypes/timetypes"
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
Expand Down Expand Up @@ -105,7 +106,8 @@ func (r *resourceReservedCacheNode) Schema(ctx context.Context, request resource
},
},
names.AttrStartTime: schema.StringAttribute{
Computed: true,
CustomType: timetypes.RFC3339Type{},
Computed: true,
},
names.AttrState: schema.StringAttribute{
Computed: true,
Expand Down Expand Up @@ -232,7 +234,7 @@ type resourceReservedCacheNodeModel struct {
OfferingType types.String `tfsdk:"offering_type"`
ProductDescription types.String `tfsdk:"product_description"`
RecurringCharges fwtypes.ListNestedObjectValueOf[recurringChargeModel] `tfsdk:"recurring_charges"`
StartTime types.String `tfsdk:"start_time"`
StartTime timetypes.RFC3339 `tfsdk:"start_time"`
State types.String `tfsdk:"state"`
Tags tftags.Map `tfsdk:"tags"`
TagsAll tftags.Map `tfsdk:"tags_all"`
Expand Down

0 comments on commit 2a09a76

Please sign in to comment.