Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with populating a single select type custom field #46

Open
iwonazytkiewicz opened this issue Oct 16, 2021 · 6 comments
Open

Problem with populating a single select type custom field #46

iwonazytkiewicz opened this issue Oct 16, 2021 · 6 comments

Comments

@iwonazytkiewicz
Copy link

iwonazytkiewicz commented Oct 16, 2021

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 iwonazytkiewicz changed the title Problem to populate single select type customfield Problem with populating a single select type customfield Oct 16, 2021
@iwonazytkiewicz iwonazytkiewicz changed the title Problem with populating a single select type customfield Problem with populating a single select type custom field Oct 16, 2021
@fransf-wtax
Copy link
Contributor

fransf-wtax commented Jan 21, 2022

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
Copy link

gonchik commented Feb 17, 2022

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

@GlorifiedTypist
Copy link

Same issue here, any work around in the meanwhile?

@jcavet
Copy link

jcavet commented Feb 2, 2023

Any updates on this?

@araykov
Copy link

araykov commented Aug 23, 2024

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

@barrettclark
Copy link

I just ran into this as well. I think #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants