Skip to content

Required TF properties with a DefaultFunc should be optional in Pulumi #2204

@thomas11

Description

@thomas11

When a property is defined like this in TF:

	"metadata_host": {
		Type:        pluginsdk.TypeString,
		Required:    true,
		DefaultFunc: pluginsdk.EnvDefaultFunc("ARM_METADATA_HOSTNAME", ""),
		Description: "The Hostname which should be used for the Azure Metadata Service.",
	},

Then the bridge will mark it as required in Pulumi, due to Required: true. However, since there is also a DefaultFunc, things work differently in Terraform: theDefaultFunc's return value will be used if the user doesn't specify a value, and the function itself returns a default from its second argument. So a value is guaranteed, even if it's the empty string.

Therefore, Pulumi should probably mark this property as optional.

See pulumi/pulumi-azuread#362 for the full original issue.

Metadata

Metadata

Labels

kind/bugSome behavior is incorrect or out of specresolution/fixedThis issue was fixed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions