jfrog / terraform-provider-artifactory

Terraform provider to manage JFrog Artifactory
https://jfrog.com/artifactory
Apache License 2.0
272 stars 101 forks source link

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

Open jan-huso opened 2 weeks ago

jan-huso commented 2 weeks ago

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

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

alexhung commented 2 weeks ago

@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.

jan-huso commented 2 weeks ago

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.

alexhung commented 2 weeks ago

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.