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

json-output: Add output type to JSON format #30947

Closed
wants to merge 1 commit into from

Conversation

alisdair
Copy link
Member

Backport of #30945 targeting v1.1.


Previously the supported JSON plan and state formats included only serialized output values, which was a lossy serialization of the Terraform type system. This commit adds a type field in the usual cty JSON format, which allows reconstitution of the original value.

For example, previously a list(string) and a set(string) containing the same values were indistinguishable. This change serializes these as follows:

{
  "value": ["a","b","c"],
  "type": ["list","string"]
}

and:

{
  "value": ["a","b","c"],
  "type": ["set","string"]
}

Previously the supported JSON plan and state formats included only
serialized output values, which was a lossy serialization of the
Terraform type system. This commit adds a type field in the usual cty
JSON format, which allows reconstitution of the original value.

For example, previously a list(string) and a set(string) containing the
same values were indistinguishable. This change serializes these as
follows:

{
  "value": ["a","b","c"],
  "type": ["list","string"]
}

and:

{
  "value": ["a","b","c"],
  "type": ["set","string"]
}
@alisdair alisdair self-assigned this Apr 27, 2022
@vercel
Copy link

vercel bot commented Apr 27, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
terraform ✅ Ready (Inspect) Visit Preview Apr 27, 2022 at 6:00PM (UTC)

@alisdair
Copy link
Member Author

On second thought I don't think this is sufficiently urgent to warrant a JSON format version bump in the 1.1 series, so I'm going to skip this and leave it for 1.2.

@alisdair alisdair closed this Apr 27, 2022
@alisdair alisdair deleted the backport/alisdair/jsonstate-output-type branch April 27, 2022 18:05
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant