Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Consider allowing configuration oftfjson.Plan to use JSON number #111

Closed
Labels
enhancementNew feature or request
@bendbennett

Description

@bendbennett

Background

Theterraform-exec Go module explicitly sets theuseJSONNumber field to true on thetfjson.State struct by callingUseJSONNumber(true) within theShow() method prior to the implicit call toUnmarshalJSON() ontfjson.State. As a consequence, numerical values that are returned when the state is obtained by calling theShow() method on terraform-exec are of typejson.Number.

Thetfjson.Plan struct does not currently surface a way to modify the handling of numerical values when decoding JSON, as there is nouseJSONNumber field on thetfjson.Plan struct, and no correspondingUseJSONNumber() method for setting such a field. As a consequence, numerical values that are obtained when calling methods such asShowPlanFile() are of typefloat64.

Use-Case

ThisRFC proposes extending plan check functionality withinterraform-plugin-testing to add plan checks for resource attributes and outputs values with a known value and type. Prototyping these known type and value plan checks revealed the limitations of numerical values being of typefloat64 intfjson.Plan in terms of being able to check their values.

Proposal

Thetfjson.Plan struct could be modified to add auseJSONNumber field, and to expose aUseJSONNumber() method on the struct. TheUnmarshalJSON() method could then be altered to perform JSON decoding in the same way astfjson.State, by checking the value ofuseJSONNumber to determine the decoding strategy for numerical values.

Additional Considerations

If this proposal proceeds, then terraform-exec will also require amending, likely by either adding aShowOption for configuring handling of numerical values, or perhaps, adding an additional function to allow obtaining the plan with JSON number used for numerical values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp