Skip to content

Integration action - Cannot use attr.Value basetypes.ListValue, only basetypes.ObjectValue is supported because basetypes.ObjectType is the type in the schema #75

@vinitk35

Description

@vinitk35

Terraform Version Used

Terraform v1.11.0

Problem Statment

When defining the filter argument in the atlassian-operations_integration_action resource, Terraform throws a Value Conversion Error even though the configuration matches the documented schema.

Error:

terraform validate

│ Error: Value Conversion Error

│ with module.integration_action.atlassian-operations_integration_action.this,
│ An unexpected error was encountered trying to convert into a Terraform value. This is always an error in the provider. Please report the following to the
│ provider developer:

│ Cannot use attr.Value basetypes.ListValue, only basetypes.ObjectValue is supported because basetypes.ObjectType is the type in the schema

Steps to Reproduce

Create a resource block with filter variable

resource "atlassian-operations_integration_action" "this" {
  integration_id = var.integration_id
  name           = var.name
  type           = var.type
  domain         = var.domain
  direction      = var.direction
  filter = var.filter
  type_specific_properties = jsonencode(var.type_specific_properties)
  field_mappings           = jsonencode(var.field_mappings)
}

variable "integration_id" {
  description = "Integration ID for the email integration"
  type        = string
}

variable "name" {
  description = "Integration action name."
  type        = string
}

variable "type" {
  description = "Action type (e.g., 'create')."
  type        = string
}

variable "domain" {
  description = "Action domain (e.g., 'alert')."
  type        = string
}

variable "direction" {
  description = "Action direction (e.g., 'incoming')."
  type        = string
}

variable "filter" {
  description = "Filter object with list-of-conditions."
  type = object({
    condition_match_type = string
    conditions_empty     = bool
    conditions = list(object({
      field            = string
      operation        = string
      expected_value   = string
      not              = bool
      order            = number
      system_condition = bool
    }))
  })
}

variable "type_specific_properties" {
  description = "HCL object encoded to JSON for type_specific_properties."
  type        = any
  default     = {}
}

variable "field_mappings" {
  description = "HCL object encoded to JSON for field_mappings."
  type        = any
  default     = {}
}

Implementation module

module "integration_action" {
  for_each = { 
    for team in local.email_teams.teams : team.name => team 
    if team.integration_id != null && team.integration_id != ""
    }
  source = "../jsm-ops-modules/integration_action"
  integration_id = each.value.integration_id

  name           = "Create Alert"
  type           = "create"
  domain         = "alert"
  direction      = "incoming"

  filter = {
    condition_match_type = "match-all-conditions"
    conditions_empty     = false
    conditions = [
      {
        field            = "message"
        operation        = "contains"
        expected_value   = "email_type"
        not              = false
        order            = 0
        system_condition = false
      }
    ]
  }

  type_specific_properties = {
    appendAttachments              = true
    keepActionsFromPayload         = false
    keepExtraPropertiesFromPayload = false
    keepRespondersFromPayload      = false
    keepTagsFromPayload            = false
  }

  field_mappings = {
    actions     = []
    alias       = ""
    description = "{{message}}"
    details     = {
      From = "{{from_address}}"
    }
    entity     = ""
    message    = "{{subject}}"
    note       = ""
    priority   = "P5"
    responders = [
      {
        id   = "xxxxxxxxxxxxxxxxxxxxxxx"
        type = "team"
      }
    ]
    source = "Email"
    tags   = ["email"]
    user   = ""
  }
}

Stage of error

terraform validate

Expected Behavior

Terraform should accept the filter object with its nested conditions list, since this matches the provider’s schema (filter is an object, conditions is a list of objects).

Actual Behavior

Terraform fails with a Value Conversion Error, indicating that the provider is incorrectly coercing the filter block into a basetypes.ListValue instead of basetypes.ObjectValue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions