1. Packages
  2. Packages
  3. Artifactory Provider
  4. API Docs
  5. ArchivePolicy
Viewing docs for artifactory v8.10.5
published on Tuesday, May 5, 2026 by Pulumi
artifactory logo
Viewing docs for artifactory v8.10.5
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
    
    Example coming soon!
    

    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
    
    Example coming soon!
    

    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
    
    Example coming soon!
    

    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}
    
    Example coming soon!
    

    Important Notes:

    • Variables with default values allow terraform validate to pass without requiring variable values
    • Variables without default values will require values to be provided during pulumi preview or pulumi 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'
    
    Example coming soon!
    

    Validation Rules

    The archive policy resource enforces the following validation rules:

    1. At least one condition: A policy must specify at least one of: time-based (days or months), version-based (keepLastNVersions), or properties-based (includedProperties).

    2. Version-based exclusivity: keepLastNVersions cannot be combined with time-based conditions or with includedProperties. Time-based and properties-based conditions may be combined.

    3. Zero Values: When set, time-based and version-based condition values must be greater than 0.

    4. Days vs Months: Cannot use both days-based conditions (createdBeforeInDays, lastDownloadedBeforeInDays) and months-based conditions (createdBeforeInMonths, lastDownloadedBeforeInMonths) together.

    5. Properties Validation: When using includedProperties or excludedProperties, each map must have exactly one key with exactly one string value.

    6. Project Configuration: When includeAllProjects is set to true, the includedProjects field can be empty array. When includeAllProjects is false, includedProjects must 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 createdBeforeInDays and lastDownloadedBeforeInDays attributes are only supported in Artifactory 7.111.2 and later. For earlier versions, use createdBeforeInMonths and lastDownloadedBeforeInMonths.

    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.
    
    
    resource "artifactory_archivepolicy" "name" {
        # resource properties
    }

    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),
    })
    
    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
    }
    
    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.
    SearchCriteria ArchivePolicySearchCriteria
    CronExpression 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
    DurationInMinutes int
    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
    ProjectKey string
    This attribute is used only for project-level archive V2 policies, it is not used for global-level policies.
    SkipTrashcan 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 archive policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
    SearchCriteria ArchivePolicySearchCriteriaArgs
    CronExpression 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
    DurationInMinutes int
    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
    ProjectKey string
    This attribute is used only for project-level archive V2 policies, it is not used for global-level policies.
    SkipTrashcan 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 archive policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
    search_criteria object
    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_minutes number
    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 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 archive policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
    searchCriteria ArchivePolicySearchCriteria
    cronExpression 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
    durationInMinutes Integer
    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
    projectKey String
    This attribute is used only for project-level archive V2 policies, it is not used for global-level policies.
    skipTrashcan 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 archive policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
    searchCriteria ArchivePolicySearchCriteria
    cronExpression 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
    durationInMinutes number
    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
    projectKey string
    This attribute is used only for project-level archive V2 policies, it is not used for global-level policies.
    skipTrashcan 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 archive policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
    search_criteria ArchivePolicySearchCriteriaArgs
    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_minutes int
    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 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 archive policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen.
    searchCriteria Property Map
    cronExpression 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
    durationInMinutes Number
    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
    projectKey String
    This attribute is used only for project-level archive V2 policies, it is not used for global-level policies.
    skipTrashcan 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 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 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) -> ArchivePolicy
    func 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}
    import {
      to = artifactory_archivepolicy.example
      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.
    The following state arguments are supported:
    CronExpression 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
    DurationInMinutes int
    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.
    ProjectKey string
    This attribute is used only for project-level archive V2 policies, it is not used for global-level policies.
    SearchCriteria ArchivePolicySearchCriteria
    SkipTrashcan 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.
    CronExpression 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
    DurationInMinutes int
    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.
    ProjectKey string
    This attribute is used only for project-level archive V2 policies, it is not used for global-level policies.
    SearchCriteria ArchivePolicySearchCriteriaArgs
    SkipTrashcan 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 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_minutes number
    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 object
    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.
    cronExpression 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
    durationInMinutes Integer
    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.
    projectKey String
    This attribute is used only for project-level archive V2 policies, it is not used for global-level policies.
    searchCriteria ArchivePolicySearchCriteria
    skipTrashcan 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.
    cronExpression 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
    durationInMinutes number
    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.
    projectKey string
    This attribute is used only for project-level archive V2 policies, it is not used for global-level policies.
    searchCriteria ArchivePolicySearchCriteria
    skipTrashcan 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 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_minutes int
    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 ArchivePolicySearchCriteriaArgs
    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.
    cronExpression 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
    durationInMinutes Number
    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.
    projectKey String
    This attribute is used only for project-level archive V2 policies, it is not used for global-level policies.
    searchCriteria Property Map
    skipTrashcan 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

    ArchivePolicySearchCriteria, ArchivePolicySearchCriteriaArgs

    IncludedPackages 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 = ["**"]
    IncludedProjects 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 when includeAllProjects is set to true. ~>This setting is relevant only on the global level, for Platform Admins.
    PackageTypes 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 = ["**"]
    CreatedBeforeInDays int

    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 createdBeforeInDays condition to ensure that packages currently in use are not archived.

    CreatedBeforeInMonths int
    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.

    Deprecated: Use createdBeforeInDays instead of createdBeforeInMonths. Renamed to createdBeforeInDays starting in version 7.111.2.

    ExcludedPackages List<string>
    Specify explicit package names that you want excluded from the policy. Only Name explicit names (and not patterns) are accepted.
    ExcludedProperties 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.
    ExcludedRepos List<string>
    Specify patterns for repository names or explicit repository names that you want excluded from the archive policy.
    IncludeAllProjects bool

    Set this value to true if you want the policy to run on all Artifactory projects. The default value is false.

    ~>This attribute is relevant only on the global level, for Platform Admins.

    IncludedProperties Dictionary<string, ImmutableArray<string>>
    A key-value pair applied to the lead artifact of a package. Packages with this property will be archived.
    KeepLastNVersions int

    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.

    LastDownloadedBeforeInDays int

    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 lastDownloadedBeforeInDays condition to ensure that packages currently in use are not archived.

    LastDownloadedBeforeInMonths int
    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.

    Deprecated: Use lastDownloadedBeforeInDays instead of lastDownloadedBeforeInMonths. Renamed to lastDownloadedBeforeInDays starting in version 7.111.2.

    IncludedPackages []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 = ["**"]
    IncludedProjects []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 when includeAllProjects is set to true. ~>This setting is relevant only on the global level, for Platform Admins.
    PackageTypes []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 = ["**"]
    CreatedBeforeInDays int

    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 createdBeforeInDays condition to ensure that packages currently in use are not archived.

    CreatedBeforeInMonths int
    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.

    Deprecated: Use createdBeforeInDays instead of createdBeforeInMonths. Renamed to createdBeforeInDays starting in version 7.111.2.

    ExcludedPackages []string
    Specify explicit package names that you want excluded from the policy. Only Name explicit names (and not patterns) are accepted.
    ExcludedProperties map[string][]string
    A key-value pair applied to the lead artifact of a package. Packages with this property will be excluded from archival.
    ExcludedRepos []string
    Specify patterns for repository names or explicit repository names that you want excluded from the archive policy.
    IncludeAllProjects bool

    Set this value to true if you want the policy to run on all Artifactory projects. The default value is false.

    ~>This attribute is relevant only on the global level, for Platform Admins.

    IncludedProperties map[string][]string
    A key-value pair applied to the lead artifact of a package. Packages with this property will be archived.
    KeepLastNVersions int

    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.

    LastDownloadedBeforeInDays int

    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 lastDownloadedBeforeInDays condition to ensure that packages currently in use are not archived.

    LastDownloadedBeforeInMonths int
    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.

    Deprecated: Use lastDownloadedBeforeInDays instead of lastDownloadedBeforeInMonths. Renamed to lastDownloadedBeforeInDays starting in version 7.111.2.

    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 when includeAllProjects is set to true. ~>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_in_days number

    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 createdBeforeInDays condition to ensure that packages currently in use are not archived.

    created_before_in_months number
    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.

    Deprecated: Use createdBeforeInDays instead of createdBeforeInMonths. Renamed to createdBeforeInDays starting in version 7.111.2.

    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_projects bool

    Set this value to true if you want the policy to run on all Artifactory projects. The default value is false.

    ~>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_n_versions number

    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_before_in_days number

    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 lastDownloadedBeforeInDays condition to ensure that packages currently in use are not archived.

    last_downloaded_before_in_months number
    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.

    Deprecated: Use lastDownloadedBeforeInDays instead of lastDownloadedBeforeInMonths. Renamed to lastDownloadedBeforeInDays starting in version 7.111.2.

    includedPackages 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 = ["**"]
    includedProjects 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 when includeAllProjects is set to true. ~>This setting is relevant only on the global level, for Platform Admins.
    packageTypes 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 = ["**"]
    createdBeforeInDays Integer

    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 createdBeforeInDays condition to ensure that packages currently in use are not archived.

    createdBeforeInMonths Integer
    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.

    Deprecated: Use createdBeforeInDays instead of createdBeforeInMonths. Renamed to createdBeforeInDays starting in version 7.111.2.

    excludedPackages List<String>
    Specify explicit package names that you want excluded from the policy. Only Name explicit names (and not patterns) are accepted.
    excludedProperties 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.
    excludedRepos List<String>
    Specify patterns for repository names or explicit repository names that you want excluded from the archive policy.
    includeAllProjects Boolean

    Set this value to true if you want the policy to run on all Artifactory projects. The default value is false.

    ~>This attribute is relevant only on the global level, for Platform Admins.

    includedProperties Map<String,List<String>>
    A key-value pair applied to the lead artifact of a package. Packages with this property will be archived.
    keepLastNVersions Integer

    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.

    lastDownloadedBeforeInDays Integer

    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 lastDownloadedBeforeInDays condition to ensure that packages currently in use are not archived.

    lastDownloadedBeforeInMonths Integer
    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.

    Deprecated: Use lastDownloadedBeforeInDays instead of lastDownloadedBeforeInMonths. Renamed to lastDownloadedBeforeInDays starting in version 7.111.2.

    includedPackages 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 = ["**"]
    includedProjects 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 when includeAllProjects is set to true. ~>This setting is relevant only on the global level, for Platform Admins.
    packageTypes 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 = ["**"]
    createdBeforeInDays number

    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 createdBeforeInDays condition to ensure that packages currently in use are not archived.

    createdBeforeInMonths number
    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.

    Deprecated: Use createdBeforeInDays instead of createdBeforeInMonths. Renamed to createdBeforeInDays starting in version 7.111.2.

    excludedPackages string[]
    Specify explicit package names that you want excluded from the policy. Only Name explicit names (and not patterns) are accepted.
    excludedProperties {[key: string]: string[]}
    A key-value pair applied to the lead artifact of a package. Packages with this property will be excluded from archival.
    excludedRepos string[]
    Specify patterns for repository names or explicit repository names that you want excluded from the archive policy.
    includeAllProjects boolean

    Set this value to true if you want the policy to run on all Artifactory projects. The default value is false.

    ~>This attribute is relevant only on the global level, for Platform Admins.

    includedProperties {[key: string]: string[]}
    A key-value pair applied to the lead artifact of a package. Packages with this property will be archived.
    keepLastNVersions number

    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.

    lastDownloadedBeforeInDays number

    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 lastDownloadedBeforeInDays condition to ensure that packages currently in use are not archived.

    lastDownloadedBeforeInMonths number
    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.

    Deprecated: Use lastDownloadedBeforeInDays instead of lastDownloadedBeforeInMonths. Renamed to lastDownloadedBeforeInDays starting in version 7.111.2.

    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 when includeAllProjects is set to true. ~>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_in_days int

    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 createdBeforeInDays condition to ensure that packages currently in use are not archived.

    created_before_in_months int
    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.

    Deprecated: Use createdBeforeInDays instead of createdBeforeInMonths. Renamed to createdBeforeInDays starting in version 7.111.2.

    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_projects bool

    Set this value to true if you want the policy to run on all Artifactory projects. The default value is false.

    ~>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_n_versions int

    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_before_in_days int

    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 lastDownloadedBeforeInDays condition to ensure that packages currently in use are not archived.

    last_downloaded_before_in_months int
    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.

    Deprecated: Use lastDownloadedBeforeInDays instead of lastDownloadedBeforeInMonths. Renamed to lastDownloadedBeforeInDays starting in version 7.111.2.

    includedPackages 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 = ["**"]
    includedProjects 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 when includeAllProjects is set to true. ~>This setting is relevant only on the global level, for Platform Admins.
    packageTypes 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 = ["**"]
    createdBeforeInDays Number

    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 createdBeforeInDays condition to ensure that packages currently in use are not archived.

    createdBeforeInMonths Number
    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.

    Deprecated: Use createdBeforeInDays instead of createdBeforeInMonths. Renamed to createdBeforeInDays starting in version 7.111.2.

    excludedPackages List<String>
    Specify explicit package names that you want excluded from the policy. Only Name explicit names (and not patterns) are accepted.
    excludedProperties Map<List<String>>
    A key-value pair applied to the lead artifact of a package. Packages with this property will be excluded from archival.
    excludedRepos List<String>
    Specify patterns for repository names or explicit repository names that you want excluded from the archive policy.
    includeAllProjects Boolean

    Set this value to true if you want the policy to run on all Artifactory projects. The default value is false.

    ~>This attribute is relevant only on the global level, for Platform Admins.

    includedProperties Map<List<String>>
    A key-value pair applied to the lead artifact of a package. Packages with this property will be archived.
    keepLastNVersions Number

    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.

    lastDownloadedBeforeInDays Number

    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 lastDownloadedBeforeInDays condition to ensure that packages currently in use are not archived.

    lastDownloadedBeforeInMonths Number
    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.

    Deprecated: Use lastDownloadedBeforeInDays instead of lastDownloadedBeforeInMonths. Renamed to lastDownloadedBeforeInDays starting in version 7.111.2.

    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 artifactory Terraform Provider.
    artifactory logo
    Viewing docs for artifactory v8.10.5
    published on Tuesday, May 5, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.