-
Notifications
You must be signed in to change notification settings - Fork 469
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
feat: Implement support for KMS arguments #288
feat: Implement support for KMS arguments #288
Conversation
06b70fa
to
fc2b23f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mkilchhofer for opening this pr and submitting a new resource pr to terraform-azurerm-provider's repo, I've left some comments on provider's pr, once the pr has been merged into the provider, we can continue the code review for this pr.
Btw the review comments for your provider's pr are my personal suggestions, there's no guarantee that your pr would be accepted by HashiCorp if you accepted my suggestion.
main.tf
Outdated
@@ -136,6 +136,16 @@ resource "azurerm_kubernetes_cluster" "main" { | |||
subnet_id = var.ingress_application_gateway_subnet_id | |||
} | |||
} | |||
dynamic "key_vault_kms" { | |||
for_each = var.key_vault_kms_enabled ? ["key_vault_kms"] : [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we could turn enabled
to false
meanwhile keeping this key_vault_kms
, I would recommend the following toggle expression:
for_each = var.key_vault_kms_enabled != null ? ["key_vault_kms"] : []
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactored this anyways (source was the upstream implementation)
a8c2e97
to
1eef1ef
Compare
PR is now updated after the upstream provider PR got merged AND released ;-) @lonegunmanb can you please review again? |
1eef1ef
to
25c45a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mkilchhofer for updating this pr, some issues need to be solved.
It would be nice if we could have an new example to demonstrate this new feature. We have already created a KeyValut in startup
example, but for disk encryption key management for now, would you please estimate whether if we can make that KeyVault work for this new feature? We might need to update azurerm
provider's restriction in providers.tf
file in startup
folder. Or we can just crate a new example folder to do so, your call.
Again, thanks for your contribution!
56eb644
to
2058adc
Compare
I cannot test the examples as we @swisspost have no subscriptions which allows usage of public IPs. |
@mkilchhofer I can do that ! thanks |
@mkilchhofer could you please run the
You patched the example and you have duplicated definitions for
|
- nullable=false on `kms_enabled` - Validate kms_enabled and UserAssigned identity
54029b0
to
c0cde66
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you patch only the named_cluster
example ?
We dont need to the KMS in the others, it would also require more work because the needed UserAssigned
identity_type is not set in the others. Thanks
c0cde66
to
eda1086
Compare
56d79c3
to
f61f35c
Compare
commit 7012178 is now passing both @lonegunmanb could you please review and run the e2e tests ? thanks |
@lonegunmanb can you trigger E2E again? 😇 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mkilchhofer for this update, we've met some issues when we ran the test.
We've added network_acl
on the KeyVault to restrict the source IP which can access this Key Vault, but the Aks's public IP is unpredictable so the original code would meet a 403 error.
We need config the aks to access the KeyVault via private network as this document described.
@@ -77,4 +77,12 @@ module "aks_cluster_name" { | |||
rbac_aad = true | |||
rbac_aad_managed = true | |||
role_based_access_control_enabled = true | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need the following line below line 31:
service_endpoints = ["Microsoft.KeyVault"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Service endpoint is not needed (at least in our scenario). I think its only needed if some part inside the VNET wants to access the keyvault.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mkilchhofer, LGTM! 🚀
Thanks alot for your patience with me 👍 |
Describe your changes
This implements Add Key Management Service (KMS) etcd encryption to an Azure Kubernetes Service (AKS) cluster.
Feature is not yet available in azurerm provider, but also opened a PR over there:
azurerm_kubernetes_cluster
- Support for KMS arguments hashicorp/terraform-provider-azurerm#19893Issue number
-
Checklist before requesting a review
CHANGELOG.md
fileThanks for your cooperation!