fourplusone / terraform-provider-jira

Terraform provider to configure JIRA
https://registry.terraform.io/providers/fourplusone/jira/latest
MIT License
179 stars 54 forks source link

Problem with populating a single select type custom field #46

Open iwonazytkiewicz opened 3 years ago

iwonazytkiewicz commented 3 years ago

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":{"customfield10112":"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

fransf-wtax commented 2 years ago

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
gonchik commented 2 years ago

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

GlorifiedTypist commented 2 years ago

Same issue here, any work around in the meanwhile?

jcavet commented 1 year ago

Any updates on this?

araykov commented 2 months ago

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

barrettclark commented 2 months ago

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.