Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow storage account's system assigned identity use CMK #155

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

christian-calabrese
Copy link
Contributor

@christian-calabrese christian-calabrese commented Nov 11, 2024

List of changes

Allow the storage account's system assigned identity to use the CMK without a user assigned one
Creating the customer managed key kv key automatically
Adding relevant permissions to the right managed identity to use the customer managed key
Allow the usage of pre-existing key vault keys as customer managed keys

Motivation and context

Some storage accounts that are being migrated from WEU to ITN make use of the system assigned managed identity for CMK setup

Type of changes

  • Add new resources
  • Update configuration to existing resources
  • Remove existing resources

Does this introduce a change to production resources with possible user impact?

  • Yes, users may be impacted applying this change
  • No

Other information

Copy link

changeset-bot bot commented Nov 11, 2024

🦋 Changeset detected

Latest commit: 039d3c4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
azure_storage_account Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@christian-calabrese christian-calabrese force-pushed the allow-cmk-storage-account-with-system-assigned-identity branch from 98994f5 to b1e46e4 Compare November 12, 2024 15:55
@christian-calabrese christian-calabrese marked this pull request as ready for review November 12, 2024 15:55
@christian-calabrese christian-calabrese requested review from a team as code owners November 12, 2024 15:55
@christian-calabrese christian-calabrese force-pushed the allow-cmk-storage-account-with-system-assigned-identity branch from e6e8181 to 7f81396 Compare November 12, 2024 16:15
@christian-calabrese christian-calabrese force-pushed the allow-cmk-storage-account-with-system-assigned-identity branch from 0ad1ad1 to 039d3c4 Compare November 13, 2024 11:09
})
description = "(Optional) Customer managed key to use for encryption. Currently type can only be set to 'kv'."
default = { enabled = false, key_name = null }
description = "(Optional) Customer managed key to use for encryption. Currently type can only be set to 'kv'. If the key vault is in the same account, and key_name is not set, the key and relevant permissions will be automatically created."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tenant rather than account?

# tfsec:ignore:azure-keyvault-ensure-key-expiry
resource "azurerm_key_vault_key" "key" {
for_each = (local.cmk_flags.kv && var.customer_managed_key.key_name == null ? toset(["kv"]) : toset([]))
name = "${replace("${module.naming_convention.prefix}-st-${module.naming_convention.suffix}", "-", "")}-cmk-kv"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of a format like io-p-itn-<domain>-[<app_name>]-st-cmk-01? I took it from the current PEP format as io-p-itn-wallet-sql-pep-01

Copy link
Contributor

@mamu0 mamu0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Krusty93
Copy link
Contributor

I might have already asked - what are these storage accounts? why do they use managed identities? what key do they use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants