Vault class

Provides a Glacier Vault Resource. You can refer to the Glacier Developer Guide for a full explanation of the Glacier Vault functionality

> NOTE: When removing a Glacier Vault, the Vault must be empty.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const awsSnsTopic = new aws.sns.Topic("aws_sns_topic", {name: "glacier-sns-topic"});
const myArchive = aws.iam.getPolicyDocument({
    statements: [{
        principals: [{
            type: "*",
            identifiers: ["*"],
        }],
        sid: "add-read-only-perm",
        effect: "Allow",
        actions: [
            "glacier:InitiateJob",
            "glacier:GetJobOutput",
        ],
        resources: ["arn:aws:glacier:eu-west-1:432981146916:vaults/MyArchive"],
    }],
});
const myArchiveVault = new aws.glacier.Vault("my_archive", {
    notification: {
        snsTopic: awsSnsTopic.arn,
        events: [
            "ArchiveRetrievalCompleted",
            "InventoryRetrievalCompleted",
        ],
    },
    name: "MyArchive",
    accessPolicy: myArchive.then(myArchive => myArchive.json),
    tags: {
        Test: "MyArchive",
    },
});
import pulumi
import pulumi_aws as aws

aws_sns_topic = aws.sns.Topic("aws_sns_topic", name="glacier-sns-topic")
my_archive = aws.iam.get_policy_document(statements=[{
    "principals": [{
        "type": "*",
        "identifiers": ["*"],
    }],
    "sid": "add-read-only-perm",
    "effect": "Allow",
    "actions": [
        "glacier:InitiateJob",
        "glacier:GetJobOutput",
    ],
    "resources": ["arn:aws:glacier:eu-west-1:432981146916:vaults/MyArchive"],
}])
my_archive_vault = aws.glacier.Vault("my_archive",
    notification={
        "sns_topic": aws_sns_topic.arn,
        "events": [
            "ArchiveRetrievalCompleted",
            "InventoryRetrievalCompleted",
        ],
    },
    name="MyArchive",
    access_policy=my_archive.json,
    tags={
        "Test": "MyArchive",
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var awsSnsTopic = new Aws.Sns.Topic("aws_sns_topic", new()
    {
        Name = "glacier-sns-topic",
    });

    var myArchive = Aws.Iam.GetPolicyDocument.Invoke(new()
    {
        Statements = new[]
        {
            new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
            {
                Principals = new[]
                {
                    new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                    {
                        Type = "*",
                        Identifiers = new[]
                        {
                            "*",
                        },
                    },
                },
                Sid = "add-read-only-perm",
                Effect = "Allow",
                Actions = new[]
                {
                    "glacier:InitiateJob",
                    "glacier:GetJobOutput",
                },
                Resources = new[]
                {
                    "arn:aws:glacier:eu-west-1:432981146916:vaults/MyArchive",
                },
            },
        },
    });

    var myArchiveVault = new Aws.Glacier.Vault("my_archive", new()
    {
        Notification = new Aws.Glacier.Inputs.VaultNotificationArgs
        {
            SnsTopic = awsSnsTopic.Arn,
            Events = new[]
            {
                "ArchiveRetrievalCompleted",
                "InventoryRetrievalCompleted",
            },
        },
        Name = "MyArchive",
        AccessPolicy = myArchive.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
        Tags =
        {
            { "Test", "MyArchive" },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/glacier"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sns"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		awsSnsTopic, err := sns.NewTopic(ctx, "aws_sns_topic", &sns.TopicArgs{
			Name: pulumi.String("glacier-sns-topic"),
		})
		if err != nil {
			return err
		}
		myArchive, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
			Statements: []iam.GetPolicyDocumentStatement{
				{
					Principals: []iam.GetPolicyDocumentStatementPrincipal{
						{
							Type: "*",
							Identifiers: []string{
								"*",
							},
						},
					},
					Sid:    pulumi.StringRef("add-read-only-perm"),
					Effect: pulumi.StringRef("Allow"),
					Actions: []string{
						"glacier:InitiateJob",
						"glacier:GetJobOutput",
					},
					Resources: []string{
						"arn:aws:glacier:eu-west-1:432981146916:vaults/MyArchive",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		_, err = glacier.NewVault(ctx, "my_archive", &glacier.VaultArgs{
			Notification: &glacier.VaultNotificationArgs{
				SnsTopic: awsSnsTopic.Arn,
				Events: pulumi.StringArray{
					pulumi.String("ArchiveRetrievalCompleted"),
					pulumi.String("InventoryRetrievalCompleted"),
				},
			},
			Name:         pulumi.String("MyArchive"),
			AccessPolicy: pulumi.String(myArchive.Json),
			Tags: pulumi.StringMap{
				"Test": pulumi.String("MyArchive"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

data "aws_iam_getpolicydocument" "myArchive" {
  statements {
    principals {
      type        = "*"
      identifiers = ["*"]
    }
    sid       = "add-read-only-perm"
    effect    = "Allow"
    actions   = ["glacier:InitiateJob", "glacier:GetJobOutput"]
    resources = ["arn:aws:glacier:eu-west-1:432981146916:vaults/MyArchive"]
  }
}

resource "aws_sns_topic" "aws_sns_topic" {
  name = "glacier-sns-topic"
}
resource "aws_glacier_vault" "my_archive" {
  notification = {
    sns_topic = aws_sns_topic.aws_sns_topic.arn
    events    = ["ArchiveRetrievalCompleted", "InventoryRetrievalCompleted"]
  }
  name          = "MyArchive"
  access_policy = data.aws_iam_getpolicydocument.myArchive.json
  tags = {
    "Test" = "MyArchive"
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sns.Topic;
import com.pulumi.aws.sns.TopicArgs;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementArgs;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementPrincipalArgs;
import com.pulumi.aws.glacier.Vault;
import com.pulumi.aws.glacier.VaultArgs;
import com.pulumi.aws.glacier.inputs.VaultNotificationArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 awsSnsTopic = new Topic("awsSnsTopic", TopicArgs.builder()
            .name("glacier-sns-topic")
            .build());

        final var myArchive = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
            .statements(GetPolicyDocumentStatementArgs.builder()
                .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                    .type("*")
                    .identifiers("*")
                    .build())
                .sid("add-read-only-perm")
                .effect("Allow")
                .actions(
                    "glacier:InitiateJob",
                    "glacier:GetJobOutput")
                .resources("arn:aws:glacier:eu-west-1:432981146916:vaults/MyArchive")
                .build())
            .build());

        var myArchiveVault = new Vault("myArchiveVault", VaultArgs.builder()
            .notification(VaultNotificationArgs.builder()
                .snsTopic(awsSnsTopic.arn())
                .events(
                    "ArchiveRetrievalCompleted",
                    "InventoryRetrievalCompleted")
                .build())
            .name("MyArchive")
            .accessPolicy(myArchive.json())
            .tags(Map.of("Test", "MyArchive"))
            .build());

    }
}
resources:
  awsSnsTopic:
    type: aws:sns:Topic
    name: aws_sns_topic
    properties:
      name: glacier-sns-topic
  myArchiveVault:
    type: aws:glacier:Vault
    name: my_archive
    properties:
      notification:
        snsTopic: ${awsSnsTopic.arn}
        events:
          - ArchiveRetrievalCompleted
          - InventoryRetrievalCompleted
      name: MyArchive
      accessPolicy: ${myArchive.json}
      tags:
        Test: MyArchive
variables:
  myArchive:
    fn::invoke:
      function: aws:iam:getPolicyDocument
      arguments:
        statements:
          - principals:
              - type: '*'
                identifiers:
                  - '*'
            sid: add-read-only-perm
            effect: Allow
            actions:
              - glacier:InitiateJob
              - glacier:GetJobOutput
            resources:
              - arn:aws:glacier:eu-west-1:432981146916:vaults/MyArchive

Import

Using pulumi import, import Glacier Vaults using the name. For example:

$ pulumi import aws:glacier/vault:Vault archive my_archive

Constructors

Vault(String name, {VaultArgs? args, CustomResourceOptions? options})
Creates a new Vault. name The Pulumi resource name. args Arguments used to configure this Vault. The set of arguments for Vault. options Resource options controlling this resource's behavior.
Vault.reference(String urn)
Creates a typed reference to an existing Vault resource.

Properties

accessPolicy ↔ Output<String?>
The policy document. This is a JSON formatted string. The heredoc syntax or file function is helpful here. Use the Glacier Developer Guide for more information on Glacier Vault Policy
latefinal
arn ↔ Output<String>
The ARN of the vault.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
location ↔ Output<String>
The URI of the vault that was created.
latefinal
name ↔ Output<String>
The name of the Vault. Names can be between 1 and 255 characters long and the valid characters are a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), and '.' (period).
latefinal
notification ↔ Output<VaultNotification?>
The notifications for the Vault. Fields documented below.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tags ↔ Output<Map<String, String>?>
A map of tags to assign to the resource. .If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {VaultState? state, CustomResourceOptions? options}) → Vault
Gets an existing Vault resource's state with the given name and id.