published on Friday, Apr 10, 2026 by Pulumi
published on Friday, Apr 10, 2026 by Pulumi
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. Package cleanup policies are supported on the Cloud (7.98.2) and Self-Hosted (7.98.7) platforms, with an Enterprise+ license. See Cleanup Policies for more details.
Example Usage
Time-based Cleanup Policy (Days)
import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";
const my_cleanup_policy = new artifactory.PackageCleanupPolicy("my-cleanup-policy", {
key: "my-cleanup-policy",
description: "My cleanup policy",
cronExpression: "0 0 2 ? * MON-SAT *",
durationInMinutes: 60,
enabled: true,
skipTrashcan: false,
searchCriteria: {
packageTypes: [
"docker",
"gradle",
"maven",
],
repos: ["**"],
includeAllProjects: true,
includedProjects: [],
includedPackages: ["**"],
excludedPackages: ["com/jfrog/latest"],
createdBeforeInDays: 30,
lastDownloadedBeforeInDays: 60,
},
});
import pulumi
import pulumi_artifactory as artifactory
my_cleanup_policy = artifactory.PackageCleanupPolicy("my-cleanup-policy",
key="my-cleanup-policy",
description="My cleanup policy",
cron_expression="0 0 2 ? * MON-SAT *",
duration_in_minutes=60,
enabled=True,
skip_trashcan=False,
search_criteria={
"package_types": [
"docker",
"gradle",
"maven",
],
"repos": ["**"],
"include_all_projects": True,
"included_projects": [],
"included_packages": ["**"],
"excluded_packages": ["com/jfrog/latest"],
"created_before_in_days": 30,
"last_downloaded_before_in_days": 60,
})
package main
import (
"github.com/pulumi/pulumi-artifactory/sdk/v8/go/artifactory"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := artifactory.NewPackageCleanupPolicy(ctx, "my-cleanup-policy", &artifactory.PackageCleanupPolicyArgs{
Key: pulumi.String("my-cleanup-policy"),
Description: pulumi.String("My cleanup policy"),
CronExpression: pulumi.String("0 0 2 ? * MON-SAT *"),
DurationInMinutes: pulumi.Int(60),
Enabled: pulumi.Bool(true),
SkipTrashcan: pulumi.Bool(false),
SearchCriteria: &artifactory.PackageCleanupPolicySearchCriteriaArgs{
PackageTypes: pulumi.StringArray{
pulumi.String("docker"),
pulumi.String("gradle"),
pulumi.String("maven"),
},
Repos: pulumi.StringArray{
pulumi.String("**"),
},
IncludeAllProjects: pulumi.Bool(true),
IncludedProjects: pulumi.StringArray{},
IncludedPackages: pulumi.StringArray{
pulumi.String("**"),
},
ExcludedPackages: pulumi.StringArray{
pulumi.String("com/jfrog/latest"),
},
CreatedBeforeInDays: pulumi.Int(30),
LastDownloadedBeforeInDays: pulumi.Int(60),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Artifactory = Pulumi.Artifactory;
return await Deployment.RunAsync(() =>
{
var my_cleanup_policy = new Artifactory.Index.PackageCleanupPolicy("my-cleanup-policy", new()
{
Key = "my-cleanup-policy",
Description = "My cleanup policy",
CronExpression = "0 0 2 ? * MON-SAT *",
DurationInMinutes = 60,
Enabled = true,
SkipTrashcan = false,
SearchCriteria = new Artifactory.Inputs.PackageCleanupPolicySearchCriteriaArgs
{
PackageTypes = new[]
{
"docker",
"gradle",
"maven",
},
Repos = new[]
{
"**",
},
IncludeAllProjects = true,
IncludedProjects = new() { },
IncludedPackages = new[]
{
"**",
},
ExcludedPackages = new[]
{
"com/jfrog/latest",
},
CreatedBeforeInDays = 30,
LastDownloadedBeforeInDays = 60,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.artifactory.PackageCleanupPolicy;
import com.pulumi.artifactory.PackageCleanupPolicyArgs;
import com.pulumi.artifactory.inputs.PackageCleanupPolicySearchCriteriaArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var my_cleanup_policy = new PackageCleanupPolicy("my-cleanup-policy", PackageCleanupPolicyArgs.builder()
.key("my-cleanup-policy")
.description("My cleanup policy")
.cronExpression("0 0 2 ? * MON-SAT *")
.durationInMinutes(60)
.enabled(true)
.skipTrashcan(false)
.searchCriteria(PackageCleanupPolicySearchCriteriaArgs.builder()
.packageTypes(
"docker",
"gradle",
"maven")
.repos("**")
.includeAllProjects(true)
.includedProjects()
.includedPackages("**")
.excludedPackages("com/jfrog/latest")
.createdBeforeInDays(30)
.lastDownloadedBeforeInDays(60)
.build())
.build());
}
}
resources:
my-cleanup-policy:
type: artifactory:PackageCleanupPolicy
properties:
key: my-cleanup-policy
description: My cleanup policy
cronExpression: 0 0 2 ? * MON-SAT *
durationInMinutes: 60
enabled: true
skipTrashcan: false
searchCriteria:
packageTypes:
- docker
- gradle
- maven
repos:
- '**'
includeAllProjects: true
includedProjects: []
includedPackages:
- '**'
excludedPackages:
- com/jfrog/latest
createdBeforeInDays: 30
lastDownloadedBeforeInDays: 60
Version-based Cleanup Policy
import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";
const my_version_policy = new artifactory.PackageCleanupPolicy("my-version-policy", {
key: "my-version-policy",
description: "Keep only latest versions",
cronExpression: "0 0 2 ? * MON-SAT *",
durationInMinutes: 60,
enabled: true,
skipTrashcan: false,
searchCriteria: {
packageTypes: ["maven"],
repos: ["**"],
includeAllProjects: true,
includedProjects: [],
includedPackages: ["**"],
excludedPackages: ["com/jfrog/latest"],
keepLastNVersions: 5,
},
});
import pulumi
import pulumi_artifactory as artifactory
my_version_policy = artifactory.PackageCleanupPolicy("my-version-policy",
key="my-version-policy",
description="Keep only latest versions",
cron_expression="0 0 2 ? * MON-SAT *",
duration_in_minutes=60,
enabled=True,
skip_trashcan=False,
search_criteria={
"package_types": ["maven"],
"repos": ["**"],
"include_all_projects": True,
"included_projects": [],
"included_packages": ["**"],
"excluded_packages": ["com/jfrog/latest"],
"keep_last_n_versions": 5,
})
package main
import (
"github.com/pulumi/pulumi-artifactory/sdk/v8/go/artifactory"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := artifactory.NewPackageCleanupPolicy(ctx, "my-version-policy", &artifactory.PackageCleanupPolicyArgs{
Key: pulumi.String("my-version-policy"),
Description: pulumi.String("Keep only latest versions"),
CronExpression: pulumi.String("0 0 2 ? * MON-SAT *"),
DurationInMinutes: pulumi.Int(60),
Enabled: pulumi.Bool(true),
SkipTrashcan: pulumi.Bool(false),
SearchCriteria: &artifactory.PackageCleanupPolicySearchCriteriaArgs{
PackageTypes: pulumi.StringArray{
pulumi.String("maven"),
},
Repos: pulumi.StringArray{
pulumi.String("**"),
},
IncludeAllProjects: pulumi.Bool(true),
IncludedProjects: pulumi.StringArray{},
IncludedPackages: pulumi.StringArray{
pulumi.String("**"),
},
ExcludedPackages: pulumi.StringArray{
pulumi.String("com/jfrog/latest"),
},
KeepLastNVersions: pulumi.Int(5),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Artifactory = Pulumi.Artifactory;
return await Deployment.RunAsync(() =>
{
var my_version_policy = new Artifactory.Index.PackageCleanupPolicy("my-version-policy", new()
{
Key = "my-version-policy",
Description = "Keep only latest versions",
CronExpression = "0 0 2 ? * MON-SAT *",
DurationInMinutes = 60,
Enabled = true,
SkipTrashcan = false,
SearchCriteria = new Artifactory.Inputs.PackageCleanupPolicySearchCriteriaArgs
{
PackageTypes = new[]
{
"maven",
},
Repos = new[]
{
"**",
},
IncludeAllProjects = true,
IncludedProjects = new() { },
IncludedPackages = new[]
{
"**",
},
ExcludedPackages = new[]
{
"com/jfrog/latest",
},
KeepLastNVersions = 5,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.artifactory.PackageCleanupPolicy;
import com.pulumi.artifactory.PackageCleanupPolicyArgs;
import com.pulumi.artifactory.inputs.PackageCleanupPolicySearchCriteriaArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var my_version_policy = new PackageCleanupPolicy("my-version-policy", PackageCleanupPolicyArgs.builder()
.key("my-version-policy")
.description("Keep only latest versions")
.cronExpression("0 0 2 ? * MON-SAT *")
.durationInMinutes(60)
.enabled(true)
.skipTrashcan(false)
.searchCriteria(PackageCleanupPolicySearchCriteriaArgs.builder()
.packageTypes("maven")
.repos("**")
.includeAllProjects(true)
.includedProjects()
.includedPackages("**")
.excludedPackages("com/jfrog/latest")
.keepLastNVersions(5)
.build())
.build());
}
}
resources:
my-version-policy:
type: artifactory:PackageCleanupPolicy
properties:
key: my-version-policy
description: Keep only latest versions
cronExpression: 0 0 2 ? * MON-SAT *
durationInMinutes: 60
enabled: true
skipTrashcan: false
searchCriteria:
packageTypes:
- maven
repos:
- '**'
includeAllProjects: true
includedProjects: []
includedPackages:
- '**'
excludedPackages:
- com/jfrog/latest
keepLastNVersions: 5
Properties-based Cleanup Policy
import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";
const my_properties_policy = new artifactory.PackageCleanupPolicy("my-properties-policy", {
key: "my-properties-policy",
description: "Cleanup based on properties",
cronExpression: "0 0 2 ? * MON-SAT *",
durationInMinutes: 60,
enabled: true,
skipTrashcan: false,
searchCriteria: {
packageTypes: ["docker"],
repos: ["**"],
includeAllProjects: true,
includedProjects: [],
includedPackages: ["**"],
excludedPackages: ["com/jfrog/latest"],
includedProperties: {
"build.name": ["my-app"],
},
},
});
import pulumi
import pulumi_artifactory as artifactory
my_properties_policy = artifactory.PackageCleanupPolicy("my-properties-policy",
key="my-properties-policy",
description="Cleanup based on properties",
cron_expression="0 0 2 ? * MON-SAT *",
duration_in_minutes=60,
enabled=True,
skip_trashcan=False,
search_criteria={
"package_types": ["docker"],
"repos": ["**"],
"include_all_projects": True,
"included_projects": [],
"included_packages": ["**"],
"excluded_packages": ["com/jfrog/latest"],
"included_properties": {
"build.name": ["my-app"],
},
})
package main
import (
"github.com/pulumi/pulumi-artifactory/sdk/v8/go/artifactory"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := artifactory.NewPackageCleanupPolicy(ctx, "my-properties-policy", &artifactory.PackageCleanupPolicyArgs{
Key: pulumi.String("my-properties-policy"),
Description: pulumi.String("Cleanup based on properties"),
CronExpression: pulumi.String("0 0 2 ? * MON-SAT *"),
DurationInMinutes: pulumi.Int(60),
Enabled: pulumi.Bool(true),
SkipTrashcan: pulumi.Bool(false),
SearchCriteria: &artifactory.PackageCleanupPolicySearchCriteriaArgs{
PackageTypes: pulumi.StringArray{
pulumi.String("docker"),
},
Repos: pulumi.StringArray{
pulumi.String("**"),
},
IncludeAllProjects: pulumi.Bool(true),
IncludedProjects: pulumi.StringArray{},
IncludedPackages: pulumi.StringArray{
pulumi.String("**"),
},
ExcludedPackages: pulumi.StringArray{
pulumi.String("com/jfrog/latest"),
},
IncludedProperties: pulumi.StringArrayMap{
"build.name": pulumi.StringArray{
pulumi.String("my-app"),
},
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Artifactory = Pulumi.Artifactory;
return await Deployment.RunAsync(() =>
{
var my_properties_policy = new Artifactory.Index.PackageCleanupPolicy("my-properties-policy", new()
{
Key = "my-properties-policy",
Description = "Cleanup based on properties",
CronExpression = "0 0 2 ? * MON-SAT *",
DurationInMinutes = 60,
Enabled = true,
SkipTrashcan = false,
SearchCriteria = new Artifactory.Inputs.PackageCleanupPolicySearchCriteriaArgs
{
PackageTypes = new[]
{
"docker",
},
Repos = new[]
{
"**",
},
IncludeAllProjects = true,
IncludedProjects = new() { },
IncludedPackages = new[]
{
"**",
},
ExcludedPackages = new[]
{
"com/jfrog/latest",
},
IncludedProperties =
{
{ "build.name", new[]
{
"my-app",
} },
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.artifactory.PackageCleanupPolicy;
import com.pulumi.artifactory.PackageCleanupPolicyArgs;
import com.pulumi.artifactory.inputs.PackageCleanupPolicySearchCriteriaArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var my_properties_policy = new PackageCleanupPolicy("my-properties-policy", PackageCleanupPolicyArgs.builder()
.key("my-properties-policy")
.description("Cleanup based on properties")
.cronExpression("0 0 2 ? * MON-SAT *")
.durationInMinutes(60)
.enabled(true)
.skipTrashcan(false)
.searchCriteria(PackageCleanupPolicySearchCriteriaArgs.builder()
.packageTypes("docker")
.repos("**")
.includeAllProjects(true)
.includedProjects()
.includedPackages("**")
.excludedPackages("com/jfrog/latest")
.includedProperties(Map.of("build.name", "my-app"))
.build())
.build());
}
}
resources:
my-properties-policy:
type: artifactory:PackageCleanupPolicy
properties:
key: my-properties-policy
description: Cleanup based on properties
cronExpression: 0 0 2 ? * MON-SAT *
durationInMinutes: 60
enabled: true
skipTrashcan: false
searchCriteria:
packageTypes:
- docker
repos:
- '**'
includeAllProjects: true
includedProjects: []
includedPackages:
- '**'
excludedPackages:
- com/jfrog/latest
includedProperties:
build.name:
- my-app
Using Variables for Condition Fields
You can use Terraform variables for condition fields (createdBeforeInDays, lastDownloadedBeforeInDays, createdBeforeInMonths, lastDownloadedBeforeInMonths, keepLastNVersions, includedProperties) and durationInMinutes. The validator will skip validation when values are unknown (variables), allowing terraform validate to pass without requiring variable values.
Example with variables:
import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";
const config = new pulumi.Config();
const cleanupPolicyLastDownloadedBeforeInDays = config.getNumber("cleanupPolicyLastDownloadedBeforeInDays") || 60;
const cleanupPolicyDurationInMinutes = config.getNumber("cleanupPolicyDurationInMinutes") || 120;
const my_cleanup_policy = new artifactory.PackageCleanupPolicy("my-cleanup-policy", {
key: "my-cleanup-policy",
description: "My cleanup policy with variables",
cronExpression: "0 0 2 ? * MON-SAT *",
durationInMinutes: cleanupPolicyDurationInMinutes,
enabled: true,
skipTrashcan: false,
searchCriteria: {
packageTypes: [
"docker",
"generic",
"helm",
"helmoci",
"nuget",
"terraform",
],
repos: ["**"],
includeAllProjects: false,
includedProjects: ["default"],
includedPackages: ["**"],
excludedPackages: ["com/jfrog/latest"],
lastDownloadedBeforeInDays: cleanupPolicyLastDownloadedBeforeInDays,
},
});
import pulumi
import pulumi_artifactory as artifactory
config = pulumi.Config()
cleanup_policy_last_downloaded_before_in_days = config.get_float("cleanupPolicyLastDownloadedBeforeInDays")
if cleanup_policy_last_downloaded_before_in_days is None:
cleanup_policy_last_downloaded_before_in_days = 60
cleanup_policy_duration_in_minutes = config.get_float("cleanupPolicyDurationInMinutes")
if cleanup_policy_duration_in_minutes is None:
cleanup_policy_duration_in_minutes = 120
my_cleanup_policy = artifactory.PackageCleanupPolicy("my-cleanup-policy",
key="my-cleanup-policy",
description="My cleanup policy with variables",
cron_expression="0 0 2 ? * MON-SAT *",
duration_in_minutes=cleanup_policy_duration_in_minutes,
enabled=True,
skip_trashcan=False,
search_criteria={
"package_types": [
"docker",
"generic",
"helm",
"helmoci",
"nuget",
"terraform",
],
"repos": ["**"],
"include_all_projects": False,
"included_projects": ["default"],
"included_packages": ["**"],
"excluded_packages": ["com/jfrog/latest"],
"last_downloaded_before_in_days": cleanup_policy_last_downloaded_before_in_days,
})
package main
import (
"github.com/pulumi/pulumi-artifactory/sdk/v8/go/artifactory"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
cleanupPolicyLastDownloadedBeforeInDays := float64(60)
if param := cfg.GetFloat64("cleanupPolicyLastDownloadedBeforeInDays"); param != 0 {
cleanupPolicyLastDownloadedBeforeInDays = param
}
cleanupPolicyDurationInMinutes := float64(120)
if param := cfg.GetFloat64("cleanupPolicyDurationInMinutes"); param != 0 {
cleanupPolicyDurationInMinutes = param
}
_, err := artifactory.NewPackageCleanupPolicy(ctx, "my-cleanup-policy", &artifactory.PackageCleanupPolicyArgs{
Key: pulumi.String("my-cleanup-policy"),
Description: pulumi.String("My cleanup policy with variables"),
CronExpression: pulumi.String("0 0 2 ? * MON-SAT *"),
DurationInMinutes: pulumi.Float64(cleanupPolicyDurationInMinutes),
Enabled: pulumi.Bool(true),
SkipTrashcan: pulumi.Bool(false),
SearchCriteria: &artifactory.PackageCleanupPolicySearchCriteriaArgs{
PackageTypes: pulumi.StringArray{
pulumi.String("docker"),
pulumi.String("generic"),
pulumi.String("helm"),
pulumi.String("helmoci"),
pulumi.String("nuget"),
pulumi.String("terraform"),
},
Repos: pulumi.StringArray{
pulumi.String("**"),
},
IncludeAllProjects: pulumi.Bool(false),
IncludedProjects: pulumi.StringArray{
pulumi.String("default"),
},
IncludedPackages: pulumi.StringArray{
pulumi.String("**"),
},
ExcludedPackages: pulumi.StringArray{
pulumi.String("com/jfrog/latest"),
},
LastDownloadedBeforeInDays: pulumi.Float64(cleanupPolicyLastDownloadedBeforeInDays),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Artifactory = Pulumi.Artifactory;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var cleanupPolicyLastDownloadedBeforeInDays = config.GetDouble("cleanupPolicyLastDownloadedBeforeInDays") ?? 60;
var cleanupPolicyDurationInMinutes = config.GetDouble("cleanupPolicyDurationInMinutes") ?? 120;
var my_cleanup_policy = new Artifactory.Index.PackageCleanupPolicy("my-cleanup-policy", new()
{
Key = "my-cleanup-policy",
Description = "My cleanup policy with variables",
CronExpression = "0 0 2 ? * MON-SAT *",
DurationInMinutes = cleanupPolicyDurationInMinutes,
Enabled = true,
SkipTrashcan = false,
SearchCriteria = new Artifactory.Inputs.PackageCleanupPolicySearchCriteriaArgs
{
PackageTypes = new[]
{
"docker",
"generic",
"helm",
"helmoci",
"nuget",
"terraform",
},
Repos = new[]
{
"**",
},
IncludeAllProjects = false,
IncludedProjects = new[]
{
"default",
},
IncludedPackages = new[]
{
"**",
},
ExcludedPackages = new[]
{
"com/jfrog/latest",
},
LastDownloadedBeforeInDays = cleanupPolicyLastDownloadedBeforeInDays,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.artifactory.PackageCleanupPolicy;
import com.pulumi.artifactory.PackageCleanupPolicyArgs;
import com.pulumi.artifactory.inputs.PackageCleanupPolicySearchCriteriaArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var config = ctx.config();
final var cleanupPolicyLastDownloadedBeforeInDays = config.get("cleanupPolicyLastDownloadedBeforeInDays").orElse(60);
final var cleanupPolicyDurationInMinutes = config.get("cleanupPolicyDurationInMinutes").orElse(120);
var my_cleanup_policy = new PackageCleanupPolicy("my-cleanup-policy", PackageCleanupPolicyArgs.builder()
.key("my-cleanup-policy")
.description("My cleanup policy with variables")
.cronExpression("0 0 2 ? * MON-SAT *")
.durationInMinutes(cleanupPolicyDurationInMinutes)
.enabled(true)
.skipTrashcan(false)
.searchCriteria(PackageCleanupPolicySearchCriteriaArgs.builder()
.packageTypes(
"docker",
"generic",
"helm",
"helmoci",
"nuget",
"terraform")
.repos("**")
.includeAllProjects(false)
.includedProjects("default")
.includedPackages("**")
.excludedPackages("com/jfrog/latest")
.lastDownloadedBeforeInDays(cleanupPolicyLastDownloadedBeforeInDays)
.build())
.build());
}
}
configuration:
cleanupPolicyLastDownloadedBeforeInDays:
type: number
default: 60
cleanupPolicyDurationInMinutes:
type: number
default: 120
resources:
my-cleanup-policy:
type: artifactory:PackageCleanupPolicy
properties:
key: my-cleanup-policy
description: My cleanup policy with variables
cronExpression: 0 0 2 ? * MON-SAT *
durationInMinutes: ${cleanupPolicyDurationInMinutes}
enabled: true
skipTrashcan: false
searchCriteria:
packageTypes:
- docker
- generic
- helm
- helmoci
- nuget
- terraform
repos:
- '**'
includeAllProjects: false
includedProjects:
- default
includedPackages:
- '**'
excludedPackages:
- com/jfrog/latest
lastDownloadedBeforeInDays: ${cleanupPolicyLastDownloadedBeforeInDays}
Important Notes:
- Variables with default values allow
terraform validateto pass without requiring variable values - Variables without default values will require values to be provided during
pulumi previeworpulumi up - The validator automatically skips validation when condition field values are unknown (variables), preventing false validation errors during
terraform validate
Validation Rules
The cleanup policy resource enforces the following validation rules:
Condition Types: A policy must use exactly one of the following condition types:
- Time-based conditions (
days-based) - Version-based condition (
keepLastNVersions) - Properties-based condition (
includedProperties)
- Time-based conditions (
Mutual Exclusivity: Cannot use multiple condition types together.
Zero Values: Time-based and version-based conditions must have values greater than 0.
Days vs Months: Cannot use both days-based conditions (
createdBeforeInDays,lastDownloadedBeforeInDays) and months-based conditions (createdBeforeInMonths,lastDownloadedBeforeInMonths) together.Properties Validation: Properties-based conditions must have exactly one key with exactly one string value.
Project Configuration: When
includeAllProjectsis set totrue, theincludedProjectsfield can be empty array. WhenincludeAllProjectsisfalse,includedProjectsmust contain at least one project key.Project-level Policy Constraints: When
projectKeyis specified (project-level policy):includeAllProjectsmust be set tofalseincludedProjectsshould be empty array[]- Policy
keymust start with the project key value as a prefix followed by a hyphen- ✅ Valid:
projectKey = "myproj"→key = "myproj-cleanup-policy" - ❌ Invalid:
projectKey = "myproj"→key = "cleanup-policy"(missing prefix) - ❌ Invalid:
projectKey = "myproj"→key = "other-cleanup-policy"(wrong prefix)
- ✅ Valid:
Supported Package Types
The following package types are supported for cleanup policies with their respective minimum Artifactory versions:
- alpine - Alpine Linux packages (supported from 7.108.0)
- ansible - Ansible collections and roles (supported from 7.104.2)
- cargo - Rust Cargo packages (supported from 7.102.0)
- chef - Chef cookbooks (supported from 7.112.0)
- cocoapods - CocoaPods packages (supported from 7.99.1)
- composer - PHP Composer packages (supported from 7.116.0)
- conan - Conan C/C++ packages (supported from 7.98.2)
- conda - Conda packages (supported from 7.105.2)
- debian - Debian packages (supported from 7.98.2)
- docker - Docker images (supported from 7.98.2, version-based condition (keep_last_n_versions) from 7.115.1)
- gems - Ruby gems (supported from 7.96.3)
- generic - Generic packages (supported from 7.98.2, version-based conditions is not supported)
- go - Go modules (supported from 7.98.2)
- gradle - Gradle packages (supported from 7.98.2)
- helm - Helm charts (supported from 7.98.2)
- helmoci - Helm OCI charts (supported from 7.102.0, version-based conditions (keep_last_n_versions) from 7.115.1)
- huggingfaceml - Hugging Face ML models (supported from 7.100.0)
- machinelearning - Machine learning models (supported from 7.104.2)
- maven - Maven packages (supported from 7.98.2)
- npm - Node.js packages (supported from 7.98.2)
- nuget - .NET NuGet packages (supported from 7.98.2)
- oci - OCI images (supported from 7.90.1, version-based conditions (keep_last_n_versions) from 7.115.1)
- puppet - Puppet modules (supported from 7.112.0)
- pypi - Python packages (supported from 7.98.2)
- rpm|yum - RPM packages (supported from 7.98.2)
- sbt - Scala SBT packages (supported from 7.108.0)
- swift - Swift packages
- terraform - Terraform modules (supported from 7.99.1)
- terraformbackend - Terraform backend configurations (supported from 7.103.0)
Version Compatibility
- The
createdBeforeInDaysandlastDownloadedBeforeInDaysattributes are only supported in Artifactory 7.111.2 and later. For earlier versions, usecreatedBeforeInMonthsandlastDownloadedBeforeInMonths.
Create PackageCleanupPolicy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new PackageCleanupPolicy(name: string, args: PackageCleanupPolicyArgs, opts?: CustomResourceOptions);@overload
def PackageCleanupPolicy(resource_name: str,
args: PackageCleanupPolicyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def PackageCleanupPolicy(resource_name: str,
opts: Optional[ResourceOptions] = None,
key: Optional[str] = None,
search_criteria: Optional[PackageCleanupPolicySearchCriteriaArgs] = None,
cron_expression: Optional[str] = None,
description: Optional[str] = None,
duration_in_minutes: Optional[int] = None,
enabled: Optional[bool] = None,
project_key: Optional[str] = None,
skip_trashcan: Optional[bool] = None)func NewPackageCleanupPolicy(ctx *Context, name string, args PackageCleanupPolicyArgs, opts ...ResourceOption) (*PackageCleanupPolicy, error)public PackageCleanupPolicy(string name, PackageCleanupPolicyArgs args, CustomResourceOptions? opts = null)
public PackageCleanupPolicy(String name, PackageCleanupPolicyArgs args)
public PackageCleanupPolicy(String name, PackageCleanupPolicyArgs args, CustomResourceOptions options)
type: artifactory:PackageCleanupPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args PackageCleanupPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args PackageCleanupPolicyArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args PackageCleanupPolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PackageCleanupPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PackageCleanupPolicyArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
PackageCleanupPolicy Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The PackageCleanupPolicy resource accepts the following input properties:
- Key string
- An ID that is used to identify the cleanup policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
- Search
Criteria PackageCleanup Policy Search Criteria - Cron
Expression string - The cron expression that determines when the policy is run, However if left empty the policy will not run automatically and can only be triggered manually.
- Description string
- Duration
In intMinutes - The maximum duration (in minutes) for policy execution, after which the policy will stop running even if not completed. While setting a maximum run duration for a policy is useful for adhering to a strict cleanup schedule, it can cause the policy to stop before completion.
- Enabled bool
- A cleanup policy must be created inactive. But if used it must be set to
false. If set totruewhen calling this API, the API call will fail and an error message is received. Defaults totrue - Project
Key string - This attribute is used only for project-level cleanup policies, it is not used for global-level policies. When specified, the policy will be scoped to the specified project. Note: The policy
keymust start with this project key value as a prefix (e.g., ifprojectKeyis"myproj", thekeyshould be"myproj-policy-name"). - Skip
Trashcan bool - A true value means that when this policy is executed, packages will be permanently deleted. false means that when the policy is executed packages will be deleted to the Trash Can. Defaults to
false.
- Key string
- An ID that is used to identify the cleanup policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
- Search
Criteria PackageCleanup Policy Search Criteria Args - Cron
Expression string - The cron expression that determines when the policy is run, However if left empty the policy will not run automatically and can only be triggered manually.
- Description string
- Duration
In intMinutes - The maximum duration (in minutes) for policy execution, after which the policy will stop running even if not completed. While setting a maximum run duration for a policy is useful for adhering to a strict cleanup schedule, it can cause the policy to stop before completion.
- Enabled bool
- A cleanup policy must be created inactive. But if used it must be set to
false. If set totruewhen calling this API, the API call will fail and an error message is received. Defaults totrue - Project
Key string - This attribute is used only for project-level cleanup policies, it is not used for global-level policies. When specified, the policy will be scoped to the specified project. Note: The policy
keymust start with this project key value as a prefix (e.g., ifprojectKeyis"myproj", thekeyshould be"myproj-policy-name"). - Skip
Trashcan bool - A true value means that when this policy is executed, packages will be permanently deleted. false means that when the policy is executed packages will be deleted to the Trash Can. Defaults to
false.
- key String
- An ID that is used to identify the cleanup policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
- search
Criteria PackageCleanup Policy Search Criteria - cron
Expression String - The cron expression that determines when the policy is run, However if left empty the policy will not run automatically and can only be triggered manually.
- description String
- duration
In IntegerMinutes - The maximum duration (in minutes) for policy execution, after which the policy will stop running even if not completed. While setting a maximum run duration for a policy is useful for adhering to a strict cleanup schedule, it can cause the policy to stop before completion.
- enabled Boolean
- A cleanup policy must be created inactive. But if used it must be set to
false. If set totruewhen calling this API, the API call will fail and an error message is received. Defaults totrue - project
Key String - This attribute is used only for project-level cleanup policies, it is not used for global-level policies. When specified, the policy will be scoped to the specified project. Note: The policy
keymust start with this project key value as a prefix (e.g., ifprojectKeyis"myproj", thekeyshould be"myproj-policy-name"). - skip
Trashcan Boolean - A true value means that when this policy is executed, packages will be permanently deleted. false means that when the policy is executed packages will be deleted to the Trash Can. Defaults to
false.
- key string
- An ID that is used to identify the cleanup policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
- search
Criteria PackageCleanup Policy Search Criteria - cron
Expression string - The cron expression that determines when the policy is run, However if left empty the policy will not run automatically and can only be triggered manually.
- description string
- duration
In numberMinutes - The maximum duration (in minutes) for policy execution, after which the policy will stop running even if not completed. While setting a maximum run duration for a policy is useful for adhering to a strict cleanup schedule, it can cause the policy to stop before completion.
- enabled boolean
- A cleanup policy must be created inactive. But if used it must be set to
false. If set totruewhen calling this API, the API call will fail and an error message is received. Defaults totrue - project
Key string - This attribute is used only for project-level cleanup policies, it is not used for global-level policies. When specified, the policy will be scoped to the specified project. Note: The policy
keymust start with this project key value as a prefix (e.g., ifprojectKeyis"myproj", thekeyshould be"myproj-policy-name"). - skip
Trashcan boolean - A true value means that when this policy is executed, packages will be permanently deleted. false means that when the policy is executed packages will be deleted to the Trash Can. Defaults to
false.
- key str
- An ID that is used to identify the cleanup policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
- search_
criteria PackageCleanup Policy Search Criteria Args - cron_
expression str - The cron expression that determines when the policy is run, However if left empty the policy will not run automatically and can only be triggered manually.
- description str
- duration_
in_ intminutes - The maximum duration (in minutes) for policy execution, after which the policy will stop running even if not completed. While setting a maximum run duration for a policy is useful for adhering to a strict cleanup schedule, it can cause the policy to stop before completion.
- enabled bool
- A cleanup policy must be created inactive. But if used it must be set to
false. If set totruewhen calling this API, the API call will fail and an error message is received. Defaults totrue - project_
key str - This attribute is used only for project-level cleanup policies, it is not used for global-level policies. When specified, the policy will be scoped to the specified project. Note: The policy
keymust start with this project key value as a prefix (e.g., ifprojectKeyis"myproj", thekeyshould be"myproj-policy-name"). - skip_
trashcan bool - A true value means that when this policy is executed, packages will be permanently deleted. false means that when the policy is executed packages will be deleted to the Trash Can. Defaults to
false.
- key String
- An ID that is used to identify the cleanup policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
- search
Criteria Property Map - cron
Expression String - The cron expression that determines when the policy is run, However if left empty the policy will not run automatically and can only be triggered manually.
- description String
- duration
In NumberMinutes - The maximum duration (in minutes) for policy execution, after which the policy will stop running even if not completed. While setting a maximum run duration for a policy is useful for adhering to a strict cleanup schedule, it can cause the policy to stop before completion.
- enabled Boolean
- A cleanup policy must be created inactive. But if used it must be set to
false. If set totruewhen calling this API, the API call will fail and an error message is received. Defaults totrue - project
Key String - This attribute is used only for project-level cleanup policies, it is not used for global-level policies. When specified, the policy will be scoped to the specified project. Note: The policy
keymust start with this project key value as a prefix (e.g., ifprojectKeyis"myproj", thekeyshould be"myproj-policy-name"). - skip
Trashcan Boolean - A true value means that when this policy is executed, packages will be permanently deleted. false means that when the policy is executed packages will be deleted to the Trash Can. Defaults to
false.
Outputs
All input properties are implicitly available as output properties. Additionally, the PackageCleanupPolicy resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing PackageCleanupPolicy Resource
Get an existing PackageCleanupPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: PackageCleanupPolicyState, opts?: CustomResourceOptions): PackageCleanupPolicy@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
cron_expression: Optional[str] = None,
description: Optional[str] = None,
duration_in_minutes: Optional[int] = None,
enabled: Optional[bool] = None,
key: Optional[str] = None,
project_key: Optional[str] = None,
search_criteria: Optional[PackageCleanupPolicySearchCriteriaArgs] = None,
skip_trashcan: Optional[bool] = None) -> PackageCleanupPolicyfunc GetPackageCleanupPolicy(ctx *Context, name string, id IDInput, state *PackageCleanupPolicyState, opts ...ResourceOption) (*PackageCleanupPolicy, error)public static PackageCleanupPolicy Get(string name, Input<string> id, PackageCleanupPolicyState? state, CustomResourceOptions? opts = null)public static PackageCleanupPolicy get(String name, Output<String> id, PackageCleanupPolicyState state, CustomResourceOptions options)resources: _: type: artifactory:PackageCleanupPolicy get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Cron
Expression string - The cron expression that determines when the policy is run, However if left empty the policy will not run automatically and can only be triggered manually.
- Description string
- Duration
In intMinutes - The maximum duration (in minutes) for policy execution, after which the policy will stop running even if not completed. While setting a maximum run duration for a policy is useful for adhering to a strict cleanup schedule, it can cause the policy to stop before completion.
- Enabled bool
- A cleanup policy must be created inactive. But if used it must be set to
false. If set totruewhen calling this API, the API call will fail and an error message is received. Defaults totrue - Key string
- An ID that is used to identify the cleanup policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
- Project
Key string - This attribute is used only for project-level cleanup policies, it is not used for global-level policies. When specified, the policy will be scoped to the specified project. Note: The policy
keymust start with this project key value as a prefix (e.g., ifprojectKeyis"myproj", thekeyshould be"myproj-policy-name"). - Search
Criteria PackageCleanup Policy Search Criteria - Skip
Trashcan bool - A true value means that when this policy is executed, packages will be permanently deleted. false means that when the policy is executed packages will be deleted to the Trash Can. Defaults to
false.
- Cron
Expression string - The cron expression that determines when the policy is run, However if left empty the policy will not run automatically and can only be triggered manually.
- Description string
- Duration
In intMinutes - The maximum duration (in minutes) for policy execution, after which the policy will stop running even if not completed. While setting a maximum run duration for a policy is useful for adhering to a strict cleanup schedule, it can cause the policy to stop before completion.
- Enabled bool
- A cleanup policy must be created inactive. But if used it must be set to
false. If set totruewhen calling this API, the API call will fail and an error message is received. Defaults totrue - Key string
- An ID that is used to identify the cleanup policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
- Project
Key string - This attribute is used only for project-level cleanup policies, it is not used for global-level policies. When specified, the policy will be scoped to the specified project. Note: The policy
keymust start with this project key value as a prefix (e.g., ifprojectKeyis"myproj", thekeyshould be"myproj-policy-name"). - Search
Criteria PackageCleanup Policy Search Criteria Args - Skip
Trashcan bool - A true value means that when this policy is executed, packages will be permanently deleted. false means that when the policy is executed packages will be deleted to the Trash Can. Defaults to
false.
- cron
Expression String - The cron expression that determines when the policy is run, However if left empty the policy will not run automatically and can only be triggered manually.
- description String
- duration
In IntegerMinutes - The maximum duration (in minutes) for policy execution, after which the policy will stop running even if not completed. While setting a maximum run duration for a policy is useful for adhering to a strict cleanup schedule, it can cause the policy to stop before completion.
- enabled Boolean
- A cleanup policy must be created inactive. But if used it must be set to
false. If set totruewhen calling this API, the API call will fail and an error message is received. Defaults totrue - key String
- An ID that is used to identify the cleanup policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
- project
Key String - This attribute is used only for project-level cleanup policies, it is not used for global-level policies. When specified, the policy will be scoped to the specified project. Note: The policy
keymust start with this project key value as a prefix (e.g., ifprojectKeyis"myproj", thekeyshould be"myproj-policy-name"). - search
Criteria PackageCleanup Policy Search Criteria - skip
Trashcan Boolean - A true value means that when this policy is executed, packages will be permanently deleted. false means that when the policy is executed packages will be deleted to the Trash Can. Defaults to
false.
- cron
Expression string - The cron expression that determines when the policy is run, However if left empty the policy will not run automatically and can only be triggered manually.
- description string
- duration
In numberMinutes - The maximum duration (in minutes) for policy execution, after which the policy will stop running even if not completed. While setting a maximum run duration for a policy is useful for adhering to a strict cleanup schedule, it can cause the policy to stop before completion.
- enabled boolean
- A cleanup policy must be created inactive. But if used it must be set to
false. If set totruewhen calling this API, the API call will fail and an error message is received. Defaults totrue - key string
- An ID that is used to identify the cleanup policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
- project
Key string - This attribute is used only for project-level cleanup policies, it is not used for global-level policies. When specified, the policy will be scoped to the specified project. Note: The policy
keymust start with this project key value as a prefix (e.g., ifprojectKeyis"myproj", thekeyshould be"myproj-policy-name"). - search
Criteria PackageCleanup Policy Search Criteria - skip
Trashcan boolean - A true value means that when this policy is executed, packages will be permanently deleted. false means that when the policy is executed packages will be deleted to the Trash Can. Defaults to
false.
- cron_
expression str - The cron expression that determines when the policy is run, However if left empty the policy will not run automatically and can only be triggered manually.
- description str
- duration_
in_ intminutes - The maximum duration (in minutes) for policy execution, after which the policy will stop running even if not completed. While setting a maximum run duration for a policy is useful for adhering to a strict cleanup schedule, it can cause the policy to stop before completion.
- enabled bool
- A cleanup policy must be created inactive. But if used it must be set to
false. If set totruewhen calling this API, the API call will fail and an error message is received. Defaults totrue - key str
- An ID that is used to identify the cleanup policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
- project_
key str - This attribute is used only for project-level cleanup policies, it is not used for global-level policies. When specified, the policy will be scoped to the specified project. Note: The policy
keymust start with this project key value as a prefix (e.g., ifprojectKeyis"myproj", thekeyshould be"myproj-policy-name"). - search_
criteria PackageCleanup Policy Search Criteria Args - skip_
trashcan bool - A true value means that when this policy is executed, packages will be permanently deleted. false means that when the policy is executed packages will be deleted to the Trash Can. Defaults to
false.
- cron
Expression String - The cron expression that determines when the policy is run, However if left empty the policy will not run automatically and can only be triggered manually.
- description String
- duration
In NumberMinutes - The maximum duration (in minutes) for policy execution, after which the policy will stop running even if not completed. While setting a maximum run duration for a policy is useful for adhering to a strict cleanup schedule, it can cause the policy to stop before completion.
- enabled Boolean
- A cleanup policy must be created inactive. But if used it must be set to
false. If set totruewhen calling this API, the API call will fail and an error message is received. Defaults totrue - key String
- An ID that is used to identify the cleanup policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
- project
Key String - This attribute is used only for project-level cleanup policies, it is not used for global-level policies. When specified, the policy will be scoped to the specified project. Note: The policy
keymust start with this project key value as a prefix (e.g., ifprojectKeyis"myproj", thekeyshould be"myproj-policy-name"). - search
Criteria Property Map - skip
Trashcan Boolean - A true value means that when this policy is executed, packages will be permanently deleted. false means that when the policy is executed packages will be deleted to the Trash Can. Defaults to
false.
Supporting Types
PackageCleanupPolicySearchCriteria, PackageCleanupPolicySearchCriteriaArgs
- Included
Packages List<string> - Specify a pattern for a package name or an explicit package name on which you want the cleanup policy to run. Only one pattern or explicit name can be entered. To include all packages, use
**. Example:includedPackages = ["**"] - Included
Projects List<string> - Enter the project keys for the projects on which you want the policy to run. To include repositories that are not assigned to any project, enter the project key
default. Can be empty whenincludeAllProjectsis set totrue. - Package
Types List<string> - The package types that are cleaned up by the policy. Support: alpine, ansible, cargo, chef, cocoapods, composer, conan, conda, debian, docker, gems, generic, go, gradle, helm, helmoci, huggingfaceml, machinelearning, maven, npm, nuget, oci, puppet, pypi, sbt, swift, terraform, terraformbackend, yum.
- Repos List<string>
- Specify one or more patterns for the repository name(s) on which you want the cleanup policy to run. You can also specify explicit repository names. Specifying at least one pattern or explicit name is mandatory. Only packages in repositories that match the pattern or explicit name will be deleted. For including all repos use
**. Example:repos = ["**"] - Created
Before intIn Days The cleanup policy will delete packages based on how long ago they were created. For example, if this parameter is 5 then packages created more than 5 days ago will be deleted as part of the policy.
~>JFrog recommends using the
createdBeforeInDayscondition to ensure that packages currently in use are not deleted.- Created
Before intIn Months The cleanup policy will delete packages based on how long ago they were created. For example, if this parameter is 2 then packages created more than 2 months ago will be deleted as part of the policy.
~>JFrog recommends using the
createdBeforeInMonthscondition to ensure that packages currently in use are not deleted.- Excluded
Packages List<string> - Specify explicit package names that you want excluded from the policy. Only explicit names (and not patterns) are accepted.
- Excluded
Properties Dictionary<string, ImmutableArray<string>> - A key-value pair applied to the lead artifact of a package. Packages with this property will be excluded from deletion.
- Excluded
Repos List<string> - Specify patterns for repository names or explicit repository names that you want excluded from the cleanup policy.
- Include
All boolProjects Set this value to
trueif you want the policy to run on all Artifactory projects. The default value isfalse.~>This parameter is relevant only on the global level, for Platform Admins.
- Included
Properties Dictionary<string, ImmutableArray<string>> - A key-value pair applied to the lead artifact of a package. Packages with this property will be deleted.
- Keep
Last intNVersions Set a value for the number of latest versions to keep. The cleanup policy will remove all versions prior to the number you select here. The latest version is always excluded.
~>Not all package types support this condition. For information on which package types support this condition, learn more.
- Last
Downloaded intBefore In Days The cleanup policy will delete packages based on how long ago they were downloaded. For example, if this parameter is 5 then packages downloaded more than 5 days ago will be deleted as part of the policy.
~>JFrog recommends using the
lastDownloadedBeforeInDayscondition to ensure that packages currently in use are not deleted.- Last
Downloaded intBefore In Months The cleanup policy will delete packages based on how long ago they were downloaded. For example, if this parameter is 5 then packages downloaded more than 5 months ago will be deleted as part of the policy.
~>JFrog recommends using the
lastDownloadedBeforeInMonthscondition to ensure that packages currently in use are not deleted.
- Included
Packages []string - Specify a pattern for a package name or an explicit package name on which you want the cleanup policy to run. Only one pattern or explicit name can be entered. To include all packages, use
**. Example:includedPackages = ["**"] - Included
Projects []string - Enter the project keys for the projects on which you want the policy to run. To include repositories that are not assigned to any project, enter the project key
default. Can be empty whenincludeAllProjectsis set totrue. - Package
Types []string - The package types that are cleaned up by the policy. Support: alpine, ansible, cargo, chef, cocoapods, composer, conan, conda, debian, docker, gems, generic, go, gradle, helm, helmoci, huggingfaceml, machinelearning, maven, npm, nuget, oci, puppet, pypi, sbt, swift, terraform, terraformbackend, yum.
- Repos []string
- Specify one or more patterns for the repository name(s) on which you want the cleanup policy to run. You can also specify explicit repository names. Specifying at least one pattern or explicit name is mandatory. Only packages in repositories that match the pattern or explicit name will be deleted. For including all repos use
**. Example:repos = ["**"] - Created
Before intIn Days The cleanup policy will delete packages based on how long ago they were created. For example, if this parameter is 5 then packages created more than 5 days ago will be deleted as part of the policy.
~>JFrog recommends using the
createdBeforeInDayscondition to ensure that packages currently in use are not deleted.- Created
Before intIn Months The cleanup policy will delete packages based on how long ago they were created. For example, if this parameter is 2 then packages created more than 2 months ago will be deleted as part of the policy.
~>JFrog recommends using the
createdBeforeInMonthscondition to ensure that packages currently in use are not deleted.- Excluded
Packages []string - Specify explicit package names that you want excluded from the policy. Only explicit names (and not patterns) are accepted.
- Excluded
Properties map[string][]string - A key-value pair applied to the lead artifact of a package. Packages with this property will be excluded from deletion.
- Excluded
Repos []string - Specify patterns for repository names or explicit repository names that you want excluded from the cleanup policy.
- Include
All boolProjects Set this value to
trueif you want the policy to run on all Artifactory projects. The default value isfalse.~>This parameter is relevant only on the global level, for Platform Admins.
- Included
Properties map[string][]string - A key-value pair applied to the lead artifact of a package. Packages with this property will be deleted.
- Keep
Last intNVersions Set a value for the number of latest versions to keep. The cleanup policy will remove all versions prior to the number you select here. The latest version is always excluded.
~>Not all package types support this condition. For information on which package types support this condition, learn more.
- Last
Downloaded intBefore In Days The cleanup policy will delete packages based on how long ago they were downloaded. For example, if this parameter is 5 then packages downloaded more than 5 days ago will be deleted as part of the policy.
~>JFrog recommends using the
lastDownloadedBeforeInDayscondition to ensure that packages currently in use are not deleted.- Last
Downloaded intBefore In Months The cleanup policy will delete packages based on how long ago they were downloaded. For example, if this parameter is 5 then packages downloaded more than 5 months ago will be deleted as part of the policy.
~>JFrog recommends using the
lastDownloadedBeforeInMonthscondition to ensure that packages currently in use are not deleted.
- included
Packages List<String> - Specify a pattern for a package name or an explicit package name on which you want the cleanup policy to run. Only one pattern or explicit name can be entered. To include all packages, use
**. Example:includedPackages = ["**"] - included
Projects List<String> - Enter the project keys for the projects on which you want the policy to run. To include repositories that are not assigned to any project, enter the project key
default. Can be empty whenincludeAllProjectsis set totrue. - package
Types List<String> - The package types that are cleaned up by the policy. Support: alpine, ansible, cargo, chef, cocoapods, composer, conan, conda, debian, docker, gems, generic, go, gradle, helm, helmoci, huggingfaceml, machinelearning, maven, npm, nuget, oci, puppet, pypi, sbt, swift, terraform, terraformbackend, yum.
- repos List<String>
- Specify one or more patterns for the repository name(s) on which you want the cleanup policy to run. You can also specify explicit repository names. Specifying at least one pattern or explicit name is mandatory. Only packages in repositories that match the pattern or explicit name will be deleted. For including all repos use
**. Example:repos = ["**"] - created
Before IntegerIn Days The cleanup policy will delete packages based on how long ago they were created. For example, if this parameter is 5 then packages created more than 5 days ago will be deleted as part of the policy.
~>JFrog recommends using the
createdBeforeInDayscondition to ensure that packages currently in use are not deleted.- created
Before IntegerIn Months The cleanup policy will delete packages based on how long ago they were created. For example, if this parameter is 2 then packages created more than 2 months ago will be deleted as part of the policy.
~>JFrog recommends using the
createdBeforeInMonthscondition to ensure that packages currently in use are not deleted.- excluded
Packages List<String> - Specify explicit package names that you want excluded from the policy. Only explicit names (and not patterns) are accepted.
- excluded
Properties Map<String,List<String>> - A key-value pair applied to the lead artifact of a package. Packages with this property will be excluded from deletion.
- excluded
Repos List<String> - Specify patterns for repository names or explicit repository names that you want excluded from the cleanup policy.
- include
All BooleanProjects Set this value to
trueif you want the policy to run on all Artifactory projects. The default value isfalse.~>This parameter is relevant only on the global level, for Platform Admins.
- included
Properties Map<String,List<String>> - A key-value pair applied to the lead artifact of a package. Packages with this property will be deleted.
- keep
Last IntegerNVersions Set a value for the number of latest versions to keep. The cleanup policy will remove all versions prior to the number you select here. The latest version is always excluded.
~>Not all package types support this condition. For information on which package types support this condition, learn more.
- last
Downloaded IntegerBefore In Days The cleanup policy will delete packages based on how long ago they were downloaded. For example, if this parameter is 5 then packages downloaded more than 5 days ago will be deleted as part of the policy.
~>JFrog recommends using the
lastDownloadedBeforeInDayscondition to ensure that packages currently in use are not deleted.- last
Downloaded IntegerBefore In Months The cleanup policy will delete packages based on how long ago they were downloaded. For example, if this parameter is 5 then packages downloaded more than 5 months ago will be deleted as part of the policy.
~>JFrog recommends using the
lastDownloadedBeforeInMonthscondition to ensure that packages currently in use are not deleted.
- included
Packages string[] - Specify a pattern for a package name or an explicit package name on which you want the cleanup policy to run. Only one pattern or explicit name can be entered. To include all packages, use
**. Example:includedPackages = ["**"] - included
Projects string[] - Enter the project keys for the projects on which you want the policy to run. To include repositories that are not assigned to any project, enter the project key
default. Can be empty whenincludeAllProjectsis set totrue. - package
Types string[] - The package types that are cleaned up by the policy. Support: alpine, ansible, cargo, chef, cocoapods, composer, conan, conda, debian, docker, gems, generic, go, gradle, helm, helmoci, huggingfaceml, machinelearning, maven, npm, nuget, oci, puppet, pypi, sbt, swift, terraform, terraformbackend, yum.
- repos string[]
- Specify one or more patterns for the repository name(s) on which you want the cleanup policy to run. You can also specify explicit repository names. Specifying at least one pattern or explicit name is mandatory. Only packages in repositories that match the pattern or explicit name will be deleted. For including all repos use
**. Example:repos = ["**"] - created
Before numberIn Days The cleanup policy will delete packages based on how long ago they were created. For example, if this parameter is 5 then packages created more than 5 days ago will be deleted as part of the policy.
~>JFrog recommends using the
createdBeforeInDayscondition to ensure that packages currently in use are not deleted.- created
Before numberIn Months The cleanup policy will delete packages based on how long ago they were created. For example, if this parameter is 2 then packages created more than 2 months ago will be deleted as part of the policy.
~>JFrog recommends using the
createdBeforeInMonthscondition to ensure that packages currently in use are not deleted.- excluded
Packages string[] - Specify explicit package names that you want excluded from the policy. Only explicit names (and not patterns) are accepted.
- excluded
Properties {[key: string]: string[]} - A key-value pair applied to the lead artifact of a package. Packages with this property will be excluded from deletion.
- excluded
Repos string[] - Specify patterns for repository names or explicit repository names that you want excluded from the cleanup policy.
- include
All booleanProjects Set this value to
trueif you want the policy to run on all Artifactory projects. The default value isfalse.~>This parameter is relevant only on the global level, for Platform Admins.
- included
Properties {[key: string]: string[]} - A key-value pair applied to the lead artifact of a package. Packages with this property will be deleted.
- keep
Last numberNVersions Set a value for the number of latest versions to keep. The cleanup policy will remove all versions prior to the number you select here. The latest version is always excluded.
~>Not all package types support this condition. For information on which package types support this condition, learn more.
- last
Downloaded numberBefore In Days The cleanup policy will delete packages based on how long ago they were downloaded. For example, if this parameter is 5 then packages downloaded more than 5 days ago will be deleted as part of the policy.
~>JFrog recommends using the
lastDownloadedBeforeInDayscondition to ensure that packages currently in use are not deleted.- last
Downloaded numberBefore In Months The cleanup policy will delete packages based on how long ago they were downloaded. For example, if this parameter is 5 then packages downloaded more than 5 months ago will be deleted as part of the policy.
~>JFrog recommends using the
lastDownloadedBeforeInMonthscondition to ensure that packages currently in use are not deleted.
- included_
packages Sequence[str] - Specify a pattern for a package name or an explicit package name on which you want the cleanup policy to run. Only one pattern or explicit name can be entered. To include all packages, use
**. Example:includedPackages = ["**"] - included_
projects Sequence[str] - Enter the project keys for the projects on which you want the policy to run. To include repositories that are not assigned to any project, enter the project key
default. Can be empty whenincludeAllProjectsis set totrue. - package_
types Sequence[str] - The package types that are cleaned up by the policy. Support: alpine, ansible, cargo, chef, cocoapods, composer, conan, conda, debian, docker, gems, generic, go, gradle, helm, helmoci, huggingfaceml, machinelearning, maven, npm, nuget, oci, puppet, pypi, sbt, swift, terraform, terraformbackend, yum.
- repos Sequence[str]
- Specify one or more patterns for the repository name(s) on which you want the cleanup policy to run. You can also specify explicit repository names. Specifying at least one pattern or explicit name is mandatory. Only packages in repositories that match the pattern or explicit name will be deleted. For including all repos use
**. Example:repos = ["**"] - created_
before_ intin_ days The cleanup policy will delete packages based on how long ago they were created. For example, if this parameter is 5 then packages created more than 5 days ago will be deleted as part of the policy.
~>JFrog recommends using the
createdBeforeInDayscondition to ensure that packages currently in use are not deleted.- created_
before_ intin_ months The cleanup policy will delete packages based on how long ago they were created. For example, if this parameter is 2 then packages created more than 2 months ago will be deleted as part of the policy.
~>JFrog recommends using the
createdBeforeInMonthscondition to ensure that packages currently in use are not deleted.- excluded_
packages Sequence[str] - Specify explicit package names that you want excluded from the policy. Only explicit names (and not patterns) are accepted.
- excluded_
properties Mapping[str, Sequence[str]] - A key-value pair applied to the lead artifact of a package. Packages with this property will be excluded from deletion.
- excluded_
repos Sequence[str] - Specify patterns for repository names or explicit repository names that you want excluded from the cleanup policy.
- include_
all_ boolprojects Set this value to
trueif you want the policy to run on all Artifactory projects. The default value isfalse.~>This parameter is relevant only on the global level, for Platform Admins.
- included_
properties Mapping[str, Sequence[str]] - A key-value pair applied to the lead artifact of a package. Packages with this property will be deleted.
- keep_
last_ intn_ versions Set a value for the number of latest versions to keep. The cleanup policy will remove all versions prior to the number you select here. The latest version is always excluded.
~>Not all package types support this condition. For information on which package types support this condition, learn more.
- last_
downloaded_ intbefore_ in_ days The cleanup policy will delete packages based on how long ago they were downloaded. For example, if this parameter is 5 then packages downloaded more than 5 days ago will be deleted as part of the policy.
~>JFrog recommends using the
lastDownloadedBeforeInDayscondition to ensure that packages currently in use are not deleted.- last_
downloaded_ intbefore_ in_ months The cleanup policy will delete packages based on how long ago they were downloaded. For example, if this parameter is 5 then packages downloaded more than 5 months ago will be deleted as part of the policy.
~>JFrog recommends using the
lastDownloadedBeforeInMonthscondition to ensure that packages currently in use are not deleted.
- included
Packages List<String> - Specify a pattern for a package name or an explicit package name on which you want the cleanup policy to run. Only one pattern or explicit name can be entered. To include all packages, use
**. Example:includedPackages = ["**"] - included
Projects List<String> - Enter the project keys for the projects on which you want the policy to run. To include repositories that are not assigned to any project, enter the project key
default. Can be empty whenincludeAllProjectsis set totrue. - package
Types List<String> - The package types that are cleaned up by the policy. Support: alpine, ansible, cargo, chef, cocoapods, composer, conan, conda, debian, docker, gems, generic, go, gradle, helm, helmoci, huggingfaceml, machinelearning, maven, npm, nuget, oci, puppet, pypi, sbt, swift, terraform, terraformbackend, yum.
- repos List<String>
- Specify one or more patterns for the repository name(s) on which you want the cleanup policy to run. You can also specify explicit repository names. Specifying at least one pattern or explicit name is mandatory. Only packages in repositories that match the pattern or explicit name will be deleted. For including all repos use
**. Example:repos = ["**"] - created
Before NumberIn Days The cleanup policy will delete packages based on how long ago they were created. For example, if this parameter is 5 then packages created more than 5 days ago will be deleted as part of the policy.
~>JFrog recommends using the
createdBeforeInDayscondition to ensure that packages currently in use are not deleted.- created
Before NumberIn Months The cleanup policy will delete packages based on how long ago they were created. For example, if this parameter is 2 then packages created more than 2 months ago will be deleted as part of the policy.
~>JFrog recommends using the
createdBeforeInMonthscondition to ensure that packages currently in use are not deleted.- excluded
Packages List<String> - Specify explicit package names that you want excluded from the policy. Only explicit names (and not patterns) are accepted.
- excluded
Properties Map<List<String>> - A key-value pair applied to the lead artifact of a package. Packages with this property will be excluded from deletion.
- excluded
Repos List<String> - Specify patterns for repository names or explicit repository names that you want excluded from the cleanup policy.
- include
All BooleanProjects Set this value to
trueif you want the policy to run on all Artifactory projects. The default value isfalse.~>This parameter is relevant only on the global level, for Platform Admins.
- included
Properties Map<List<String>> - A key-value pair applied to the lead artifact of a package. Packages with this property will be deleted.
- keep
Last NumberNVersions Set a value for the number of latest versions to keep. The cleanup policy will remove all versions prior to the number you select here. The latest version is always excluded.
~>Not all package types support this condition. For information on which package types support this condition, learn more.
- last
Downloaded NumberBefore In Days The cleanup policy will delete packages based on how long ago they were downloaded. For example, if this parameter is 5 then packages downloaded more than 5 days ago will be deleted as part of the policy.
~>JFrog recommends using the
lastDownloadedBeforeInDayscondition to ensure that packages currently in use are not deleted.- last
Downloaded NumberBefore In Months The cleanup policy will delete packages based on how long ago they were downloaded. For example, if this parameter is 5 then packages downloaded more than 5 months ago will be deleted as part of the policy.
~>JFrog recommends using the
lastDownloadedBeforeInMonthscondition to ensure that packages currently in use are not deleted.
Import
$ pulumi import artifactory:index/packageCleanupPolicy:PackageCleanupPolicy my-cleanup-policy my-policy
$ pulumi import artifactory:index/packageCleanupPolicy:PackageCleanupPolicy my-cleanup-policy my-policy:myproj
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- artifactory pulumi/pulumi-artifactory
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
artifactoryTerraform Provider.
published on Friday, Apr 10, 2026 by Pulumi
