You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
schema.EnvDefaultFunc doesn't work when used as DefaultFunc on a TypeInt resource attribute; works fine with TypeString, TypeBool, TypeFloat attributes.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
schema.EnvDefaultFunc
doesn't work when used asDefaultFunc
on aTypeInt
resource attribute; works fine withTypeString
,TypeBool
,TypeFloat
attributes.SDK version
Steps to Reproduce
Run
go test
in this repository: https://github.com/rudo-thomas/terraform-sdk-default-int-from-env-bug (a snapshot at b3f1b82 isattached).
Relevant provider source code
Expected Behavior
The test should pass.
Actual Behavior
Note: The
1
in the error message is ofstring
type, which I found out by printing the type atterraform-plugin-sdk/helper/schema/schema.go
Line 2053 in 5747fc3
Workaround
To work this around, the
DefaultFunc
set in theSchema
can wrapschema.EnvDefaultFunc(...)()
and convert thestring
to anint
.The text was updated successfully, but these errors were encountered: