terraform-provider-gitlab icon indicating copy to clipboard operation
terraform-provider-gitlab copied to clipboard

gitlab_service_jira password not set

Open valvin1 opened this issue 2 years ago • 16 comments

Terraform Version

Terraform v0.14.5

Affected Resource(s)

  • gitlab_service_jira

Terraform Configuration Files

resource "gitlab_service_jira" "my_project" {
  project                  = gitlab_project.my_project.id
  url                      = "https://myjiraserver.tld"
  username                 = "user"
  password                 = var.jira_password
  project_key              = "XXXX"
  jira_issue_transition_id = "123"
  commit_events            = true
  merge_requests_events    = true
  comment_on_event_enabled = false

Expected Behavior

this resource should configure the jira Integration password included

Actual Behavior

it creates the jira integration except password which is not set and stays blank.

Steps to Reproduce

  1. add configuration of a gitlab_service_jira resources with a password
  2. terraform apply
  3. on gitlab side check the integration and test the connection. you should have a message with "password can't be blank"

valvin1 avatar Jul 23 '21 09:07 valvin1

Marking this issue as stale due to 90 days of inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 14 days it will automatically be closed. Maintainers can also remove the stale label. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

github-actions[bot] avatar Feb 03 '22 03:02 github-actions[bot]

Hello. Can you run your apply with TF_LOG=DEBUG and attach a gist with the debug logs? I looked at the code and it appears to be including the password in the API call correctly. Also please include the version of the provider you are using. It's possible this was fixed since the original report.

armsnyder avatar Feb 03 '22 03:02 armsnyder

Hello. I have a similar problem - my jira integration after creation doesn't shout that the password is blank, but the error message is 'Validation failed'. After putting the right password in the field in gui, it starts to work - even if I DON'T press 'save changes' button. Just 'Test connection' and it works after reloading the page.

Here is the debug log from the creation phase: https://gist.github.com/ftpd/3e697a77799af0f2e98aea2d61e65388

Terraform version: 1.0.10, provider version: 3.9.1.

ftpd avatar Feb 18 '22 08:02 ftpd

@ftpd I have experienced this but it appears that the password is validly set until you either go to the Integration page in GitLab for Jira or you click the test button on the integration. I am unsure that this is a provider issue and might be more of a GitLab issue. @ftpd or @valvin1 If you could run the provider, configure the JIRA integration and test that the integration on the project works without navigating to the JIRA integration configuration page that might confirm my suspicions.

Shocktrooper avatar Mar 20 '22 18:03 Shocktrooper

It doesn't work for me after just creating an integration. Clicking test button gives 'Validation failed', I have to manually insert password in the corresponding field in Jira itself.

ftpd avatar Mar 21 '22 12:03 ftpd

@ftpd One last test then can you try setting the same settings via the API and see if that works. No terraform involved just a PUT request to the API. Also please note which version of GitLab you are using. https://docs.gitlab.com/ee/api/integrations.html#jira

Shocktrooper avatar Mar 21 '22 14:03 Shocktrooper

@ftpd Could you please run the terraform apply with TF_LOG=debug to see the request made to GitLab - and please redact the output to not leak any secrets ;) - and post it here? :)

timofurrer avatar Mar 21 '22 14:03 timofurrer

@timofurrer the whole log from apply with debug is in my gist in https://github.com/gitlabhq/terraform-provider-gitlab/issues/672#issuecomment-1044168426

ftpd avatar Mar 21 '22 14:03 ftpd

@ftpd sorry my bad 🤦 I'll dig into this a little bit more in depth later. For now, the active field looks suspicious .. it's an optional field which activates the integration and defaults to false ... the provider doesn't set it nor allows to set it ...

... and maybe that the password field appears blank in the UI (it seems to be sent via API) is just because of security concerns ... and you need to re-enter (just guessing here ...)

Can you try and manually do the API call from the logs, but add the activate field set to true ?

timofurrer avatar Mar 21 '22 15:03 timofurrer

Just saw in the response that it's actually active 🤔

timofurrer avatar Mar 21 '22 15:03 timofurrer

https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/service_jira says the active field is read-only. For me it looks like it becomes active automagically when the integration is applied.

ftpd avatar Mar 21 '22 15:03 ftpd

I will try some manual approach with API calls and get back with response.

ftpd avatar Mar 21 '22 15:03 ftpd

One last test then can you try setting the same settings via the API and see if that works. No terraform involved just a PUT request to the API. Also please note which version of GitLab you are using.

@Shocktrooper I did the test. 'Validation failed', just like when creating via terraform - so it looks like it's not provider's fault indeed (warning: @valvin1 still can have a problem with provider, as mine is slightly different). Any advices welcomed, anyway.

The github version - I'm using gitlab.com, so I assume 'current' ;-)

ftpd avatar Mar 22 '22 14:03 ftpd

Any advices welcomed, anyway.

I think it makes sense to open an issue here: https://gitlab.com/gitlab-org/gitlab/-/issues

@valvin1 any more information from your side?

timofurrer avatar Mar 22 '22 15:03 timofurrer

Just to make things clear: for me the password field is also blank, but I assume it's the expected look&feel - when creating the integration manually, (via the web) putting it there and clicking Save Changes, the field appears blank, despite the password is there and everything works.

ftpd avatar Mar 22 '22 15:03 ftpd

@valvin1 bump for timofurrers comment above

Shocktrooper avatar Apr 20 '22 04:04 Shocktrooper

Marking this issue as stale due to 120 days of inactivity. If this issue receives no comments in the next 30 days it will be closed. Maintainers can also remove the stale label.

Please comment with more information if you would like this issue to remain open.

github-actions[bot] avatar Aug 19 '22 03:08 github-actions[bot]

Closing issue as no further feedback was added from end users

Shocktrooper avatar Sep 12 '22 04:09 Shocktrooper