Skip to content

Conversation

brlee19
Copy link

@brlee19 brlee19 commented Sep 19, 2025

unitScale := map[string]interface{}{}
unitScale["unit_name"] = []map[string]interface{}{{"unit_name": v.UnitName}}
unitScale := map[string]interface{}{"unit_name": v.UnitName}
m["unit_scale"] = []map[string]interface{}{unitScale}
Copy link
Author

@brlee19 brlee19 Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The schema for this is:

"unit_scale": &schema.Schema{
			Description: "",
			Type:        schema.TypeList,
			MinItems:    0,
			MaxItems:    1,
			Optional:    true,
			Elem: &schema.Resource{
				Schema: map[string]*schema.Schema{
					"unit_name": &schema.Schema{
						Description: "",
						Type:        schema.TypeString,
						Required:    true,
					},
				},
			},
		},

so m["unit_scale"] is supposed to contain a list of map[string]string if I am reading this right, not another map containing "unit_name" as a key

Copy link
Author

@brlee19 brlee19 Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old code appears to be the cause of the error per the CI output:

level=fatal msg="Execution failed" error="error: error generating plan: exit status 1\n\nError: widget.1.group_definition.0.widget.0.query_value_definition.0.request.0.formula.0.number_format.0.unit_scale.0.unit_name: '' expected type 'string', got unconvertible type '[]map[string]interface {}', value: '[map[unit_name:0xc0009716e0]]'\n\n with datadog_dashboard.maze_api_dashboard,\n on dashboard.tf line 1, in resource \"datadog_dashboard\" \"maze_api_dashboard\":\n 1: resource \"datadog_dashboard\" \"maze_api_dashboard\" {\n\n code: INVALID_ARGUMENT origin: terraform-invocation, action: plan, cause: USER, resource: \n"

aka it is saying that the first element of unit_scale had a []map[string]interface {}' at its unit_name key and not just a string

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure why the old code was working until Wednesday though this probably has something to do with the new release that day.

@brlee19 brlee19 marked this pull request as ready for review September 24, 2025 14:45
@brlee19 brlee19 requested review from a team as code owners September 24, 2025 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant