Skip to content

Update complex constraints in core schema to allow any expressions #214

@radeksimko

Description

@radeksimko

Context

After introducing AnyExpression as part of #174 we forgot to also update certain parts of the core schema which involve complex type constraints, such as provisioner blocks:

"inline": {
IsOptional: true,
Constraint: schema.List{
Elem: schema.AnyExpression{OfType: cty.String},
},
Description: lang.Markdown("A list of command strings. They are executed in the order they are provided." +
" This cannot be provided with `script` or `scripts`."),
},

This means that currently we don't allow interpolation in various places, e.g.

Screenshot 2023-05-11 at 16 49 19

Proposal

Go through all places where we use schema.List, schema.Set, schema.Tuple, schema.Map and schema.Object and check if they need updating to schema.OneOf{} variation, such as

Constraint: schema.OneOf{
schema.AnyExpression{OfType: cty.List(cty.String), SkipLiteralComplexTypes: true},
schema.List{
Elem: schema.AnyExpression{OfType: cty.String},
},
},

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions