-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a custom resource for blob container legal holds (#3079)
Azure Storage supports [Legal holds for immutable blob data](https://learn.microsoft.com/en-us/azure/storage/blobs/immutable-legal-hold-overview). The Azure Native provider didn't include this functionality because it's based on a POST API. Due to the heterogenous design of POST APIs, we cannot include them automatically. This PR adds a custom resource adding legal holds. It makes use of the new `AzureClient` from #3062 to make POST requests directly using the built-in provider functionality, without using yet another Azure SDK. An e2e test is also added. Resolves #2840
- Loading branch information
Showing
26 changed files
with
1,790 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
examples/blobcontainer-legalhold/2-update-legalhold/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import * as pulumi from "@pulumi/pulumi"; | ||
import * as resources from "@pulumi/azure-native/resources"; | ||
import * as storage from "@pulumi/azure-native/storage"; | ||
|
||
// Create an Azure Resource Group | ||
const resourceGroup = new resources.ResourceGroup("resourceGroup"); | ||
|
||
// Create an Azure resource (Storage Account) | ||
const storageAccount = new storage.StorageAccount("sa", { | ||
resourceGroupName: resourceGroup.name, | ||
sku: { | ||
name: storage.SkuName.Standard_LRS, | ||
}, | ||
kind: storage.Kind.StorageV2, | ||
}); | ||
|
||
const container = new storage.BlobContainer("container", { | ||
resourceGroupName: resourceGroup.name, | ||
accountName: storageAccount.name, | ||
containerName: "lhcontainer", | ||
}); | ||
|
||
const legalHold = new storage.BlobContainerLegalHold("legalHold", { | ||
resourceGroupName: resourceGroup.name, | ||
accountName: storageAccount.name, | ||
containerName: container.name, | ||
tags: ["tag1", "different"], | ||
allowProtectedAppendWritesAll: true, | ||
}); | ||
|
||
export const containerName = container.name; | ||
export const accountName = storageAccount.name; | ||
export const resourceGroupName = resourceGroup.name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
name: legalhold | ||
runtime: nodejs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import * as pulumi from "@pulumi/pulumi"; | ||
import * as resources from "@pulumi/azure-native/resources"; | ||
import * as storage from "@pulumi/azure-native/storage"; | ||
|
||
// Create an Azure Resource Group | ||
const resourceGroup = new resources.ResourceGroup("resourceGroup"); | ||
|
||
// Create an Azure resource (Storage Account) | ||
const storageAccount = new storage.StorageAccount("sa", { | ||
resourceGroupName: resourceGroup.name, | ||
sku: { | ||
name: storage.SkuName.Standard_LRS, | ||
}, | ||
kind: storage.Kind.StorageV2, | ||
}); | ||
|
||
const container = new storage.BlobContainer("container", { | ||
resourceGroupName: resourceGroup.name, | ||
accountName: storageAccount.name, | ||
containerName: "lhcontainer", | ||
}); | ||
|
||
const legalHold = new storage.BlobContainerLegalHold("legalHold", { | ||
resourceGroupName: resourceGroup.name, | ||
accountName: storageAccount.name, | ||
containerName: container.name, | ||
tags: ["tag1", "tag2"], | ||
allowProtectedAppendWritesAll: false, | ||
}); | ||
|
||
export const containerName = container.name; | ||
export const accountName = storageAccount.name; | ||
export const resourceGroupName = resourceGroup.name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "azure-native-keyvault", | ||
"version": "0.1.0", | ||
"devDependencies": { | ||
"@types/node": "latest" | ||
}, | ||
"dependencies": { | ||
"@pulumi/pulumi": "^3.0.0", | ||
"@pulumi/azure-native": "^2.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.