func validateDuplicatedDefinitions()

in internal/services/azapi_resource.go [1256:1274]


func validateDuplicatedDefinitions(model *AzapiResourceModel, body types.Dynamic) diag.Diagnostics {
	diags := diag.Diagnostics{}
	if body.IsNull() || body.IsUnknown() || body.IsUnderlyingValueNull() || body.IsUnderlyingValueUnknown() {
		return diags
	}

	if bodyObject, ok := body.UnderlyingValue().(types.Object); ok {
		if !model.Tags.IsNull() && !model.Tags.IsUnknown() && bodyObject.Attributes()["tags"] != nil {
			diags.AddError("Invalid configuration", `can't specify both the argument "tags" and "tags" in the argument "body"`)
		}
		if !model.Location.IsNull() && !model.Location.IsUnknown() && bodyObject.Attributes()["location"] != nil {
			diags.AddError("Invalid configuration", `can't specify both the argument "location" and "location" in the argument "body"`)
		}
		if !model.Identity.IsNull() && !model.Identity.IsUnknown() && bodyObject.Attributes()["identity"] != nil {
			diags.AddError("Invalid configuration", `can't specify both the argument "identity" and "identity" in the argument "body"`)
		}
	}
	return diags
}