Vault Lock
    Example Usage
Testing Glacier Vault Lock Policy
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const exampleVault = new aws.glacier.Vault("example", {name: "example"});
const example = aws.iam.getPolicyDocumentOutput({
    statements: [{
        actions: ["glacier:DeleteArchive"],
        effect: "Deny",
        resources: [exampleVault.arn],
        conditions: [{
            test: "NumericLessThanEquals",
            variable: "glacier:ArchiveAgeinDays",
            values: ["365"],
        }],
    }],
});
const exampleVaultLock = new aws.glacier.VaultLock("example", {
    completeLock: false,
    policy: example.apply(example => example.json),
    vaultName: exampleVault.name,
});import pulumi
import pulumi_aws as aws
example_vault = aws.glacier.Vault("example", name="example")
example = aws.iam.get_policy_document_output(statements=[aws.iam.GetPolicyDocumentStatementArgs(
    actions=["glacier:DeleteArchive"],
    effect="Deny",
    resources=[example_vault.arn],
    conditions=[aws.iam.GetPolicyDocumentStatementConditionArgs(
        test="NumericLessThanEquals",
        variable="glacier:ArchiveAgeinDays",
        values=["365"],
    )],
)])
example_vault_lock = aws.glacier.VaultLock("example",
    complete_lock=False,
    policy=example.json,
    vault_name=example_vault.name)using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
    var exampleVault = new Aws.Glacier.Vault("example", new()
    {
        Name = "example",
    });
    var example = Aws.Iam.GetPolicyDocument.Invoke(new()
    {
        Statements = new[]
        {
            new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
            {
                Actions = new[]
                {
                    "glacier:DeleteArchive",
                },
                Effect = "Deny",
                Resources = new[]
                {
                    exampleVault.Arn,
                },
                Conditions = new[]
                {
                    new Aws.Iam.Inputs.GetPolicyDocumentStatementConditionInputArgs
                    {
                        Test = "NumericLessThanEquals",
                        Variable = "glacier:ArchiveAgeinDays",
                        Values = new[]
                        {
                            "365",
                        },
                    },
                },
            },
        },
    });
    var exampleVaultLock = new Aws.Glacier.VaultLock("example", new()
    {
        CompleteLock = false,
        Policy = example.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
        VaultName = exampleVault.Name,
    });
});package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/glacier"
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleVault, err := glacier.NewVault(ctx, "example", &glacier.VaultArgs{
			Name: pulumi.String("example"),
		})
		if err != nil {
			return err
		}
		example := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{
			Statements: iam.GetPolicyDocumentStatementArray{
				&iam.GetPolicyDocumentStatementArgs{
					Actions: pulumi.StringArray{
						pulumi.String("glacier:DeleteArchive"),
					},
					Effect: pulumi.String("Deny"),
					Resources: pulumi.StringArray{
						exampleVault.Arn,
					},
					Conditions: iam.GetPolicyDocumentStatementConditionArray{
						&iam.GetPolicyDocumentStatementConditionArgs{
							Test:     pulumi.String("NumericLessThanEquals"),
							Variable: pulumi.String("glacier:ArchiveAgeinDays"),
							Values: pulumi.StringArray{
								pulumi.String("365"),
							},
						},
					},
				},
			},
		}, nil)
		_, err = glacier.NewVaultLock(ctx, "example", &glacier.VaultLockArgs{
			CompleteLock: pulumi.Bool(false),
			Policy: example.ApplyT(func(example iam.GetPolicyDocumentResult) (*string, error) {
				return &example.Json, nil
			}).(pulumi.StringPtrOutput),
			VaultName: exampleVault.Name,
		})
		if err != nil {
			return err
		}
		return nil
	})
}package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.glacier.Vault;
import com.pulumi.aws.glacier.VaultArgs;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.glacier.VaultLock;
import com.pulumi.aws.glacier.VaultLockArgs;
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 exampleVault = new Vault("exampleVault", VaultArgs.builder()
            .name("example")
            .build());
        final var example = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
            .statements(GetPolicyDocumentStatementArgs.builder()
                .actions("glacier:DeleteArchive")
                .effect("Deny")
                .resources(exampleVault.arn())
                .conditions(GetPolicyDocumentStatementConditionArgs.builder()
                    .test("NumericLessThanEquals")
                    .variable("glacier:ArchiveAgeinDays")
                    .values("365")
                    .build())
                .build())
            .build());
        var exampleVaultLock = new VaultLock("exampleVaultLock", VaultLockArgs.builder()
            .completeLock(false)
            .policy(example.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult).applyValue(example -> example.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())))
            .vaultName(exampleVault.name())
            .build());
    }
}resources:
  exampleVault:
    type: aws:glacier:Vault
    name: example
    properties:
      name: example
  exampleVaultLock:
    type: aws:glacier:VaultLock
    name: example
    properties:
      completeLock: false
      policy: ${example.json}
      vaultName: ${exampleVault.name}
