-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Enable RBAC without AAD #2347
Enable RBAC without AAD #2347
Conversation
Thanks for this PR :) During the investigation into RBAC recently it appeared that whilst you can enable/disable RBAC for AKS at this time it's tied to AzureAD. For this reason we've designed the block such that if/when additional methods are available for RBAC in the future that we can support them as nested items in the As such I believe we should be able to infer the value of the Thanks! |
To be clear: I completely agree on RBAC being related to Azure AD for user authentication, and we are currently re-deploying all our clusters to enable this. Also because it's in the security best practices . However it is possible to only enable RBAC without Azure AD integration at the moment.
So I think multiple users might have an issue with this update unless they upgrade their clusters to enable Azure AD integration. |
I try to follow the same "block idea" of others blocks (like oms_agent and http_application_routing), with the "enabled" flag, instead of inferring the presence of block. |
@@ -596,6 +597,7 @@ resource "azurerm_kubernetes_cluster" "test" { | |||
} | |||
|
|||
role_based_access_control { | |||
enaled=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.
it looks like you have a typo here: enaled -> enabled
This comment has been minimized.
This comment has been minimized.
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.
hey @raphaelquati
Thanks for this PR - apologies for the delayed review here, I'd reviewed this but not hit submit.
On the whole this PR looks pretty good - I've left a few comments inline which need to be fixed for us to merge this. Since we're trying to include this in the 1.20 release I'm going to make these changes and include this in a branch which fixes both #2345 and #2421 - so whilst I'd like to thank you for this contribution I'm going to close this in favour of a combined PR for those (I hope you don't mind!).
Thanks!
@@ -315,12 +315,17 @@ func resourceArmKubernetesCluster() *schema.Resource { | |||
Type: schema.TypeList, | |||
Optional: true, | |||
ForceNew: true, | |||
MaxItems: 1, | |||
MaxItems: 2, |
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.
there can only be a single block - so this can be flipped back to 1
azureADProfile := expandKubernetesClusterRoleBasedAccessControl(rbacRaw, tenantId) | ||
roleBasedAccessControlEnabled := azureADProfile != nil | ||
roleBasedAccessControlEnabled, azureADProfile := expandKubernetesClusterRoleBasedAccessControl(rbacRaw, tenantId) | ||
//roleBasedAccessControlEnabled := azureADProfile != nil |
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 can remove this line, since it's not being used
return []interface{}{} | ||
return []interface{}{ | ||
map[string]interface{}{ | ||
"enabled": *enabledRBAC, |
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.
there's a crash we should check here
return []interface{}{ | ||
map[string]interface{}{ | ||
"enabled": *enabledRBAC, | ||
}, |
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 still need to set the azure_active_directory
block to an empty list, if it's not enabled (since then it'll show as a diff if necessary)
@@ -978,6 +991,7 @@ func flattenKubernetesClusterRoleBasedAccessControl(input *containerservice.Mana | |||
|
|||
return []interface{}{ | |||
map[string]interface{}{ | |||
"enabled": *enabledRBAC, |
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.
there's a potential crash here which we can nil-check around
@@ -122,6 +122,7 @@ func TestAccAzureRMKubernetesCluster_roleBasedAccessControl(t *testing.T) { | |||
Check: resource.ComposeTestCheckFunc( | |||
testCheckAzureRMKubernetesClusterExists(resourceName), | |||
resource.TestCheckResourceAttr(resourceName, "role_based_access_control.#", "1"), | |||
resource.TestCheckResourceAttr(resourceName, "role_based_access_control.0.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.
it'd be good to ensure this is set to false
for the basic configuration
@@ -596,6 +597,7 @@ resource "azurerm_kubernetes_cluster" "test" { | |||
} | |||
|
|||
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.
minor can we fix the formatting here?
As discussed above - closing this in favour of #2495 |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks! |
Implementation for #2345