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

New Resource: azurerm_kubernetes_cluster_node_pool #4899

Merged
merged 1 commit into from
Nov 21, 2019
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
45 changes: 45 additions & 0 deletions azurerm/internal/services/containers/nodepool_id.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package containers

import (
"fmt"

"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
)

type KubernetesNodePoolID struct {
Name string
ClusterName string
ResourceGroup string

ID azure.ResourceID
}

func ParseKubernetesNodePoolID(id string) (*KubernetesNodePoolID, error) {
clusterId, err := azure.ParseAzureResourceID(id)
if err != nil {
return nil, err
}

resourceGroup := clusterId.ResourceGroup
if resourceGroup == "" {
return nil, fmt.Errorf("%q is missing a Resource Group", id)
}

clusterName := clusterId.Path["managedClusters"]
if clusterName == "" {
return nil, fmt.Errorf("%q is missing the `managedClusters` segment", id)
}

nodePoolName := clusterId.Path["agentPools"]
if nodePoolName == "" {
return nil, fmt.Errorf("%q is missing the `agentPools` segment", id)
}

output := KubernetesNodePoolID{
Name: nodePoolName,
ClusterName: clusterName,
ResourceGroup: resourceGroup,
ID: *clusterId,
}
return &output, nil
}
1 change: 1 addition & 0 deletions azurerm/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ func Provider() terraform.ResourceProvider {
"azurerm_key_vault_secret": resourceArmKeyVaultSecret(),
"azurerm_key_vault": resourceArmKeyVault(),
"azurerm_kubernetes_cluster": resourceArmKubernetesCluster(),
"azurerm_kubernetes_cluster_node_pool": resourceArmKubernetesClusterNodePool(),
"azurerm_kusto_cluster": resourceArmKustoCluster(),
"azurerm_kusto_database": resourceArmKustoDatabase(),
"azurerm_kusto_eventhub_data_connection": resourceArmKustoEventHubDataConnection(),
Expand Down
Loading