jfrog/terraform-provider-artifactory

Terraform overwriting "Share With" feature setting "read only" set in UI

Opened this issue · 3 comments

Describe the bug
From my understanding at the moment there is no support in the terraform provider to use the "Share with" Feature on reositories.
When creating and assigning repositories to a project via Terraform, then share this repo with another project via the UI in Read Only mode, on the next terraform run, the Read Only mode gets overwritten and the repo is shared in write mode with the project

Requirements for and issue

  • A description of the bug
  • A fully functioning terraform snippet that can be copy&pasted (no outside files or ENV vars unless that's part of the issue). If this is not supplied, this issue will likely be closed without any effort expended.
  • Your version of artifactory (you can curl it at $host/artifactory/api/system/version
  • Your version of terraform
  • Your version of terraform provider

Expected behavior
The Terraform provider should not touch the share with feature at all, as there is no setting for this feature availabe in the provider at the moment.

Additional context
For creating the repos we use the artifactory_repository resource in the artifactory provider.
For creating a project we use the artifactory_project resource in the project provider.
For assigning repos to projects we use the new project_repository resource in the project provider.

We use the SaaS Version.

Additionaly, do you have an ETA for terraform support for the "Share with" Feature? API Support seems to be available
https://jfrog.com/help/r/jfrog-rest-apis/share-repository-with-all-projects

@jan-huso Thank you for your report.

Was there any state drift when you run terraform plan after you share the repository in the UI?

I suspect this is a bug in the Projects feature. As you mentioned, the provider does not support the sharing of repository and it is not actively overwriting the sharing setting. (The API doesn't support it)

The sharing feature is currently scheduled to be added in Q3. I'm awaiting new API (get sharing status) to be implemented and released before I add support to the provider.

Hi @alexhung, thanks for the quick reply and the status on the feature!

I did some further testing:
There is no state drift when running tf plan and also there is no change to the read only attribute when running an apply. The attribute only gets modified, when there is a change on the repository and I run a tf apply.
I tested this with changing the description in the tf code. When applying the new description the read only attribute is unset on the affected repository.

I tested this with changing the description in the tf code. When applying the new description the read only attribute is unset on the affected repository.

@jan-huso I'm pretty certain this is a bug in the Artifactory repository API. Let me see if I can reproduce this and open a bug report internally.