Comments (4)
This is actually a feature I would love to have (hence the caveat in the doco about the current limitation). To be honest, I don't know if it is possible and would appreciate any research you can share. My assumption is that to be able to have a compound type in Terraform, the structure of that type must be known ahead of time in the provider declaration with Terraform. I make this assumption because I haven't seen a complex, dynamic object in other providers yet.
Relevant link - This validation method for objects requires all keys to be known:
https://github.com/hashicorp/terraform/blob/master/helper/schema/schema.go#L1507
from terraform-provider-restapi.
Thanks. I will research. I work at HashiCorp and might be able to ask some Terraform experts.
from terraform-provider-restapi.
Hi @DRuggeri : I had a discussion with several members of the Terraform team about this today. They said this could not be done today with Terraform 0.11 because it does not allow an attribute to be declared as map[string]interface{}
which is what would be needed to support this.
The deep copy I suggested would have broken the code because api_data is declared in https://github.com/Mastercard/terraform-provider-restapi/blob/master/restapi/common.go#L59 as map[string]string
and the nested strings could not themselves be maps. In retrospect, that should have been obvious to me.
However, they did suggest that the situation might be better in Terraform 0.12 which is adding a jsondecode() function in connection with rich value types. You might want to review https://www.hashicorp.com/blog/terraform-0-12-rich-value-types although that does not mention the jsondecode() function itself. A blog post that would have talked about jsonencode() and jsondecode() functions was planned, but not published for some reason. I'm sure you'll be able to read about these functions when 0.12 is released.
So, I'm closing this for now. When 0.12 is released, we might want to revisit this.
from terraform-provider-restapi.
Here is a link to the current doc for the new jsondecode() function that is being developed: https://github.com/hashicorp/terraform/blob/2f93ef274103bbeb583a5905e832b6dcf4a88735/website/docs/configuration/functions/jsondecode.html.md
What I think this would allow us to do is store the api_data as a single JSON document and then use Terraform code to decode it and work with nested items no matter how deep.
from terraform-provider-restapi.
Related Issues (20)
- How to build / test local changes to the provider. HOT 3
- import is not documented
- Add support to ignore changes in read-only attributes HOT 2
- Incorrect License Display in GitHub REST API
- How to update predefined resources (already created by default)? HOT 1
- Diff is not shown in case of manual changes outside of terraform
- Error while installing mastercard/restapi v1.18.0: error checking (signature: openpgp: key expired)
- Pulling in data from endpoint with no query parameters?
- Support for different Content-Type / Headers for each method
- Delete API not triggered on destroy (redux)
- [Feature Request] Moving all the parameters from the provider to restapi_object
- Multiple base URIs
- [curl] allow request body, content-type to be provided as strings
- Error: internal validation failed; object ID is not set, but may have been created; this should never happen HOT 1
- terraform import ignore query_string
- restapi_object data is not optional
- Read Data Support Breaks APIs that don't accept a body for GET method HOT 2
- HTTP Method Specific Headers
- Resource not recreated if not found with `read_search`
- Headers in Provider Block Not Passed to GET Requests During `terraform refresh` and Subsequent `terraform plan` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-provider-restapi.