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

schema: Introduce Extensions to BodySchema #118

Closed
6 tasks done
Tracked by #860 ...
radeksimko opened this issue Jun 1, 2022 · 1 comment
Closed
6 tasks done
Tracked by #860 ...

schema: Introduce Extensions to BodySchema #118

radeksimko opened this issue Jun 1, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@radeksimko
Copy link
Member

radeksimko commented Jun 1, 2022

Background

There is a number of "extensions" to HCL. Features which are not natively supported, or rather implemented by the tool such as Terraform.

Three of the above features are Terraform specific, but it would be likely difficult to try to express how these features work via schema alone. It seems more sensible to introduce them as features to hcl-lang and then have individual servers just opt in via schema.

Proposal

The proposal is based on a prototype available https://github.com/hashicorp/hcl-lang/compare/f-local-refs and https://github.com/hashicorp/terraform-schema/compare/f-local-refs

type BodySchema struct {
// ...
	// Extensions represents any HCL extensions supported in this body
	Extensions *BodyExtensions
}

type BodyExtensions struct {
	Count         bool // count attribute + count.index refs
	ForEach       bool // for_each attribute + each.* refs
	DynamicBlocks bool // dynamic "block-name" w/ content & for_each inside
	SelfRefs      bool // self.* refs which refer to outermost parent block body
}

Unknowns

Once supported per hashicorp/terraform-schema#92 Terraform's precondition/postcondition blocks may need some minor adjustments as these are more than 1 level away from the relevant block they refer to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants