-
Notifications
You must be signed in to change notification settings - Fork 103
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
adds ext-state attribute to StateVersion create #416
Conversation
This will be used in future versions of terraform to supply portable state details to the platform
// https://www.terraform.io/internals/json-format#state-representation | ||
// Supplying this state representation can provide more details to the platform | ||
// about the current terraform state. | ||
ExtState json.RawMessage `jsonapi:"attr,ext-state,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if there is an error in the JSON?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⭐ This looks straight-forward, but I have one question that I'm curious about 🤔 (see the comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good. One question: where would I be able to fetch the external state representation? Is it available in DownloadURL
?
@sebasslash no. At first, it won't be available for consumption in the public API and will be added only to the state parser internal API for use on the platform. Over time, as other useful features are identified, it can become a new download url on the state version resource. |
@annawinkler If the error makes the json unparsable, the API will return a bad request response with details (BaseController L56). I don't think it's worthwhile to try and parse it all in this library as a validation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminder to the contributor that merged this PR: if your changes have added important functionality or fixed a relevant bug, open a follow-up PR to update CHANGELOG.md with a note on your changes. |
Description
This will be used in future versions of terraform to supply portable state details to the platform
The type, json.RawMessage, is defined as "a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding."
The encoding of the attribute is meant to be "any json object" and the backend does some basic validation on the message (it must have both "format_version" and "values" attributes.)
Testing plan
Output from tests
Including output from tests may require access to a TFE instance. Ignore this section if you have no environment to test against.