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

Representing Tree Like data structure in terraform #112

Closed
parweza opened this issue Aug 7, 2018 · 5 comments
Closed

Representing Tree Like data structure in terraform #112

parweza opened this issue Aug 7, 2018 · 5 comments
Labels
enhancement New feature or request

Comments

@parweza
Copy link

parweza commented Aug 7, 2018

Terraform Version

Terraform v0.11.7

Representing Tree Like data structure in terraform

Hi,
I am a terraform provider developer and was trying to model following (go representation of data) as terraform resource schema but am not able to do so (terraform validation goes in infinite recursion).
Is it possible to model the following in terraform. if yes , Can you please point me some documentation?

type Model struct {

	FieldType ModelTypeEnum 

	
	FieldName *string


	IsArray *bool 

	Properties []Model 
}
@apparentlymart
Copy link
Contributor

Hi @parweza!

Unfortunately at this time the provider SDK does not support a recursive schema, since some of the operations it does involve traversing the schema tree and -- as you've seen -- there's no guard for cycles.

I'm not sure what's best here with Terraform's current capabilities. If you can share a little more about the underlying system you're working with that might help us come up with some other ideas or "creative" workarounds.

As for making this possible in future: this'd be non-trivial because the provider schema must be sent over the plugin RPC channel and the serialization format we are using (soon to be protobuf in 0.12 and later) does not support recursive data structures itself. However, we'll leave this issue here to remind us of it and consider ways we might make it work in a future release, which'll probably involve a change to the provider RPC protocol.

@mingfang
Copy link

Recursive structures is a real requirement.
If protobuf doesn't support recursive structures then maybe that should not be used in 0.12, no?

@hashibot hashibot transferred this issue from hashicorp/terraform Sep 26, 2019
@hashibot hashibot added the enhancement New feature or request label Oct 2, 2019
@paultyng
Copy link
Contributor

I believe the only way to accomplish this now in 0.12 is dynamic type support, linking this to #248

@paultyng
Copy link
Contributor

This also may be solved by direct support in #261 .

Unfortunately, per Martin's comments above, I don't think this will be possible as TF core does not support any sort of recursive type mechanism.

@ghost
Copy link

ghost commented Dec 26, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Dec 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants