Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to create schema for variables #49

Merged
merged 1 commit into from
Jun 1, 2021

Conversation

beandrad
Copy link
Contributor

@beandrad beandrad commented Jun 1, 2021

Given a map of module variables, create the corresponding body
schema with the corresponding variables as attribute schemas.

Related to hashicorp/terraform-ls#50.

Kind: lang.PlainTextKind,
},
Expr: schema.ExprConstraints{schema.LiteralTypeExpr{Type: v.Type}},
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting for support for sensitive attributes (hashicorp/hcl-lang#42)

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM aside from the extra blank lines. 👍🏻

I would probably prefer for this to be merged and deal with IsSensitive in a separate following PR because it will require some other changes here as well so that provider-flagged sensitivity is reflected too:

cAttrs[name] = &schema.AttributeSchema{
Description: markupContent(attr.Description, attr.DescriptionKind),
IsDeprecated: attr.Deprecated,
IsComputed: attr.Computed,
IsOptional: attr.Optional,
IsRequired: attr.Required,
Expr: exprConstraintsFromAttribute(attr),
}

schema/variable_schema_test.go Outdated Show resolved Hide resolved
schema/variable_schema_test.go Outdated Show resolved Hide resolved
Given a map of module variables, create the corresponding body
schema with the corresponding variables as attribute schemas.

Related to hashicorp/terraform-ls#50.
@beandrad beandrad force-pushed the ia.variable-schema branch from c73daa9 to a1b1192 Compare June 1, 2021 14:18
@radeksimko
Copy link
Member

radeksimko commented Jun 1, 2021

btw. I would usually recommend an additional test which runs Validate(), but I reckon that would be failing at this point as per our conversation in hashicorp/hcl-lang#42 (comment) so we can probably just add it later when earlydecoder gains the ability to parse default values.

This will make it an interesting test for hcl-lang decoder to see how it deals with schema that was previously seen as "invalid" (not optional nor required) 😅

@radeksimko radeksimko merged commit f0b01c2 into hashicorp:main Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants