pulumi_wasm_providers_azure_mini::storage

Module management_policy

source
Expand description

Manages an Azure Storage Account Management Policy.

§Example Usage

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let example = resource_group::create(
        "example",
        ResourceGroupArgs::builder()
            .location("West Europe")
            .name("resourceGroupName")
            .build_struct(),
    );
    let exampleAccount = account::create(
        "exampleAccount",
        AccountArgs::builder()
            .account_kind("BlobStorage")
            .account_replication_type("LRS")
            .account_tier("Standard")
            .location("${example.location}")
            .name("storageaccountname")
            .resource_group_name("${example.name}")
            .build_struct(),
    );
    let exampleManagementPolicy = management_policy::create(
        "exampleManagementPolicy",
        ManagementPolicyArgs::builder()
            .rules(
                vec![
                    ManagementPolicyRule::builder()
                    .actions(ManagementPolicyRuleActions::builder()
                    .baseBlob(ManagementPolicyRuleActionsBaseBlob::builder()
                    .deleteAfterDaysSinceModificationGreaterThan(100)
                    .tierToArchiveAfterDaysSinceModificationGreaterThan(50)
                    .tierToCoolAfterDaysSinceModificationGreaterThan(10).build_struct())
                    .snapshot(ManagementPolicyRuleActionsSnapshot::builder()
                    .deleteAfterDaysSinceCreationGreaterThan(30).build_struct())
                    .build_struct()).enabled(true)
                    .filters(ManagementPolicyRuleFilters::builder()
                    .blobTypes(vec!["blockBlob",])
                    .matchBlobIndexTags(vec![ManagementPolicyRuleFiltersMatchBlobIndexTag::builder()
                    .name("tag1").operation("==").value("val1").build_struct(),])
                    .prefixMatches(vec!["container1/prefix1",]).build_struct())
                    .name("rule1").build_struct(), ManagementPolicyRule::builder()
                    .actions(ManagementPolicyRuleActions::builder()
                    .baseBlob(ManagementPolicyRuleActionsBaseBlob::builder()
                    .deleteAfterDaysSinceModificationGreaterThan(101)
                    .tierToArchiveAfterDaysSinceModificationGreaterThan(51)
                    .tierToCoolAfterDaysSinceModificationGreaterThan(11).build_struct())
                    .snapshot(ManagementPolicyRuleActionsSnapshot::builder()
                    .changeTierToArchiveAfterDaysSinceCreation(90)
                    .changeTierToCoolAfterDaysSinceCreation(23)
                    .deleteAfterDaysSinceCreationGreaterThan(31).build_struct())
                    .version(ManagementPolicyRuleActionsVersion::builder()
                    .changeTierToArchiveAfterDaysSinceCreation(9)
                    .changeTierToCoolAfterDaysSinceCreation(90)
                    .deleteAfterDaysSinceCreation(3).build_struct()).build_struct())
                    .enabled(false).filters(ManagementPolicyRuleFilters::builder()
                    .blobTypes(vec!["blockBlob",])
                    .prefixMatches(vec!["container2/prefix1", "container2/prefix2",])
                    .build_struct()).name("rule2").build_struct(),
                ],
            )
            .storage_account_id("${exampleAccount.id}")
            .build_struct(),
    );
}

§Import

Storage Account Management Policies can be imported using the resource id, e.g.

$ pulumi import azure:storage/managementPolicy:ManagementPolicy example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Storage/storageAccounts/myaccountname/managementPolicies/default

Structs§

Functions§

  • Registers a new resource with the given unique name and arguments