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

azurerm_kubernetes_cluster: Support update of azure_rbac_enabled #12029

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ func testAccKubernetesCluster_roleBasedAccessControlAADManagedChange(t *testing.
check.That(data.ResourceName).Key("role_based_access_control.0.azure_active_directory.#").HasValue("1"),
check.That(data.ResourceName).Key("role_based_access_control.0.azure_active_directory.0.tenant_id").Exists(),
check.That(data.ResourceName).Key("role_based_access_control.0.azure_active_directory.0.managed").Exists(),
check.That(data.ResourceName).Key("role_based_access_control.0.azure_active_directory.0.azure_rbac_enabled").HasValue("false"),
check.That(data.ResourceName).Key("kube_admin_config.#").HasValue("1"),
check.That(data.ResourceName).Key("kube_admin_config_raw").Exists(),
check.That(data.ResourceName).Key("default_node_pool.0.node_count").HasValue("1"),
Expand Down Expand Up @@ -337,6 +338,24 @@ func testAccKubernetesCluster_roleBasedAccessControlAzure(t *testing.T) {
clientData := data.Client()

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.roleBasedAccessControlAADManagedConfig(data, ""),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("role_based_access_control.#").HasValue("1"),
check.That(data.ResourceName).Key("role_based_access_control.0.enabled").HasValue("true"),
check.That(data.ResourceName).Key("role_based_access_control.0.azure_active_directory.#").HasValue("1"),
check.That(data.ResourceName).Key("role_based_access_control.0.azure_active_directory.0.tenant_id").Exists(),
check.That(data.ResourceName).Key("role_based_access_control.0.azure_active_directory.0.managed").Exists(),
check.That(data.ResourceName).Key("role_based_access_control.0.azure_active_directory.0.azure_rbac_enabled").HasValue("false"),
check.That(data.ResourceName).Key("kube_admin_config.#").HasValue("1"),
check.That(data.ResourceName).Key("kube_admin_config_raw").Exists(),
check.That(data.ResourceName).Key("default_node_pool.0.node_count").HasValue("1"),
),
},
data.ImportStep(
"role_based_access_control.0.azure_active_directory.0.server_app_secret",
),
{
Config: r.roleBasedAccessControlAzureConfig(data, ""),
Check: acceptance.ComposeTestCheckFunc(
Expand Down Expand Up @@ -746,8 +765,9 @@ resource "azurerm_kubernetes_cluster" "test" {
enabled = true

azure_active_directory {
tenant_id = var.tenant_id
managed = true
tenant_id = var.tenant_id
managed = true
azure_rbac_enabled = false
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,9 +592,6 @@ func resourceKubernetesCluster() *pluginsdk.Resource {
"azure_rbac_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
// ForceNew can be removed after GA:
// https://docs.microsoft.com/en-us/azure/aks/manage-azure-rbac#limitations
ForceNew: true,
},

"admin_group_object_ids": {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/kubernetes_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ When `managed` is set to `true` the following properties can be specified:

* `admin_group_object_ids` - (Optional) A list of Object IDs of Azure Active Directory Groups which should have Admin Role on the Cluster.

* `azure_rbac_enabled` - (Optional) Is Role Based Access Control based on Azure AD enabled? Changing this forces a new resource to be created.
* `azure_rbac_enabled` - (Optional) Is Role Based Access Control based on Azure AD enabled?

~> **Note:** Azure AD based RBAC is in Public Preview - more information and details on how to opt into the Preview [can be found in this article](https://docs.microsoft.com/en-us/azure/aks/manage-azure-rbac).

Expand Down