published on Tuesday, May 5, 2026 by Pulumi
published on Tuesday, May 5, 2026 by Pulumi
Provides an Artifactory Archive 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 Retention Policies for more details.
Example Usage
Time-based Archive Policy (Days)
import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";
const my_archive_policy = new artifactory.ArchivePolicy("my-archive-policy", {
key: "my-archive-policy",
description: "My archive policy",
cronExpression: "0 0 2 ? * MON-SAT *",
durationInMinutes: 60,
enabled: true,
skipTrashcan: false,
searchCriteria: {
packageTypes: ["docker"],
repos: ["**"],
includeAllProjects: true,
includedProjects: [],
includedPackages: ["**"],
excludedPackages: ["com/jfrog/latest"],
createdBeforeInDays: 30,
lastDownloadedBeforeInDays: 60,
},
});
import pulumi
import pulumi_artifactory as artifactory
my_archive_policy = artifactory.ArchivePolicy("my-archive-policy",
key="my-archive-policy",
description="My archive policy",
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"],
"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.NewArchivePolicy(ctx, "my-archive-policy", &artifactory.ArchivePolicyArgs{
Key: pulumi.String("my-archive-policy"),
Description: pulumi.String("My archive policy"),
CronExpression: pulumi.String("0 0 2 ? * MON-SAT *"),
DurationInMinutes: pulumi.Int(60),
Enabled: pulumi.Bool(true),
SkipTrashcan: pulumi.Bool(false),
SearchCriteria: &artifactory.ArchivePolicySearchCriteriaArgs{
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"),
},
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_archive_policy = new Artifactory.Index.ArchivePolicy("my-archive-policy", new()
{
Key = "my-archive-policy",
Description = "My archive policy",
CronExpression = "0 0 2 ? * MON-SAT *",
DurationInMinutes = 60,
Enabled = true,
SkipTrashcan = false,
SearchCriteria = new Artifactory.Inputs.ArchivePolicySearchCriteriaArgs
{
PackageTypes = new[]
{
"docker",
},
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.ArchivePolicy;
import com.pulumi.artifactory.ArchivePolicyArgs;
import com.pulumi.artifactory.inputs.ArchivePolicySearchCriteriaArgs;
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_archive_policy = new ArchivePolicy("my-archive-policy", ArchivePolicyArgs.builder()
.key("my-archive-policy")
.description("My archive policy")
.cronExpression("0 0 2 ? * MON-SAT *")
.durationInMinutes(60)
.enabled(true)
.skipTrashcan(false)
.searchCriteria(ArchivePolicySearchCriteriaArgs.builder()
.packageTypes("docker")
.repos("**")
.includeAllProjects(true)
.includedProjects()
.includedPackages("**")
.excludedPackages("com/jfrog/latest")
.createdBeforeInDays(30)
.lastDownloadedBeforeInDays(60)
.build())
.build());
}
}
resources:
my-archive-policy:
type: artifactory:ArchivePolicy
properties:
key: my-archive-policy
description: My archive policy
cronExpression: 0 0 2 ? * MON-SAT *
durationInMinutes: 60
enabled: true
skipTrashcan: false
searchCriteria:
packageTypes:
- docker
repos:
- '**'
includeAllProjects: true
includedProjects: []
includedPackages:
- '**'
excludedPackages:
- com/jfrog/latest
createdBeforeInDays: 30
lastDownloadedBeforeInDays: 60
Version-based Archive Policy
import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";
const my_version_policy = new artifactory.ArchivePolicy("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: ["docker"],
repos: ["**"],
includeAllProjects: true,
includedProjects: [],
includedPackages: ["**"],
excludedPackages: ["com/jfrog/latest"],
keepLastNVersions: 5,
},
});
import pulumi
import pulumi_artifactory as artifactory
my_version_policy = artifactory.ArchivePolicy("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": ["docker"],
"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.NewArchivePolicy(ctx, "my-version-policy", &artifactory.ArchivePolicyArgs{
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.ArchivePolicySearchCriteriaArgs{
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"),
},
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.ArchivePolicy("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.ArchivePolicySearchCriteriaArgs
{
PackageTypes = new[]
{
"docker",
},
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.ArchivePolicy;
import com.pulumi.artifactory.ArchivePolicyArgs;
import com.pulumi.artifactory.inputs.ArchivePolicySearchCriteriaArgs;
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 ArchivePolicy("my-version-policy", ArchivePolicyArgs.builder()
.key("my-version-policy")
.description("Keep only latest versions")
.cronExpression("0 0 2 ? * MON-SAT *")
.durationInMinutes(60)
.enabled(true)
.skipTrashcan(false)
.searchCriteria(ArchivePolicySearchCriteriaArgs.builder()
.packageTypes("docker")
.repos("**")
.includeAllProjects(true)
.includedProjects()
.includedPackages("**")
.excludedPackages("com/jfrog/latest")
.keepLastNVersions(5)
.build())
.build());
}
}
resources:
my-version-policy:
type: artifactory:ArchivePolicy
properties:
key: my-version-policy
description: Keep only latest versions
cronExpression: 0 0 2 ? * MON-SAT *
durationInMinutes: 60
enabled: true
skipTrashcan: false
searchCriteria:
packageTypes:
- docker
repos:
- '**'
includeAllProjects: true
includedProjects: []
includedPackages:
- '**'
excludedPackages:
- com/jfrog/latest
keepLastNVersions: 5
Properties-based Archive Policy
import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";
const my_properties_policy = new artifactory.ArchivePolicy("my-properties-policy", {
key: "my-properties-policy",
description: "Archive 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.ArchivePolicy("my-properties-policy",
key="my-properties-policy",
description="Archive 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.NewArchivePolicy(ctx, "my-properties-policy", &artifactory.ArchivePolicyArgs{
Key: pulumi.String("my-properties-policy"),
Description: pulumi.String("Archive 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.ArchivePolicySearchCriteriaArgs{
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.ArchivePolicy("my-properties-policy", new()
{
Key = "my-properties-policy",
Description = "Archive based on properties",
CronExpression = "0 0 2 ? * MON-SAT *",
DurationInMinutes = 60,
Enabled = true,
SkipTrashcan = false,
SearchCriteria = new Artifactory.Inputs.ArchivePolicySearchCriteriaArgs
{
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.ArchivePolicy;
import com.pulumi.artifactory.ArchivePolicyArgs;
import com.pulumi.artifactory.inputs.ArchivePolicySearchCriteriaArgs;
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 ArchivePolicy("my-properties-policy", ArchivePolicyArgs.builder()
.key("my-properties-policy")
.description("Archive based on properties")
.cronExpression("0 0 2 ? * MON-SAT *")
.durationInMinutes(60)
.enabled(true)
.skipTrashcan(false)
.searchCriteria(ArchivePolicySearchCriteriaArgs.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:ArchivePolicy
properties:
key: my-properties-policy
description: Archive 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, excludedProperties) 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 archivePolicyLastDownloadedBeforeInDays = config.getNumber("archivePolicyLastDownloadedBeforeInDays") || 30;
const archivePolicyDurationInMinutes = config.getNumber("archivePolicyDurationInMinutes") || 60;
const my_archive_policy = new artifactory.ArchivePolicy("my-archive-policy", {
key: "my-archive-policy",
description: "My archive policy with variables",
cronExpression: "0 0 2 ? * MON-SAT *",
durationInMinutes: archivePolicyDurationInMinutes,
enabled: true,
skipTrashcan: false,
searchCriteria: {
packageTypes: [
"docker",
"generic",
"helm",
"helmoci",
"nuget",
"terraform",
],
repos: ["**"],
includeAllProjects: false,
includedProjects: ["default"],
includedPackages: ["**"],
excludedPackages: ["com/jfrog/latest"],
lastDownloadedBeforeInDays: archivePolicyLastDownloadedBeforeInDays,
},
});
import pulumi
import pulumi_artifactory as artifactory
config = pulumi.Config()
archive_policy_last_downloaded_before_in_days = config.get_float("archivePolicyLastDownloadedBeforeInDays")
if archive_policy_last_downloaded_before_in_days is None:
archive_policy_last_downloaded_before_in_days = 30
archive_policy_duration_in_minutes = config.get_float("archivePolicyDurationInMinutes")
if archive_policy_duration_in_minutes is None:
archive_policy_duration_in_minutes = 60
my_archive_policy = artifactory.ArchivePolicy("my-archive-policy",
key="my-archive-policy",
description="My archive policy with variables",
cron_expression="0 0 2 ? * MON-SAT *",
duration_in_minutes=archive_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": archive_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, "")
archivePolicyLastDownloadedBeforeInDays := float64(30)
if param := cfg.GetFloat64("archivePolicyLastDownloadedBeforeInDays"); param != 0 {
archivePolicyLastDownloadedBeforeInDays = param
}
archivePolicyDurationInMinutes := float64(60)
if param := cfg.GetFloat64("archivePolicyDurationInMinutes"); param != 0 {
archivePolicyDurationInMinutes = param
}
_, err := artifactory.NewArchivePolicy(ctx, "my-archive-policy", &artifactory.ArchivePolicyArgs{
Key: pulumi.String("my-archive-policy"),
Description: pulumi.String("My archive policy with variables"),
CronExpression: pulumi.String("0 0 2 ? * MON-SAT *"),
DurationInMinutes: pulumi.Float64(archivePolicyDurationInMinutes),
Enabled: pulumi.Bool(true),
SkipTrashcan: pulumi.Bool(false),
SearchCriteria: &artifactory.ArchivePolicySearchCriteriaArgs{
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(archivePolicyLastDownloadedBeforeInDays),
},
})
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 archivePolicyLastDownloadedBeforeInDays = config.GetDouble("archivePolicyLastDownloadedBeforeInDays") ?? 30;
var archivePolicyDurationInMinutes = config.GetDouble("archivePolicyDurationInMinutes") ?? 60;
var my_archive_policy = new Artifactory.Index.ArchivePolicy("my-archive-policy", new()
{
Key = "my-archive-policy",
Description = "My archive policy with variables",
CronExpression = "0 0 2 ? * MON-SAT *",
DurationInMinutes = archivePolicyDurationInMinutes,
Enabled = true,
SkipTrashcan = false,
SearchCriteria = new Artifactory.Inputs.ArchivePolicySearchCriteriaArgs
{
PackageTypes = new[]
{
"docker",
"generic",
"helm",
"helmoci",
"nuget",
"terraform",
},
Repos = new[]
{
"**",
},
IncludeAllProjects = false,
IncludedProjects = new[]
{
"default",
},
IncludedPackages = new[]
{
"**",
},
ExcludedPackages = new[]
{
"com/jfrog/latest",
},
LastDownloadedBeforeInDays = archivePolicyLastDownloadedBeforeInDays,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.artifactory.ArchivePolicy;
import com.pulumi.artifactory.ArchivePolicyArgs;
import com.pulumi.artifactory.inputs.ArchivePolicySearchCriteriaArgs;
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 archivePolicyLastDownloadedBeforeInDays = config.get("archivePolicyLastDownloadedBeforeInDays").orElse(30);
final var archivePolicyDurationInMinutes = config.get("archivePolicyDurationInMinutes").orElse(60);
var my_archive_policy = new ArchivePolicy("my-archive-policy", ArchivePolicyArgs.builder()
.key("my-archive-policy")
.description("My archive policy with variables")
.cronExpression("0 0 2 ? * MON-SAT *")
.durationInMinutes(archivePolicyDurationInMinutes)
.enabled(true)
.skipTrashcan(false)
.searchCriteria(ArchivePolicySearchCriteriaArgs.builder()
.packageTypes(
"docker",
"generic",
"helm",
"helmoci",
"nuget",
"terraform")
.repos("**")
.includeAllProjects(false)
.includedProjects("default")
.includedPackages("**")
.excludedPackages("com/jfrog/latest")
.lastDownloadedBeforeInDays(archivePolicyLastDownloadedBeforeInDays)
.build())
.build());
}
}
configuration:
archivePolicyLastDownloadedBeforeInDays:
type: number
default: 30
archivePolicyDurationInMinutes:
type: number
default: 60
resources:
my-archive-policy:
type: artifactory:ArchivePolicy
properties:
key: my-archive-policy
description: My archive policy with variables
cronExpression: 0 0 2 ? * MON-SAT *
durationInMinutes: ${archivePolicyDurationInMinutes}
enabled: true
skipTrashcan: false
searchCriteria:
packageTypes:
- docker
- generic
- helm
- helmoci
- nuget
- terraform
repos:
- '**'
includeAllProjects: false
includedProjects:
- default
includedPackages:
- '**'
excludedPackages:
- com/jfrog/latest
lastDownloadedBeforeInDays: ${archivePolicyLastDownloadedBeforeInDays}
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
Time-based and properties-based combined
You may combine time-based fields (e.g. createdBeforeInDays, lastDownloadedBeforeInDays) with includedProperties in the same policy. keepLastNVersions cannot be used together with time-based or properties-based conditions—use version-based logic alone, or time and/or properties without keepLastNVersions.
import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";
const time_and_properties = new artifactory.ArchivePolicy("time-and-properties", {
key: "time-and-properties",
description: "Archive old packages that match a property",
cronExpression: "0 0 2 ? * MON-SAT *",
durationInMinutes: 60,
enabled: true,
skipTrashcan: false,
searchCriteria: {
packageTypes: ["docker"],
repos: ["**"],
includeAllProjects: true,
includedProjects: [],
includedPackages: ["**"],
excludedPackages: [],
lastDownloadedBeforeInDays: 90,
includedProperties: {
"retention.archive": ["true"],
},
},
});
import pulumi
import pulumi_artifactory as artifactory
time_and_properties = artifactory.ArchivePolicy("time-and-properties",
key="time-and-properties",
description="Archive old packages that match a property",
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": [],
"last_downloaded_before_in_days": 90,
"included_properties": {
"retention.archive": ["true"],
},
})
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.NewArchivePolicy(ctx, "time-and-properties", &artifactory.ArchivePolicyArgs{
Key: pulumi.String("time-and-properties"),
Description: pulumi.String("Archive old packages that match a property"),
CronExpression: pulumi.String("0 0 2 ? * MON-SAT *"),
DurationInMinutes: pulumi.Int(60),
Enabled: pulumi.Bool(true),
SkipTrashcan: pulumi.Bool(false),
SearchCriteria: &artifactory.ArchivePolicySearchCriteriaArgs{
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{},
LastDownloadedBeforeInDays: pulumi.Int(90),
IncludedProperties: pulumi.StringArrayMap{
"retention.archive": pulumi.StringArray{
pulumi.String("true"),
},
},
},
})
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 time_and_properties = new Artifactory.Index.ArchivePolicy("time-and-properties", new()
{
Key = "time-and-properties",
Description = "Archive old packages that match a property",
CronExpression = "0 0 2 ? * MON-SAT *",
DurationInMinutes = 60,
Enabled = true,
SkipTrashcan = false,
SearchCriteria = new Artifactory.Inputs.ArchivePolicySearchCriteriaArgs
{
PackageTypes = new[]
{
"docker",
},
Repos = new[]
{
"**",
},
IncludeAllProjects = true,
IncludedProjects = new() { },
IncludedPackages = new[]
{
"**",
},
ExcludedPackages = new() { },
LastDownloadedBeforeInDays = 90,
IncludedProperties =
{
{ "retention.archive", new[]
{
"true",
} },
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.artifactory.ArchivePolicy;
import com.pulumi.artifactory.ArchivePolicyArgs;
import com.pulumi.artifactory.inputs.ArchivePolicySearchCriteriaArgs;
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 time_and_properties = new ArchivePolicy("time-and-properties", ArchivePolicyArgs.builder()
.key("time-and-properties")
.description("Archive old packages that match a property")
.cronExpression("0 0 2 ? * MON-SAT *")
.durationInMinutes(60)
.enabled(true)
.skipTrashcan(false)
.searchCriteria(ArchivePolicySearchCriteriaArgs.builder()
.packageTypes("docker")
.repos("**")
.includeAllProjects(true)
.includedProjects()
.includedPackages("**")
.excludedPackages()
.lastDownloadedBeforeInDays(90)
.includedProperties(Map.of("retention.archive", "true"))
.build())
.build());
}
}
resources:
time-and-properties:
type: artifactory:ArchivePolicy
properties:
key: time-and-properties
description: Archive old packages that match a property
cronExpression: 0 0 2 ? * MON-SAT *
durationInMinutes: 60
enabled: true
skipTrashcan: false
searchCriteria:
packageTypes:
- docker
repos:
- '**'
includeAllProjects: true
includedProjects: []
includedPackages:
- '**'
excludedPackages: []
lastDownloadedBeforeInDays: 90
includedProperties:
retention.archive:
- 'true'
Validation Rules
The archive policy resource enforces the following validation rules:
At least one condition: A policy must specify at least one of: time-based (days or months), version-based (
keepLastNVersions), or properties-based (includedProperties).Version-based exclusivity:
keepLastNVersionscannot be combined with time-based conditions or withincludedProperties. Time-based and properties-based conditions may be combined.Zero Values: When set, time-based and version-based condition values must be greater than 0.
Days vs Months: Cannot use both days-based conditions (
createdBeforeInDays,lastDownloadedBeforeInDays) and months-based conditions (createdBeforeInMonths,lastDownloadedBeforeInMonths) together.Properties Validation: When using
includedPropertiesorexcludedProperties, each map 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.
Supported Package Types
The following package types are supported: alpine, ansible, cargo, chef, cocoapods, composer, conan, conda, debian, docker, gems, generic, go, gradle, helm, helmoci, huggingfaceml, maven, npm, nuget, oci, opkg, puppet, pypi, sbt, swift, terraform, terraformbackend, vagrant, yum.
Version Compatibility
- The
createdBeforeInDaysandlastDownloadedBeforeInDaysattributes are only supported in Artifactory 7.111.2 and later. For earlier versions, usecreatedBeforeInMonthsandlastDownloadedBeforeInMonths.
Create ArchivePolicy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ArchivePolicy(name: string, args: ArchivePolicyArgs, opts?: CustomResourceOptions);@overload
def ArchivePolicy(resource_name: str,
args: ArchivePolicyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ArchivePolicy(resource_name: str,
opts: Optional[ResourceOptions] = None,
key: Optional[str] = None,
search_criteria: Optional[ArchivePolicySearchCriteriaArgs] = 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 NewArchivePolicy(ctx *Context, name string, args ArchivePolicyArgs, opts ...ResourceOption) (*ArchivePolicy, error)public ArchivePolicy(string name, ArchivePolicyArgs args, CustomResourceOptions? opts = null)
public ArchivePolicy(String name, ArchivePolicyArgs args)
public ArchivePolicy(String name, ArchivePolicyArgs args, CustomResourceOptions options)
type: artifactory:ArchivePolicy
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 ArchivePolicyArgs
- 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 ArchivePolicyArgs
- 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 ArchivePolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ArchivePolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ArchivePolicyArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var archivePolicyResource = new Artifactory.ArchivePolicy("archivePolicyResource", new()
{
Key = "string",
SearchCriteria = new Artifactory.Inputs.ArchivePolicySearchCriteriaArgs
{
IncludedPackages = new[]
{
"string",
},
Repos = new[]
{
"string",
},
PackageTypes = new[]
{
"string",
},
IncludedProjects = new[]
{
"string",
},
ExcludedProperties =
{
{ "string", new[]
{
"string",
} },
},
IncludeAllProjects = false,
ExcludedRepos = new[]
{
"string",
},
CreatedBeforeInDays = 0,
IncludedProperties =
{
{ "string", new[]
{
"string",
} },
},
KeepLastNVersions = 0,
LastDownloadedBeforeInDays = 0,
ExcludedPackages = new[]
{
"string",
},
},
CronExpression = "string",
Description = "string",
DurationInMinutes = 0,
Enabled = false,
ProjectKey = "string",
SkipTrashcan = false,
});
example, err := artifactory.NewArchivePolicy(ctx, "archivePolicyResource", &artifactory.ArchivePolicyArgs{
Key: pulumi.String("string"),
SearchCriteria: &artifactory.ArchivePolicySearchCriteriaArgs{
IncludedPackages: pulumi.StringArray{
pulumi.String("string"),
},
Repos: pulumi.StringArray{
pulumi.String("string"),
},
PackageTypes: pulumi.StringArray{
pulumi.String("string"),
},
IncludedProjects: pulumi.StringArray{
pulumi.String("string"),
},
ExcludedProperties: pulumi.StringArrayMap{
"string": pulumi.StringArray{
pulumi.String("string"),
},
},
IncludeAllProjects: pulumi.Bool(false),
ExcludedRepos: pulumi.StringArray{
pulumi.String("string"),
},
CreatedBeforeInDays: pulumi.Int(0),
IncludedProperties: pulumi.StringArrayMap{
"string": pulumi.StringArray{
pulumi.String("string"),
},
},
KeepLastNVersions: pulumi.Int(0),
LastDownloadedBeforeInDays: pulumi.Int(0),
ExcludedPackages: pulumi.StringArray{
pulumi.String("string"),
},
},
CronExpression: pulumi.String("string"),
Description: pulumi.String("string"),
DurationInMinutes: pulumi.Int(0),
Enabled: pulumi.Bool(false),
ProjectKey: pulumi.String("string"),
SkipTrashcan: pulumi.Bool(false),
})
var archivePolicyResource = new ArchivePolicy("archivePolicyResource", ArchivePolicyArgs.builder()
.key("string")
.searchCriteria(ArchivePolicySearchCriteriaArgs.builder()
.includedPackages("string")
.repos("string")
.packageTypes("string")
.includedProjects("string")
.excludedProperties(Map.of("string", Arrays.asList("string")))
.includeAllProjects(false)
.excludedRepos("string")
.createdBeforeInDays(0)
.includedProperties(Map.of("string", Arrays.asList("string")))
.keepLastNVersions(0)
.lastDownloadedBeforeInDays(0)
.excludedPackages("string")
.build())
.cronExpression("string")
.description("string")
.durationInMinutes(0)
.enabled(false)
.projectKey("string")
.skipTrashcan(false)
.build());
archive_policy_resource = artifactory.ArchivePolicy("archivePolicyResource",
key="string",
search_criteria={
"included_packages": ["string"],
"repos": ["string"],
"package_types": ["string"],
"included_projects": ["string"],
"excluded_properties": {
"string": ["string"],
},
"include_all_projects": False,
"excluded_repos": ["string"],
"created_before_in_days": 0,
"included_properties": {
"string": ["string"],
},
"keep_last_n_versions": 0,
"last_downloaded_before_in_days": 0,
"excluded_packages": ["string"],
},
cron_expression="string",
description="string",
duration_in_minutes=0,
enabled=False,
project_key="string",
skip_trashcan=False)
const archivePolicyResource = new artifactory.ArchivePolicy("archivePolicyResource", {
key: "string",
searchCriteria: {
includedPackages: ["string"],
repos: ["string"],
packageTypes: ["string"],
includedProjects: ["string"],
excludedProperties: {
string: ["string"],
},
includeAllProjects: false,
excludedRepos: ["string"],
createdBeforeInDays: 0,
includedProperties: {
string: ["string"],
},
keepLastNVersions: 0,
lastDownloadedBeforeInDays: 0,
excludedPackages: ["string"],
},
cronExpression: "string",
description: "string",
durationInMinutes: 0,
enabled: false,
projectKey: "string",
skipTrashcan: false,
});
type: artifactory:ArchivePolicy
properties:
cronExpression: string
description: string
durationInMinutes: 0
enabled: false
key: string
projectKey: string
searchCriteria:
createdBeforeInDays: 0
excludedPackages:
- string
excludedProperties:
string:
- string
excludedRepos:
- string
includeAllProjects: false
includedPackages:
- string
includedProjects:
- string
includedProperties:
string:
- string
keepLastNVersions: 0
lastDownloadedBeforeInDays: 0
packageTypes:
- string
repos:
- string
skipTrashcan: false
ArchivePolicy 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 ArchivePolicy resource accepts the following input properties:
- Key string
- An ID that is used to identify the archive policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
- Search
Criteria ArchivePolicy Search Criteria - Cron
Expression string - The cron expression determines when the policy is run. This parameter is not mandatory, 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 archive V2 schedule, it can cause the policy to stop before completion.
- Enabled bool
- 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 - Project
Key string - This attribute is used only for project-level archive V2 policies, it is not used for global-level policies.
- Skip
Trashcan bool - A
truevalue means that when this policy is executed, packages will be permanently deleted.falsemeans that when the policy is executed packages will be deleted to the Trash Can. Defaults tofalse.
- Key string
- An ID that is used to identify the archive policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
- Search
Criteria ArchivePolicy Search Criteria Args - Cron
Expression string - The cron expression determines when the policy is run. This parameter is not mandatory, 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 archive V2 schedule, it can cause the policy to stop before completion.
- Enabled bool
- 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 - Project
Key string - This attribute is used only for project-level archive V2 policies, it is not used for global-level policies.
- Skip
Trashcan bool - A
truevalue means that when this policy is executed, packages will be permanently deleted.falsemeans that when the policy is executed packages will be deleted to the Trash Can. Defaults tofalse.
- key String
- An ID that is used to identify the archive policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
- search
Criteria ArchivePolicy Search Criteria - cron
Expression String - The cron expression determines when the policy is run. This parameter is not mandatory, 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 archive V2 schedule, it 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 - project
Key String - This attribute is used only for project-level archive V2 policies, it is not used for global-level policies.
- skip
Trashcan Boolean - A
truevalue means that when this policy is executed, packages will be permanently deleted.falsemeans that when the policy is executed packages will be deleted to the Trash Can. Defaults tofalse.
- key string
- An ID that is used to identify the archive policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
- search
Criteria ArchivePolicy Search Criteria - cron
Expression string - The cron expression determines when the policy is run. This parameter is not mandatory, 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 archive V2 schedule, it 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 - project
Key string - This attribute is used only for project-level archive V2 policies, it is not used for global-level policies.
- skip
Trashcan boolean - A
truevalue means that when this policy is executed, packages will be permanently deleted.falsemeans that when the policy is executed packages will be deleted to the Trash Can. Defaults tofalse.
- key str
- An ID that is used to identify the archive policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
- search_
criteria ArchivePolicy Search Criteria Args - cron_
expression str - The cron expression determines when the policy is run. This parameter is not mandatory, 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 archive V2 schedule, it can cause the policy to stop before completion.
- enabled bool
- 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 - project_
key str - This attribute is used only for project-level archive V2 policies, it is not used for global-level policies.
- skip_
trashcan bool - A
truevalue means that when this policy is executed, packages will be permanently deleted.falsemeans that when the policy is executed packages will be deleted to the Trash Can. Defaults tofalse.
- key String
- An ID that is used to identify the archive 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 determines when the policy is run. This parameter is not mandatory, 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 archive V2 schedule, it 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 - project
Key String - This attribute is used only for project-level archive V2 policies, it is not used for global-level policies.
- skip
Trashcan Boolean - A
truevalue means that when this policy is executed, packages will be permanently deleted.falsemeans that when the policy is executed packages will be deleted to the Trash Can. Defaults tofalse.
Outputs
All input properties are implicitly available as output properties. Additionally, the ArchivePolicy 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 ArchivePolicy Resource
Get an existing ArchivePolicy 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?: ArchivePolicyState, opts?: CustomResourceOptions): ArchivePolicy@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[ArchivePolicySearchCriteriaArgs] = None,
skip_trashcan: Optional[bool] = None) -> ArchivePolicyfunc GetArchivePolicy(ctx *Context, name string, id IDInput, state *ArchivePolicyState, opts ...ResourceOption) (*ArchivePolicy, error)public static ArchivePolicy Get(string name, Input<string> id, ArchivePolicyState? state, CustomResourceOptions? opts = null)public static ArchivePolicy get(String name, Output<String> id, ArchivePolicyState state, CustomResourceOptions options)resources: _: type: artifactory:ArchivePolicy 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 determines when the policy is run. This parameter is not mandatory, 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 archive V2 schedule, it can cause the policy to stop before completion.
- Enabled bool
- 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 - Key string
- An ID that is used to identify the archive 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 archive V2 policies, it is not used for global-level policies.
- Search
Criteria ArchivePolicy Search Criteria - Skip
Trashcan bool - A
truevalue means that when this policy is executed, packages will be permanently deleted.falsemeans that when the policy is executed packages will be deleted to the Trash Can. Defaults tofalse.
- Cron
Expression string - The cron expression determines when the policy is run. This parameter is not mandatory, 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 archive V2 schedule, it can cause the policy to stop before completion.
- Enabled bool
- 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 - Key string
- An ID that is used to identify the archive 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 archive V2 policies, it is not used for global-level policies.
- Search
Criteria ArchivePolicy Search Criteria Args - Skip
Trashcan bool - A
truevalue means that when this policy is executed, packages will be permanently deleted.falsemeans that when the policy is executed packages will be deleted to the Trash Can. Defaults tofalse.
- cron
Expression String - The cron expression determines when the policy is run. This parameter is not mandatory, 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 archive V2 schedule, it 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 - key String
- An ID that is used to identify the archive 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 archive V2 policies, it is not used for global-level policies.
- search
Criteria ArchivePolicy Search Criteria - skip
Trashcan Boolean - A
truevalue means that when this policy is executed, packages will be permanently deleted.falsemeans that when the policy is executed packages will be deleted to the Trash Can. Defaults tofalse.
- cron
Expression string - The cron expression determines when the policy is run. This parameter is not mandatory, 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 archive V2 schedule, it 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 - key string
- An ID that is used to identify the archive 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 archive V2 policies, it is not used for global-level policies.
- search
Criteria ArchivePolicy Search Criteria - skip
Trashcan boolean - A
truevalue means that when this policy is executed, packages will be permanently deleted.falsemeans that when the policy is executed packages will be deleted to the Trash Can. Defaults tofalse.
- cron_
expression str - The cron expression determines when the policy is run. This parameter is not mandatory, 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 archive V2 schedule, it can cause the policy to stop before completion.
- enabled bool
- 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 - key str
- An ID that is used to identify the archive 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 archive V2 policies, it is not used for global-level policies.
- search_
criteria ArchivePolicy Search Criteria Args - skip_
trashcan bool - A
truevalue means that when this policy is executed, packages will be permanently deleted.falsemeans that when the policy is executed packages will be deleted to the Trash Can. Defaults tofalse.
- cron
Expression String - The cron expression determines when the policy is run. This parameter is not mandatory, 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 archive V2 schedule, it 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 - key String
- An ID that is used to identify the archive 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 archive V2 policies, it is not used for global-level policies.
- search
Criteria Property Map - skip
Trashcan Boolean - A
truevalue means that when this policy is executed, packages will be permanently deleted.falsemeans that when the policy is executed packages will be deleted to the Trash Can. Defaults tofalse.
Supporting Types
ArchivePolicySearchCriteria, ArchivePolicySearchCriteriaArgs
- Included
Packages List<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:includedPackages = ["**"] - Included
Projects List<string> - List of projects on which you want this policy to run. To include repositories that are not assigned to any project, enter the project key
default. Can be empty whenincludeAllProjectsis set totrue. ~>This setting is relevant only on the global level, for Platform Admins. - Package
Types List<string> - The package types that are archived by the policy. Support: alpine, ansible, cargo, chef, cocoapods, composer, conan, conda, debian, docker, gems, generic, go, gradle, helm, helmoci, huggingfaceml, maven, npm, nuget, oci, opkg, puppet, pypi, sbt, swift, terraform, terraformbackend, vagrant, yum.
- Repos List<string>
- Specify one or more patterns for the repository name(s) on which you want the archive policy to run. You can also specify explicit repository names. Specifying at least one pattern or explicit name is required. Only packages in repositories that match the pattern or explicit name will be archived. For including all repos use
**. Example:repos = ["**"] - Created
Before intIn Days The archive policy will archive packages based on how long ago they were created. For example, if this parameter is 2 then packages created more than 2 days ago will be archived as part of the policy.
Requires Artifactory 7.111.2 or later. ~>JFrog recommends using the
createdBeforeInDayscondition to ensure that packages currently in use are not archived.- Created
Before intIn Months - The archive policy will archive 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 archived as part of the policy.
- Excluded
Packages List<string> - Specify explicit package names that you want excluded from the policy. Only Name 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 archival.
- Excluded
Repos List<string> - Specify patterns for repository names or explicit repository names that you want excluded from the archive policy.
- Include
All boolProjects Set this value to
trueif you want the policy to run on all Artifactory projects. The default value isfalse.~>This attribute 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 archived.
- Keep
Last intNVersions Set a value for the number of latest versions to keep. The archive policy will remove all versions before the number you select here. The latest version is always excluded.
~>Versions are determined by creation date.
~>Not all package types support this condition. If you include a package type in your policy that is not compatible with this condition, a validation error (400) is returned. For information on which package types support this condition, see here.
- Last
Downloaded intBefore In Days The archive policy will archive 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 archived as part of the policy.
Requires Artifactory 7.111.2 or later. ~>JFrog recommends using the
lastDownloadedBeforeInDayscondition to ensure that packages currently in use are not archived.- Last
Downloaded intBefore In Months - The archive policy will archive 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 archived as part of the policy.
- Included
Packages []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:includedPackages = ["**"] - Included
Projects []string - List of projects on which you want this policy to run. To include repositories that are not assigned to any project, enter the project key
default. Can be empty whenincludeAllProjectsis set totrue. ~>This setting is relevant only on the global level, for Platform Admins. - Package
Types []string - The package types that are archived by the policy. Support: alpine, ansible, cargo, chef, cocoapods, composer, conan, conda, debian, docker, gems, generic, go, gradle, helm, helmoci, huggingfaceml, maven, npm, nuget, oci, opkg, puppet, pypi, sbt, swift, terraform, terraformbackend, vagrant, yum.
- Repos []string
- Specify one or more patterns for the repository name(s) on which you want the archive policy to run. You can also specify explicit repository names. Specifying at least one pattern or explicit name is required. Only packages in repositories that match the pattern or explicit name will be archived. For including all repos use
**. Example:repos = ["**"] - Created
Before intIn Days The archive policy will archive packages based on how long ago they were created. For example, if this parameter is 2 then packages created more than 2 days ago will be archived as part of the policy.
Requires Artifactory 7.111.2 or later. ~>JFrog recommends using the
createdBeforeInDayscondition to ensure that packages currently in use are not archived.- Created
Before intIn Months - The archive policy will archive 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 archived as part of the policy.
- Excluded
Packages []string - Specify explicit package names that you want excluded from the policy. Only Name 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 archival.
- Excluded
Repos []string - Specify patterns for repository names or explicit repository names that you want excluded from the archive policy.
- Include
All boolProjects Set this value to
trueif you want the policy to run on all Artifactory projects. The default value isfalse.~>This attribute 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 archived.
- Keep
Last intNVersions Set a value for the number of latest versions to keep. The archive policy will remove all versions before the number you select here. The latest version is always excluded.
~>Versions are determined by creation date.
~>Not all package types support this condition. If you include a package type in your policy that is not compatible with this condition, a validation error (400) is returned. For information on which package types support this condition, see here.
- Last
Downloaded intBefore In Days The archive policy will archive 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 archived as part of the policy.
Requires Artifactory 7.111.2 or later. ~>JFrog recommends using the
lastDownloadedBeforeInDayscondition to ensure that packages currently in use are not archived.- Last
Downloaded intBefore In Months - The archive policy will archive 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 archived as part of the policy.
- included
Packages List<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:includedPackages = ["**"] - included
Projects List<String> - List of projects on which you want this policy to run. To include repositories that are not assigned to any project, enter the project key
default. Can be empty whenincludeAllProjectsis set totrue. ~>This setting is relevant only on the global level, for Platform Admins. - package
Types List<String> - The package types that are archived by the policy. Support: alpine, ansible, cargo, chef, cocoapods, composer, conan, conda, debian, docker, gems, generic, go, gradle, helm, helmoci, huggingfaceml, maven, npm, nuget, oci, opkg, puppet, pypi, sbt, swift, terraform, terraformbackend, vagrant, yum.
- repos List<String>
- Specify one or more patterns for the repository name(s) on which you want the archive policy to run. You can also specify explicit repository names. Specifying at least one pattern or explicit name is required. Only packages in repositories that match the pattern or explicit name will be archived. For including all repos use
**. Example:repos = ["**"] - created
Before IntegerIn Days The archive policy will archive packages based on how long ago they were created. For example, if this parameter is 2 then packages created more than 2 days ago will be archived as part of the policy.
Requires Artifactory 7.111.2 or later. ~>JFrog recommends using the
createdBeforeInDayscondition to ensure that packages currently in use are not archived.- created
Before IntegerIn Months - The archive policy will archive 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 archived as part of the policy.
- excluded
Packages List<String> - Specify explicit package names that you want excluded from the policy. Only Name 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 archival.
- excluded
Repos List<String> - Specify patterns for repository names or explicit repository names that you want excluded from the archive policy.
- include
All BooleanProjects Set this value to
trueif you want the policy to run on all Artifactory projects. The default value isfalse.~>This attribute 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 archived.
- keep
Last IntegerNVersions Set a value for the number of latest versions to keep. The archive policy will remove all versions before the number you select here. The latest version is always excluded.
~>Versions are determined by creation date.
~>Not all package types support this condition. If you include a package type in your policy that is not compatible with this condition, a validation error (400) is returned. For information on which package types support this condition, see here.
- last
Downloaded IntegerBefore In Days The archive policy will archive 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 archived as part of the policy.
Requires Artifactory 7.111.2 or later. ~>JFrog recommends using the
lastDownloadedBeforeInDayscondition to ensure that packages currently in use are not archived.- last
Downloaded IntegerBefore In Months - The archive policy will archive 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 archived as part of the policy.
- included
Packages 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:includedPackages = ["**"] - included
Projects string[] - List of projects on which you want this policy to run. To include repositories that are not assigned to any project, enter the project key
default. Can be empty whenincludeAllProjectsis set totrue. ~>This setting is relevant only on the global level, for Platform Admins. - package
Types string[] - The package types that are archived by the policy. Support: alpine, ansible, cargo, chef, cocoapods, composer, conan, conda, debian, docker, gems, generic, go, gradle, helm, helmoci, huggingfaceml, maven, npm, nuget, oci, opkg, puppet, pypi, sbt, swift, terraform, terraformbackend, vagrant, yum.
- repos string[]
- Specify one or more patterns for the repository name(s) on which you want the archive policy to run. You can also specify explicit repository names. Specifying at least one pattern or explicit name is required. Only packages in repositories that match the pattern or explicit name will be archived. For including all repos use
**. Example:repos = ["**"] - created
Before numberIn Days The archive policy will archive packages based on how long ago they were created. For example, if this parameter is 2 then packages created more than 2 days ago will be archived as part of the policy.
Requires Artifactory 7.111.2 or later. ~>JFrog recommends using the
createdBeforeInDayscondition to ensure that packages currently in use are not archived.- created
Before numberIn Months - The archive policy will archive 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 archived as part of the policy.
- excluded
Packages string[] - Specify explicit package names that you want excluded from the policy. Only Name 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 archival.
- excluded
Repos string[] - Specify patterns for repository names or explicit repository names that you want excluded from the archive policy.
- include
All booleanProjects Set this value to
trueif you want the policy to run on all Artifactory projects. The default value isfalse.~>This attribute 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 archived.
- keep
Last numberNVersions Set a value for the number of latest versions to keep. The archive policy will remove all versions before the number you select here. The latest version is always excluded.
~>Versions are determined by creation date.
~>Not all package types support this condition. If you include a package type in your policy that is not compatible with this condition, a validation error (400) is returned. For information on which package types support this condition, see here.
- last
Downloaded numberBefore In Days The archive policy will archive 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 archived as part of the policy.
Requires Artifactory 7.111.2 or later. ~>JFrog recommends using the
lastDownloadedBeforeInDayscondition to ensure that packages currently in use are not archived.- last
Downloaded numberBefore In Months - The archive policy will archive 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 archived as part of the policy.
- included_
packages Sequence[str] - 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:includedPackages = ["**"] - included_
projects Sequence[str] - List of projects on which you want this policy to run. To include repositories that are not assigned to any project, enter the project key
default. Can be empty whenincludeAllProjectsis set totrue. ~>This setting is relevant only on the global level, for Platform Admins. - package_
types Sequence[str] - The package types that are archived by the policy. Support: alpine, ansible, cargo, chef, cocoapods, composer, conan, conda, debian, docker, gems, generic, go, gradle, helm, helmoci, huggingfaceml, maven, npm, nuget, oci, opkg, puppet, pypi, sbt, swift, terraform, terraformbackend, vagrant, yum.
- repos Sequence[str]
- Specify one or more patterns for the repository name(s) on which you want the archive policy to run. You can also specify explicit repository names. Specifying at least one pattern or explicit name is required. Only packages in repositories that match the pattern or explicit name will be archived. For including all repos use
**. Example:repos = ["**"] - created_
before_ intin_ days The archive policy will archive packages based on how long ago they were created. For example, if this parameter is 2 then packages created more than 2 days ago will be archived as part of the policy.
Requires Artifactory 7.111.2 or later. ~>JFrog recommends using the
createdBeforeInDayscondition to ensure that packages currently in use are not archived.- created_
before_ intin_ months - The archive policy will archive 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 archived as part of the policy.
- excluded_
packages Sequence[str] - Specify explicit package names that you want excluded from the policy. Only Name 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 archival.
- excluded_
repos Sequence[str] - Specify patterns for repository names or explicit repository names that you want excluded from the archive policy.
- include_
all_ boolprojects Set this value to
trueif you want the policy to run on all Artifactory projects. The default value isfalse.~>This attribute 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 archived.
- keep_
last_ intn_ versions Set a value for the number of latest versions to keep. The archive policy will remove all versions before the number you select here. The latest version is always excluded.
~>Versions are determined by creation date.
~>Not all package types support this condition. If you include a package type in your policy that is not compatible with this condition, a validation error (400) is returned. For information on which package types support this condition, see here.
- last_
downloaded_ intbefore_ in_ days The archive policy will archive 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 archived as part of the policy.
Requires Artifactory 7.111.2 or later. ~>JFrog recommends using the
lastDownloadedBeforeInDayscondition to ensure that packages currently in use are not archived.- last_
downloaded_ intbefore_ in_ months - The archive policy will archive 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 archived as part of the policy.
- included
Packages List<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:includedPackages = ["**"] - included
Projects List<String> - List of projects on which you want this policy to run. To include repositories that are not assigned to any project, enter the project key
default. Can be empty whenincludeAllProjectsis set totrue. ~>This setting is relevant only on the global level, for Platform Admins. - package
Types List<String> - The package types that are archived by the policy. Support: alpine, ansible, cargo, chef, cocoapods, composer, conan, conda, debian, docker, gems, generic, go, gradle, helm, helmoci, huggingfaceml, maven, npm, nuget, oci, opkg, puppet, pypi, sbt, swift, terraform, terraformbackend, vagrant, yum.
- repos List<String>
- Specify one or more patterns for the repository name(s) on which you want the archive policy to run. You can also specify explicit repository names. Specifying at least one pattern or explicit name is required. Only packages in repositories that match the pattern or explicit name will be archived. For including all repos use
**. Example:repos = ["**"] - created
Before NumberIn Days The archive policy will archive packages based on how long ago they were created. For example, if this parameter is 2 then packages created more than 2 days ago will be archived as part of the policy.
Requires Artifactory 7.111.2 or later. ~>JFrog recommends using the
createdBeforeInDayscondition to ensure that packages currently in use are not archived.- created
Before NumberIn Months - The archive policy will archive 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 archived as part of the policy.
- excluded
Packages List<String> - Specify explicit package names that you want excluded from the policy. Only Name 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 archival.
- excluded
Repos List<String> - Specify patterns for repository names or explicit repository names that you want excluded from the archive policy.
- include
All BooleanProjects Set this value to
trueif you want the policy to run on all Artifactory projects. The default value isfalse.~>This attribute 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 archived.
- keep
Last NumberNVersions Set a value for the number of latest versions to keep. The archive policy will remove all versions before the number you select here. The latest version is always excluded.
~>Versions are determined by creation date.
~>Not all package types support this condition. If you include a package type in your policy that is not compatible with this condition, a validation error (400) is returned. For information on which package types support this condition, see here.
- last
Downloaded NumberBefore In Days The archive policy will archive 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 archived as part of the policy.
Requires Artifactory 7.111.2 or later. ~>JFrog recommends using the
lastDownloadedBeforeInDayscondition to ensure that packages currently in use are not archived.- last
Downloaded NumberBefore In Months - The archive policy will archive 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 archived as part of the policy.
Import
$ pulumi import artifactory:index/archivePolicy:ArchivePolicy my-archive-policy my-policy
$ pulumi import artifactory:index/archivePolicy:ArchivePolicy my-archive-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 Tuesday, May 5, 2026 by Pulumi