variables:
  example:
    fn::invoke:
      Function: aws:iam:getPolicyDocument
      Arguments:
        statements:
          - actions:
              - glacier:DeleteArchive
            effect: Deny
            resources:
              - ${exampleVault.arn}
            conditions:
              - test: NumericLessThanEquals
                variable: glacier:ArchiveAgeinDays
                values:
                  - '365'Permanently Applying Glacier Vault Lock Policy
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.glacier.VaultLock("example", {
    completeLock: true,
    policy: exampleAwsIamPolicyDocument.json,
    vaultName: exampleAwsGlacierVault.name,
});import pulumi
import pulumi_aws as aws
example = aws.glacier.VaultLock("example",
    complete_lock=True,
    policy=example_aws_iam_policy_document["json"],
    vault_name=example_aws_glacier_vault["name"])using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
    var example = new Aws.Glacier.VaultLock("example", new()
    {
        CompleteLock = true,
        Policy = exampleAwsIamPolicyDocument.Json,
        VaultName = exampleAwsGlacierVault.Name,
    });
});package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/glacier"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := glacier.NewVaultLock(ctx, "example", &glacier.VaultLockArgs{
			CompleteLock: pulumi.Bool(true),
			Policy:       pulumi.Any(exampleAwsIamPolicyDocument.Json),
			VaultName:    pulumi.Any(exampleAwsGlacierVault.Name),
		})
		if err != nil {
			return err
		}
		return nil
	})
}package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.glacier.VaultLock;
import com.pulumi.aws.glacier.VaultLockArgs;
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 example = new VaultLock("example", VaultLockArgs.builder()
            .completeLock(true)
            .policy(exampleAwsIamPolicyDocument.json())
            .vaultName(exampleAwsGlacierVault.name())
            .build());
    }
}resources:
  example:
    type: aws:glacier:VaultLock
    properties:
      completeLock: true
      policy: ${exampleAwsIamPolicyDocument.json}
      vaultName: ${exampleAwsGlacierVault.name}Import
Using pulumi import, import Glacier Vault Locks using the Glacier Vault name. For example:
$ pulumi import aws:glacier/vaultLock:VaultLock example example-vaultProperties
Boolean whether to permanently apply this Glacier Lock Policy. Once completed, this cannot be undone. If set to false, the Glacier Lock Policy remains in a testing mode for 24 hours. After that time, the Glacier Lock Policy is automatically removed by Glacier and the this provider resource will show as needing recreation. Changing this from false to true will show as resource recreation, which is expected. Changing this from true to false is not possible unless the Glacier Vault is recreated at the same time.
Allow this provider to ignore the error returned when attempting to delete the Glacier Lock Policy. This can be used to delete or recreate the Glacier Vault via this provider, for example, if the Glacier Vault Lock policy permits that action. This should only be used in conjunction with complete_lock being set to true.