Skip to content

inconsistent list element types: cty.ObjectWithOptionalAttrs vs cty.Object #289

@megan07

Description

@megan07

Module version

v0.6.1

Relevant provider source code

			"fields": {
				Description: "A list of fields in the schema.",
				Required:    true,
				Attributes: tfsdk.ListNestedAttributes(map[string]tfsdk.Attribute{
					"field_name": {
						Description: "The name of the field.",
						Type:        types.StringType,
						Required:    true,
						PlanModifiers: []tfsdk.AttributePlanModifier{
							tfsdk.RequiresReplace(),
						},
					},
					"field_id": {
						Description: "The unique identifier of the field.",
						Type:        types.StringType,
						Computed:    true,
					},
					"field_type": {
						Description: "The type of the field. Acceptable values are: " +
							"BOOL, DATE, DOUBLE, EMAIL, INT64, PHONE, STRING",
						Type:     types.StringType,
						Required: true,
						PlanModifiers: []tfsdk.AttributePlanModifier{
							tfsdk.RequiresReplace(),
						},
						Validators: []tfsdk.AttributeValidator{
							stringInSliceValidator{
								stringOptions: []string{"BOOL", "DATE", "DOUBLE", "EMAIL", "INT64", "PHONE", "STRING"},
							},
						},
					},
					"multi_valued": {
						Description: "A boolean specifying whether this is a multi-valued field or not.",
						Type:        types.BoolType,
						Optional:    true,
						Computed:    true,
						PlanModifiers: []tfsdk.AttributePlanModifier{
							DefaultModifier{
								ValType:    types.BoolType,
								DefaultVal: false,
							},
						},
					},
					"indexed": {
						Description: "A boolean specifying whether the field is indexed or not.",
						Type:        types.BoolType,
						Optional:    true,
						Computed:    true,
						PlanModifiers: []tfsdk.AttributePlanModifier{
							DefaultModifier{
								ValType:    types.BoolType,
								DefaultVal: true,
							},
						},
					},
					"display_name": {
						Description: "Display Name of the field.",
						Type:        types.StringType,
						Optional:    true,
						Computed:    true,
					},
					"read_access_type": {
						Description: "Specifies who can view values of this field. " +
							"See Retrieve users as a non-administrator for more information. " +
							"Acceptable values are: ADMINS_AND_SELF or ALL_DOMAIN_USERS. " +
							"Note: It may take up to 24 hours for changes to this field to be reflected.",
						Type:     types.StringType,
						Optional: true,
						Computed: true,
						PlanModifiers: []tfsdk.AttributePlanModifier{
							DefaultModifier{
								ValType:    types.StringType,
								DefaultVal: "ALL_DOMAIN_USERS",
							},
						},
						Validators: []tfsdk.AttributeValidator{
							stringInSliceValidator{
								stringOptions: []string{"ADMINS_AND_SELF", "ALL_DOMAIN_USERS"},
							},
						},
					},
					"numeric_indexing_spec": {
						Description: "Indexing spec for a numeric field. By default, " +
							"only exact match queries will be supported for numeric fields. " +
							"Setting the numericIndexingSpec allows range queries to be supported.",
						Optional: true,
						Attributes: tfsdk.SingleNestedAttributes(map[string]tfsdk.Attribute{
							"min_value": {
								Description: "Minimum value of this field. This is meant to be indicative " +
									"rather than enforced. Values outside this range will still be indexed, " +
									"but search may not be as performant.",
								Type:     types.Float64Type,
								Optional: true,
							},
							"max_value": {
								Description: "Maximum value of this field. This is meant to be indicative " +
									"rather than enforced. Values outside this range will still be indexed, " +
									"but search may not be as performant.",
								Type:     types.Float64Type,
								Optional: true,
							},
						}),
					},
				}, tfsdk.ListNestedAttributesOptions{}),
			}

Terraform Configuration Files

resource "googleworkspace_schema" "my-schema" {
 schema_name = "%{userEmail}-schema"

 fields = [{
   field_name = "birthday"
   field_type = "DATE"
 },{
   field_name = "favorite-numbers"
   field_type = "INT64"
   multi_valued = true

   numeric_indexing_spec = {
     min_value = 1
     max_value = 100
   }
 }]
}

Debug Output

https://gist.github.com/megan07/6f8d0e549239cea14f612ca87b23b40a

Expected Behavior

A Google Workspace Schema would be created, success.

Actual Behavior

Panic, Objects are different, but I'm not sure why

Steps to Reproduce

Running the Google Workspace Full User test using plugin-framework - I can push my branch if you need me to.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions