-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1056 from jfrog/add-package-cleanup-policy-resource
Add `artifactory_package_cleanup_policy` resource
- Loading branch information
Showing
21 changed files
with
930 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "artifactory_package_cleanup_policy Resource - terraform-provider-artifactory" | ||
subcategory: "Configuration" | ||
description: |- | ||
Provides an Artifactory Package Cleanup Policy resource. This resource enable system administrators to define and customize policies based on specific criteria for removing unused binaries from across their JFrog platform. See Rentation Policies https://jfrog.com/help/r/jfrog-platform-administration-documentation/retention-policies for more details. | ||
->Only available for Artifactory 7.90.1 or later. | ||
--- | ||
|
||
# artifactory_package_cleanup_policy (Resource) | ||
|
||
Provides an Artifactory Package Cleanup Policy resource. This resource enable system administrators to define and customize policies based on specific criteria for removing unused binaries from across their JFrog platform. See [Rentation Policies](https://jfrog.com/help/r/jfrog-platform-administration-documentation/retention-policies) for more details. | ||
|
||
->Only available for Artifactory 7.90.1 or later. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "artifactory_package_cleanup_policy" "my-cleanup-policy" { | ||
key = "my-policy" | ||
description = "My package cleanup policy" | ||
cron_expression = "0 0 2 ? * MON-SAT *" | ||
duration_in_minutes = 60 | ||
enabled = true | ||
skip_trashcan = false | ||
search_criteria = { | ||
package_types = ["docker"] | ||
repos = ["my-docker-local"] | ||
included_projects = ["myproj"] | ||
included_packages = ["**"] | ||
excluded_packages = ["com/jfrog/latest"] | ||
created_before_in_months = 1 | ||
last_downloaded_before_in_months = 6 | ||
} | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `key` (String) Policy key. It has to be unique. It should not be used for other policies and configuration entities like archive policies, key pairs, repo layouts, property sets, backups, proxies, reverse proxies etc. | ||
- `search_criteria` (Attributes) (see [below for nested schema](#nestedatt--search_criteria)) | ||
|
||
### Optional | ||
|
||
- `cron_expression` (String) The Cron expression that sets the schedule of policy execution. For example, `0 0 2 * * ?` executes the policy every day at 02:00 AM. The minimum recurrent time for policy execution is 6 hours. | ||
- `description` (String) | ||
- `duration_in_minutes` (Number) Enable and select the maximum duration for policy execution. Note: using this setting can cause the policy to stop before completion. | ||
- `enabled` (Boolean) Enables or disabled the package cleanup policy. This allows the user to run the policy manually. If a policy has a valid cron expression, then it will be scheduled for execution based on it. If a policy is disabled, its future executions will be unscheduled. Defaults to `true` | ||
- `skip_trashcan` (Boolean) When enabled, deleted packages are permanently removed from Artifactory without an option to restore them. Defaults to `false` | ||
|
||
<a id="nestedatt--search_criteria"></a> | ||
### Nested Schema for `search_criteria` | ||
|
||
Required: | ||
|
||
- `included_packages` (Set of String) Specify a pattern for a package name or an explicit package name. It accept only single element which can be specific package or pattern, and for including all packages use `**`. Example: `included_packages = ["**"]` | ||
- `package_types` (Set of String) Types of packages to be removed. Support: conan, docker, generic, gradle, maven, npm, nuget, rpm. | ||
- `repos` (Set of String) Specify patterns for repository names or explicit repository names. For including all repos use `**`. Example: `repos = ["**"]` | ||
|
||
Optional: | ||
|
||
- `created_before_in_months` (Number) Remove packages based on when they were created. | ||
- `excluded_packages` (Set of String) Specify explicit package names that you want excluded from the policy. | ||
- `excluded_repos` (Set of String) Specify patterns for repository names or explicit repository names that you want excluded from the policy. It can not accept any pattern only list of specific repositories. | ||
- `include_all_projects` (Boolean) | ||
- `included_projects` (Set of String) List of projects name(s) to apply the policy to. | ||
- `keep_last_n_versions` (Number) Select the number of latest version to keep. The policy will remove all versions (based on creation date) prior to the selected number. Some package types may not be supported. [Learn more](https://jfrog.com/help/r/jfrog-platform-administration-documentation/retention-policies/package-types-coverage) | ||
- `last_downloaded_before_in_months` (Number) Remove packages based on when they were last downloaded. | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
```shell | ||
terraform import artifactory_package_cleanup_policy.my-cleanup-policy my-policy | ||
``` |
1 change: 1 addition & 0 deletions
1
examples/resources/artifactory_package_cleanup_policy/import.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
terraform import artifactory_package_cleanup_policy.my-cleanup-policy my-policy |
18 changes: 18 additions & 0 deletions
18
examples/resources/artifactory_package_cleanup_policy/resource.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
resource "artifactory_package_cleanup_policy" "my-cleanup-policy" { | ||
key = "my-policy" | ||
description = "My package cleanup policy" | ||
cron_expression = "0 0 2 ? * MON-SAT *" | ||
duration_in_minutes = 60 | ||
enabled = true | ||
skip_trashcan = false | ||
|
||
search_criteria = { | ||
package_types = ["docker"] | ||
repos = ["my-docker-local"] | ||
included_projects = ["myproj"] | ||
included_packages = ["**"] | ||
excluded_packages = ["com/jfrog/latest"] | ||
created_before_in_months = 1 | ||
last_downloaded_before_in_months = 6 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.