terraform-provider-jira icon indicating copy to clipboard operation
terraform-provider-jira copied to clipboard

Problem with populating a single select type custom field

Open iwonazytkiewicz opened this issue 3 years ago • 6 comments

Tested with terraform 0.13 and 1.0.9 on jira server and jira data center (8.19.1)

Provider fails when I try to populate a single select custom field. I think the issue is because for the single select custom field according to the jira developers documentation a map of key and value has to be passed: https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#selectlist But the https://github.com/fourplusone/terraform-provider-jira/blob/master/jira/resource_field.go seems to expect string at this point and hence does not work. I tried few times with different configurations for the customfield_10112 which is of type single select. If I try to set the value as a map (as expected by jira documentation for this type of custom field I get error in terraform plan phase: **` │ Error: Incorrect attribute value type │ │ on main.tf line 44, in resource "jira_issue" "example": │ 44: fields = { │ 45: (data.jira_field.epic_link.id) = "TRY-1" │ 46: (data.jira_field.app_ci.id) = tomap({ "id" = "10003" }) │ 47: } │ ├──────────────── │ │ data.jira_field.app_ci.id is "customfield_10112" │ │ data.jira_field.epic_link.id is "customfield_10101" │

variable app_ci_cmdb { │ Inappropriate value for attribute "fields": element "customfield_10112": string required. `** If I set string as data.jira_field.app_ci.id as expected to be a string, I get error in terraform apply phase: image

jira_issue.example: Creating...

╷ │ Error: creating jira issue failed: {"errorMessages":[],"errors":{"customfield_10112":"Could not find valid 'id' or 'value' in the Parent Option object."}}: request failed. Please analyze the request body for more details. Status code: 400

Here is the sample code: main.tf.txt

iwonazytkiewicz avatar Oct 16 '21 19:10 iwonazytkiewicz

Same issue here (Terraform v1.0.2 and Jira Cloud):

data "jira_field" "change_risk" {
  name = "Change risk"
}

resource "jira_issue" "change_request" {
  project_key = "CR"
  issue_type = "Change"
  summary = "Summary"
  description = "Description"
  fields = {
    (data.jira_field.change_risk.id) = "Low",
  }
}

When running terraform apply, I get:

Error: updating jira issue failed: : customfield_14302 - Specify a valid 'id' or 'name' for Change risk: request failed. Please analyze the request body for more details. Status code: 400

fransf-wtax avatar Jan 21 '22 08:01 fransf-wtax

I met as well, any idea for to figure out?

gonchik avatar Feb 17 '22 16:02 gonchik

Same issue here, any work around in the meanwhile?

GlorifiedTypist avatar Mar 25 '22 10:03 GlorifiedTypist

Any updates on this?

jcavet avatar Feb 02 '23 21:02 jcavet

Seems like this provider is no longer supported by the developers. The fields issues are many and never got fixed,

araykov avatar Aug 23 '24 10:08 araykov

I just ran into this as well. I think https://github.com/fourplusone/terraform-provider-jira/pull/25 would address the issue. It looks like when a custom field has a list of options you can't just set to the string that you want. Instead you need some hook into the ID of the item in the list.

barrettclark avatar Aug 27 '24 22:08 barrettclark