Skip to content

Commit

Permalink
feat: add parameter containerName
Browse files Browse the repository at this point in the history
Create blob container with the specified name. Set previously hard coded value as default to ensure backwards compatability.
  • Loading branch information
hknutsen committed Jan 2, 2025
1 parent 9dd6db6 commit 9cc3033
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Azure Resource Manager (ARM) template that creates an Azure Storage account to s

- Creates a storage account with the specified name.
- Configures the storage account according to [security recommendations](https://learn.microsoft.com/en-us/azure/storage/blobs/security-recommendations).
- Creates a storage container `tfstate`.
- Creates a blob container with the specified name.
- Grants access to the storage account for specified user, group and service principals.
- Creates a read-only lock to prevent changes to the storage account.

Expand Down Expand Up @@ -83,6 +83,7 @@ Azure Resource Manager (ARM) template that creates an Azure Storage account to s
| Name | Description | Type | Default |
| - | - | - | - |
| `storageAccountName` | The name of the storage account to create. | `string` | |
| `containerName` | The name of the blob container to create. | `string` | `tfstate` |
| `ipRules` | An array of IP addresses or ranges that should be granted access to the storage account. If empty, all IP addresses and ranges will be granted access to the storage account. | `array` | `[]` |
| `principalIds` | An array of object IDs for user, group or service principals that should be granted access to the storage account. | `array` | `[]` |

Expand All @@ -91,7 +92,7 @@ Azure Resource Manager (ARM) template that creates an Azure Storage account to s
| Name | Description | Type |
| - | - | - |
| `storageAccountName` | The name of the storage account that was created. | `string` |
| `containerName` | The name of the storage container that was created. | `string` |
| `containerName` | The name of the blob container that was created. | `string` |

## References

Expand Down
7 changes: 5 additions & 2 deletions main.bicep
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
@description('The name of the Storage account to create.')
param storageAccountName string

@description('The name of the blob container to create.')
param containerName string

@description('An array of IP addresses or IP ranges that should be allowed to bypass the firewall of the Terraform backend. If empty, the firewall will be disabled.')
param ipRules array = []

Expand Down Expand Up @@ -52,7 +55,7 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' = {
}

resource container 'containers' = {
name: 'tfstate'
name: containerName
}
}

Expand Down Expand Up @@ -115,5 +118,5 @@ resource lock 'Microsoft.Authorization/locks@2020-05-01' = {
@description('The name of the Storage account that was created.')
output storageAccountName string = storageAccount.name

@description('The name of the Storage container that was created.')
@description('The name of the blob container that was created.')
output containerName string = storageAccount::blobService::container.name

0 comments on commit 9cc3033

Please sign in to comment.