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

Config.Custom_fields: Components in jira_value will never get added, and is removed when changing other configs relating to the mapping rule. #956

Open
dkMorMHa opened this issue Dec 9, 2024 · 2 comments

Comments

@dkMorMHa
Copy link

dkMorMHa commented Dec 9, 2024

Hi there,

When applying the resources for the Jira Cloud mapping rule, the custom_fields referring to jira_value (components)
will correctly identify changes, but will not actually deploy them.
It will never add the value!
Instead ANY changes to the mapping rule, will REMOVE the components, even though it is not stated in the plan/apply.
The components in HCL (accepts multiple values)

When choosing the correct value through the UI, the plan then say that there are no changes.
However if there is a change anywhere else in the module during an apply, this will effectively remove the above value from the components, with no mention of doing so (resulting in ticket cannot be created in Jira)

Terraform Version

Terraform v1.10.1
on linux_amd64

  • provider registry.terraform.io/hashicorp/aws v5.78.0
  • provider registry.terraform.io/pagerduty/pagerduty v3.18.1

Jira Cloud Version

1001.0.0-SNAPSHOT

Affected Resource(s)

Please list the resources as a list, for example:
pagerduty_jira_cloud_account_mapping_rule

  • custom_fields
    • target_issue_field = components

Terraform Configuration Files

_null_

Debug Output

Cannot disclose, but issue should be easily replicable.
Looking INFO messages at the request and response the I get 200 for creating the resources!
and the gist for the resource, output, and UI confirmation is here:
https://gist.github.com/dkMorMHa/5042bd6a0af0211b8e0b9048c3421b99

Expected Behavior

What should have happened?
The resource components should be created with the provided information, instead the components values are empty in the UI.

Actual Behavior

When applying the tf resources, it states that it want's to add the resources, and it does create the key "components", but the actual values are missing.
Furthermore adding the correct values in the UI, will make the tf apply remove them upon any other changes to the resource, without stating so!

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. create the resource in terraform and refer to a valid account mapping
  2. terraform apply
  3. confirm that components are (not) created

References

@alexandr-ku-MA
Copy link

alexandr-ku-MA commented Dec 20, 2024

The problem is a provider sends wrong structure to PD and PD API saves it internally.
Actually value field is not deserialized back:

        {
          "source_incident_field": "incident_description",
          "target_issue_field": "customfield_11066",
          "target_issue_field_name": "SRE Description",
          "type": "attribute",
          "value": null
        },
        {
          "source_incident_field": null,
          "target_issue_field": "customfield_11063",
          "target_issue_field_name": "SRE Scope",
          "type": "jira_value",
          "value": "{\"displayName\":\"Common\",\"id\":\"13077\"}"
        },
        {
          "source_incident_field": null,
          "target_issue_field": "customfield_11064",
          "target_issue_field_name": "SRE Category",
          "type": "jira_value",
          "value": "{\"displayName\":\"Monitoring\",\"id\":\"13084\"}"
        }

There "value": "{\"displayName\":\"Common\",\"id\":\"13077\"}" should be a dict, but we see a string.

@cjgajard could you take a look?

@alexandr-ku-MA
Copy link

As I see the source of mistake is here: 7605669#diff-a75f646e36a1d4a36283935c867d4c6e488d0b8667471a488d12e8c995e533eeR447

Provider should try to deserialize the value from json instead.

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

2 participants