Package com.pulumi.aws.glacier
Class VaultLock
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.glacier.VaultLock
-
public class VaultLock extends com.pulumi.resources.CustomResourceManages a Glacier Vault Lock. You can refer to the [Glacier Developer Guide](https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock.html) for a full explanation of the Glacier Vault Lock functionality. > **NOTE:** This resource allows you to test Glacier Vault Lock policies by setting the `completeLock` argument to `false`. When testing policies in this manner, the Glacier Vault Lock automatically expires after 24 hours and this provider will show this resource as needing recreation after that time. To permanently apply the policy, set the `completeLock` argument to `true`. When changing `completeLock` to `true`, it is expected the resource will show as recreating. > **NOTE:** We suggest using `jsonencode()` or `aws.iam.getPolicyDocument` when assigning a value to `policy`. They seamlessly translate Terraform language into JSON, enabling you to maintain consistency within your configuration without the need for context switches. Also, you can sidestep potential complications arising from formatting discrepancies, whitespace inconsistencies, and other nuances inherent to JSON. > **WARNING:** Once a Glacier Vault Lock is completed, it is immutable. The deletion of the Glacier Vault Lock is not be possible and attempting to remove it from this provider will return an error. Set the `ignoreDeletionError` argument to `true` and apply this configuration before attempting to delete this resource via this provider or remove this resource from this provider's management. ## Example Usage ### Testing Glacier Vault Lock Policy
### Permanently Applying Glacier Vault Lock Policypackage 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.iam.inputs.GetPolicyDocumentStatementArgs; import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementConditionArgs; import com.pulumi.aws.glacier.VaultLock; import com.pulumi.aws.glacier.VaultLockArgs; 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 exampleVault = new Vault("exampleVault", VaultArgs.builder() .name("example") .build()); final var example = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder() .statements(GetPolicyDocumentStatementArgs.builder() .conditions(GetPolicyDocumentStatementConditionArgs.builder() .test("NumericLessThanEquals") .variable("glacier:ArchiveAgeinDays") .values("365") .build()) .actions("glacier:DeleteArchive") .effect("Deny") .resources(exampleVault.arn()) .build()) .build()); var exampleVaultLock = new VaultLock("exampleVaultLock", VaultLockArgs.builder() .completeLock(false) .policy(example.applyValue(_example -> _example.json())) .vaultName(exampleVault.name()) .build()); } }
## Import Using `pulumi import`, import Glacier Vault Locks using the Glacier Vault name. For example: ```sh $ pulumi import aws:glacier/vaultLock:VaultLock example example-vault ```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.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 example = new VaultLock("example", VaultLockArgs.builder() .completeLock(true) .policy(exampleAwsIamPolicyDocument.json()) .vaultName(exampleAwsGlacierVault.name()) .build()); } }
-
-
Constructor Summary
Constructors Constructor Description VaultLock(java.lang.String name)VaultLock(java.lang.String name, VaultLockArgs args)VaultLock(java.lang.String name, VaultLockArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.Boolean>completeLock()static VaultLockget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, VaultLockState state, com.pulumi.resources.CustomResourceOptions options)Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>ignoreDeletionError()com.pulumi.core.Output<java.lang.String>policy()com.pulumi.core.Output<java.lang.String>region()com.pulumi.core.Output<java.lang.String>vaultName()
-
-
-
Constructor Detail
-
VaultLock
public VaultLock(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
VaultLock
public VaultLock(java.lang.String name, VaultLockArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
VaultLock
public VaultLock(java.lang.String name, VaultLockArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.options- A bag of options that control this resource's behavior.
-
-
Method Detail
-
completeLock
public com.pulumi.core.Output<java.lang.Boolean> completeLock()
- Returns:
- 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.
-
ignoreDeletionError
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> ignoreDeletionError()
- Returns:
- 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 `completeLock` being set to `true`.
-
policy
public com.pulumi.core.Output<java.lang.String> policy()
- Returns:
- JSON string containing the IAM policy to apply as the Glacier Vault Lock policy.
-
region
public com.pulumi.core.Output<java.lang.String> region()
- Returns:
- Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
-
vaultName
public com.pulumi.core.Output<java.lang.String> vaultName()
- Returns:
- Name of the Glacier Vault.
-
get
public static VaultLock get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable VaultLockState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name- The _unique_ name of the resulting resource.id- The _unique_ provider ID of the resource to lookup.state-options- Optional settings to control the behavior of the CustomResource.
-
-