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

artifactory_item_properties delete not handled correctly #1049

Closed
5 tasks done
critchtionary opened this issue Aug 8, 2024 · 1 comment · Fixed by #1050
Closed
5 tasks done

artifactory_item_properties delete not handled correctly #1049

critchtionary opened this issue Aug 8, 2024 · 1 comment · Fixed by #1050
Assignees
Labels
bug Something isn't working

Comments

@critchtionary
Copy link

Describe the bug

Deleting an artifactory_item_properties resource does not delete the property correctly in Artifactory.

  1. Create a repository and property:
resource "artifactory_local_generic_repository" "test" {
  key         = "property-test"
}

resource "artifactory_item_properties" "test" {
  repo_key = artifactory_local_generic_repository.test.key
  properties = {
    "key1": ["value1"],
  }
  is_recursive = false
}
Apply output
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # artifactory_item_properties.test will be created
  + resource "artifactory_item_properties" "test" {
      + is_recursive = false
      + properties   = {
          + "key1" = [
              + "value1",
            ]
        }
      + repo_key     = "property-test"
    }

  # artifactory_local_generic_repository.test will be created
  + resource "artifactory_local_generic_repository" "test" {
      + blacked_out          = false
      + cdn_redirect         = false
      + id                   = (known after apply)
      + includes_pattern     = "**/*"
      + key                  = "property-test"
      + package_type         = (known after apply)
      + priority_resolution  = false
      + project_environments = (known after apply)
      + repo_layout_ref      = "simple-default"
      + xray_index           = false
    }

Plan: 2 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

artifactory_local_generic_repository.test: Creating...
artifactory_local_generic_repository.test: Creation complete after 0s [id=property-test]
artifactory_item_properties.test: Creating...
artifactory_item_properties.test: Creation complete after 0s

Screenshot 2024-08-08 at 11 55 10

  1. Delete the artifactory_item_properties resource and apply again:
Apply output
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  # artifactory_item_properties.test will be destroyed
  # (because artifactory_item_properties.test is not in configuration)
  - resource "artifactory_item_properties" "test" {
      - is_recursive = false -> null
      - properties   = {
          - "key1" = [
              - "value1",
            ]
        } -> null
      - repo_key     = "property-test" -> null
    }

Plan: 0 to add, 0 to change, 1 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

artifactory_item_properties.test: Destroying...
artifactory_item_properties.test: Destruction complete after 0s

Apply complete! Resources: 0 added, 0 changed, 1 destroyed.
  1. Property has not been deleted from repository. Subsequent terraform plan commands show no changes.

Issue occurs regardless of is_recursive value, and when setting properties on files with item_path.

  • Artifactory version 7.84.10
  • Terraform version 1.5.7
  • Provider version 11.5.0

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

Repository property is deleted when artifactory_item_properties is deleted.

Additional context
Add any other context about the problem here.

@critchtionary critchtionary added the bug Something isn't working label Aug 8, 2024
@alexhung
Copy link
Member

alexhung commented Aug 8, 2024

@critchtionary Thanks for the report! I'll investigate.

alexhung added a commit that referenced this issue Aug 8, 2024
…eleted

Fix incorrect query param string for deleting item properties
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants