-
Notifications
You must be signed in to change notification settings - Fork 99
Closed
Description
Module version
v1.3
Relevant provider source code
var frameworkResourceSchema = schema.Schema{
Attributes: map[string]schema.Attribute{
"expiry": schema.StringAttribute{
Description: "When this token will expire. Personal Access Tokens cannot be renewed, so after " +
"this time the token will be completely unusable and a new token will need to be generated. Tokens " +
"may be created with 'null' as their expiry and will never expire unless revoked. Format: " +
helper.TIME_FORMAT,
Optional: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplaceIf(
func(
ctx context.Context,
sr planmodifier.StringRequest,
rrifr *stringplanmodifier.RequiresReplaceIfFuncResponse,
) {
rrifr.RequiresReplace = !helper.CompareTimeStrings(
sr.PlanValue.ValueString(),
sr.StateValue.ValueString(),
time.RFC3339,
)
},
RequireReplacementWhenScopesChangedDescription,
RequireReplacementWhenScopesChangedDescription,
),
},
Validators: []validator.String{
helper.NewDateTimeStringValidator(time.RFC3339),
},
CustomType: customtypes.RFC3339TimeStringType{},
},
"created": schema.StringAttribute{
Description: "The date and time this token was created.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
CustomType: customtypes.RFC3339TimeStringType{},
},
// ... other attrs
},
}Terraform Configuration Files
resource "linode_token" "foo" {
scopes = "linodes:read_only"
expiry = "2030-01-02T04:04:05+01:00"
}Expected Behavior
Successfully apply the configuration to the cloud.
Actual Behavior
Planning failed. Terraform encountered an error while generating this plan.
╷
│ Error: Value Conversion Error
│
│ with linode_token.foo,
│ on main.tf line 16, in resource "linode_token" "foo":
│ 16: expiry = "2030-01-02T04:04:05Z"
│
│ An unexpected error was encountered while verifying an attribute value matched its expected type to prevent unexpected behavior or panics. This is always an error in the provider. Please
│ report the following to the provider developer:
│
│ Expected type: RFC3339TimeStringType
│ Value type: basetypes.StringType
│ Path: expiry
Steps to Reproduce
terraform initterraform plan
Custom type
The example from the docs, https://developer.hashicorp.com/terraform/plugin/framework/handling-data/custom-types
jawnsy
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working