how does one set a required custom_field

23 views Asked by At

I have started playing around with terraform and jira and I am looking for a way to set a required custome_field.

when I try to set the value I get an error, no matter what I try, I always get....

 Error: creating jira issue failed: {"errorMessages":[],"errors":{"customfield_13601":"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

So I managed to create an epic, without customfield_1360 set. Then I tried to create a story, which is linked to the epic, but I keep getting this error...

from the GUI, I have a select object, which passes a option like so...

<option value="1">App1</option>
<option value="2">App2</option>

and I can update it via the gui with no issues.

terraform {
    required_providers {
        jira = {
            source = "fourplusone/jira"
            version = "0.1.20"
        }
    }
}

# Configure the Jira Provider
provider "jira" {
    url      = "https://jira.docker.local" # Can also be set using the JIRA_URL environment variable
    #user     = ""                         # Can also be set using the JIRA_USER environment variable
    #password = ""                         # Can also be set using the JIRA_PASSWORD environment variable
}
resource "jira_issue" "epic_1" {
    issue_type        = "Epic"
    project_key       = "PLAY"
    reporter          =  ""   
    summary           = "Integration play"
    description       = <<EOT
h1. Integration

terraform play 

EOT
    fields            = {
        "customfield_10005" : "Integration" # Epic Name
        "customfield_15502": "PLAY-1" # Parent (self made in gui)
    }
}

resource "jira_issue" "story_1" {
    issue_type        = "Story"
    project_key       = "PLAY"
    reporter          =  ""
    labels            = [""] 
    summary           = "Play (required)"
    description       = <<EOT
h1. PI 20 - play with required stuff...
EOT
    fields = {
        #"customfield_15502": "${jira_issue.epic_1.id}" # Parent
        "customfield_10006" : "${jira_issue.epic_1.issue_key}" # Epic Link
        "customfield_13601" : "App1"  #App CI required
    }
}

However, no matter what I try I can't seem to get the story to create. It always complains about the missing custom field. I tried just putting in "App1", and the id of "1" as the value, but it will not take.

I looked at the rest api for jira and there is no special reqestions other than the field being required....

#https://jira.docker.local/rest/api/latest/field
    {
        "id": "customfield_13601",
        "name": "App",
        "custom": true,
        "orderable": true,
        "navigable": true,
        "searchable": true,
        "clauseNames": [
            "App",
            "cf[13601]"
        ],
        "schema": {
            "type": "option",
            "custom": "com.atlassian.jira.plugin.system.customfieldtypes:select",
            "customId": 13601
        }
    },

Has anyone tried doing this sort of thing or is it a bug?

0

There are 0 answers