Hi there,
I try the new 1.50 Plannable import with -generate-config-out
.
import {
to = resource.japan
id = "11-11-11"
}
resource "resource" "japan" {
}
One of the issue is during the command plan terraform plan -generate-config-out=generated_resources.tf
, I get name field is required
but this field is imported, the import command work without any issue terraform import resource.japan 11-11-11
and I can see in the state file that name field is populated.
In my provider I use the following schema for name
"name": {
Description: "name ... .",
Type: types.StringType,
Required: true,
},
When I change required
to computed
it works, but now the field is optional when declaring the resource.
How can I make this field required when defining the resource in the tf file and optional/computed when importing with the -generate-config-out config.