fourplusone / terraform-provider-jira

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

Epic resource error with assignee and reporter #77

Open carlosmsanchezm opened 1 year ago

carlosmsanchezm commented 1 year ago

Trying to create the assignee/reporter values but the wrong values are being assigned.

my code: `resource "jira_issue" "test" { assignee = "carlos.sanchez.m.m@gmail.com" reporter = "carlos.sanchez.m.m@gmail.com"

issue_type = "Epic"

// description is optional description = "This is an epic description" summary = "This is an epic summary"

labels = ["one", "two", "buckle-my-shoe"]

// System and custom fields are optional; see the field data source to reference internal JIRA field IDs by name fields = { (data.jira_field.epic_name.id) = "Example epic name" }

project_key = "DSO" }`

i get the following error:

Error: creating jira issue failed: {"errorMessages":[],"errors":{"reporter":"Reporter is required."}}: request failed. Please analyze the request body for more details. Status code: 400 │ │ with jira_issue.test, │ on main.tf line 42, in resource "jira_issue" "test": │ 42: resource "jira_issue" "test" {

when i comment out both 'assignee' and 'reporter' or just comment out 'reporter' the epic is create with the reporter value filled but with assignee as 'unassigned' on Jira UI.

This is the output for bother, first being both commented out and then last just reporter commented out:

` Error: Plugin did not respond │ │ with jira_issue.test, │ on main.tf line 42, in resource "jira_issue" "test": │ 42: resource "jira_issue" "test" { │ │ The plugin encountered an error, and failed to respond to the │ plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details. ╵

Stack trace from the terraform-provider-jira_v0.1.16 plugin:

panic: interface conversion: interface {} is map[string]interface {}, not map[string]string

goroutine 16 [running]: github.com/fourplusone/terraform-provider-jira/jira.resourceIssueRead(0x140002e9180, {0x1037ca280?, 0x14000110850}) github.com/fourplusone/terraform-provider-jira/jira/resource_issue.go:200 +0x888 github.com/fourplusone/terraform-provider-jira/jira.resourceIssueCreate(0x1037df680?, {0x1037ca280?, 0x14000110850}) github.com/fourplusone/terraform-provider-jira/jira/resource_issue.go:175 +0x670 github.com/hashicorp/terraform-plugin-sdk/helper/schema.(Resource).Apply(0x1400021ef00, 0x14000330f00, 0x14000233400, {0x1037ca280, 0x14000110850}) github.com/hashicorp/terraform-plugin-sdk@v1.17.0/helper/schema/resource.go:320 +0x3e0 github.com/hashicorp/terraform-plugin-sdk/helper/schema.(Provider).Apply(0x14000284500, 0x1400036d960, 0x1035332df?, 0xf?) github.com/hashicorp/terraform-plugin-sdk@v1.17.0/helper/schema/provider.go:294 +0x70 github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(GRPCProviderServer).ApplyResourceChange(0x140001105d0, {0x140002e8af0?, 0x0?}, 0x140002e8af0) github.com/hashicorp/terraform-plugin-sdk@v1.17.0/internal/helper/plugin/grpc_provider.go:895 +0x6b8 github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x1038bc4a0?, 0x140001105d0}, {0x1038f78a0, 0x14000325200}, 0x140003224e0, 0x0) github.com/hashicorp/terraform-plugin-sdk@v1.17.0/internal/tfplugin5/tfplugin5.pb.go:3305 +0x174 google.golang.org/grpc.(Server).processUnaryRPC(0x1400014e700, {0x1038fad80, 0x1400028ea80}, 0x140002a4900, 0x140003a06c0, 0x103e6cfe0, 0x0) google.golang.org/grpc@v1.32.0/server.go:1194 +0xaf0 google.golang.org/grpc.(Server).handleStream(0x1400014e700, {0x1038fad80, 0x1400028ea80}, 0x140002a4900, 0x0) google.golang.org/grpc@v1.32.0/server.go:1517 +0x840 google.golang.org/grpc.(Server).serveStreams.func1.2() google.golang.org/grpc@v1.32.0/server.go:859 +0x88 created by google.golang.org/grpc.(*Server).serveStreams.func1 google.golang.org/grpc@v1.32.0/server.go:857 +0x298

Error: The terraform-provider-jira_v0.1.16 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely helpful if you could report the crash with the plugin's maintainers so that it can be fixed. The output above should help diagnose the issue.`


`Error: Plugin did not respond │ │ with jira_issue.test, │ on main.tf line 42, in resource "jira_issue" "test": │ 42: resource "jira_issue" "test" { │ │ The plugin encountered an error, and failed to respond to the │ plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details. ╵

Stack trace from the terraform-provider-jira_v0.1.16 plugin:

panic: interface conversion: interface {} is map[string]interface {}, not map[string]string

goroutine 36 [running]: github.com/fourplusone/terraform-provider-jira/jira.resourceIssueRead(0x1400047aa10, {0x101896280?, 0x140006f80b0}) github.com/fourplusone/terraform-provider-jira/jira/resource_issue.go:200 +0x888 github.com/fourplusone/terraform-provider-jira/jira.resourceIssueCreate(0x1018ab680?, {0x101896280?, 0x140006f80b0}) github.com/fourplusone/terraform-provider-jira/jira/resource_issue.go:175 +0x670 github.com/hashicorp/terraform-plugin-sdk/helper/schema.(Resource).Apply(0x140006da460, 0x14000620500, 0x1400014c500, {0x101896280, 0x140006f80b0}) github.com/hashicorp/terraform-plugin-sdk@v1.17.0/helper/schema/resource.go:320 +0x3e0 github.com/hashicorp/terraform-plugin-sdk/helper/schema.(Provider).Apply(0x140006fc200, 0x1400063d960, 0x1015ff2df?, 0xf?) github.com/hashicorp/terraform-plugin-sdk@v1.17.0/helper/schema/provider.go:294 +0x70 github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(GRPCProviderServer).ApplyResourceChange(0x1400000e5e8, {0x1400047a230?, 0x0?}, 0x1400047a230) github.com/hashicorp/terraform-plugin-sdk@v1.17.0/internal/helper/plugin/grpc_provider.go:895 +0x6b8 github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x1019884a0?, 0x1400000e5e8}, {0x1019c38a0, 0x1400061e1e0}, 0x140003bc120, 0x0) github.com/hashicorp/terraform-plugin-sdk@v1.17.0/internal/tfplugin5/tfplugin5.pb.go:3305 +0x174 google.golang.org/grpc.(Server).processUnaryRPC(0x140001de700, {0x1019c6d80, 0x14000226a80}, 0x14000444100, 0x140000ba6f0, 0x101f38fe0, 0x0) google.golang.org/grpc@v1.32.0/server.go:1194 +0xaf0 google.golang.org/grpc.(Server).handleStream(0x140001de700, {0x1019c6d80, 0x14000226a80}, 0x14000444100, 0x0) google.golang.org/grpc@v1.32.0/server.go:1517 +0x840 google.golang.org/grpc.(Server).serveStreams.func1.2() google.golang.org/grpc@v1.32.0/server.go:859 +0x88 created by google.golang.org/grpc.(*Server).serveStreams.func1 google.golang.org/grpc@v1.32.0/server.go:857 +0x298

Error: The terraform-provider-jira_v0.1.16 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely helpful if you could report the crash with the plugin's maintainers so that it can be fixed. The output above should help diagnose the issue.`

raypettersen commented 1 year ago

If you're using jira cloud then this could be related #76 GDPR strict mode, meaning jira cloud expects an ID instead of personal data in the form of an email address.

carlosmsanchezm commented 1 year ago

hey, thanks for that info. just used it and still getting the same error.

i got account id by going into my profile page and going to url and copying the string of numbers/letters. it works when i use it for lead_account_id for jira_project

lassemand commented 1 year ago

Creating a jira user using this api provides me with a 400 due to the lookup after the account is created is providing me with an error. Any work arounds for that until? The initial create works just fine.

More specifically:

jira_user.default: Creating... ╷ │ Error: getting jira user failed: The 'accountId' query parameter needs to be provided: request failed. Please analyze the request body for more details. Status code: 400