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

types: Introduce ListValueFrom, MapValueFrom, ObjectValueFrom, and SetValueFrom functions #522

Merged
merged 2 commits into from Oct 25, 2022

Commits on Oct 24, 2022

  1. types: Introduce ListValueFrom, MapValueFrom, ObjectValueFrom, and Se…

    …tValueFrom functions
    
    Reference: #520
    
    These will enable provider developers to use the framework type system's built-in conversion rules to create collection types, rather than using more generic `tfsdk.ValueFrom()` or other methodologies.
    
    In this example, a map using standard Go types is used to create a `types.Map` framework type with known values:
    
    ```go
    apiMap := map[string]string{
      "key1": "value1",
      "key2": "value2",
    }
    fwMap, diags := types.MapValueFrom(ctx, types.StringType, apiMap)
    ```
    
    There may be additional use cases or needs that get teased out with this introduction, such as the ability to create a `types.Object` from a `map[string]any`, however those can be handled in potential future feature requests.
    bflad committed Oct 24, 2022
    Copy the full SHA
    3bce0f9 View commit details
    Browse the repository at this point in the history
  2. Update CHANGELOG for #522

    bflad committed Oct 24, 2022
    Copy the full SHA
    8842f33 View commit details
    Browse the repository at this point in the history