diff --git a/README.md b/README.md index 145a9453..18417f7a 100644 --- a/README.md +++ b/README.md @@ -367,7 +367,10 @@ No modules. | [client\_certificate](#output\_client\_certificate) | The `client_certificate` in the `azurerm_kubernetes_cluster`'s `kube_config` block. Base64 encoded public certificate used by clients to authenticate to the Kubernetes cluster. | | [client\_key](#output\_client\_key) | The `client_key` in the `azurerm_kubernetes_cluster`'s `kube_config` block. Base64 encoded private key used by clients to authenticate to the Kubernetes cluster. | | [cluster\_ca\_certificate](#output\_cluster\_ca\_certificate) | The `cluster_ca_certificate` in the `azurerm_kubernetes_cluster`'s `kube_config` block. Base64 encoded public CA certificate used as the root of trust for the Kubernetes cluster. | +| [cluster\_fqdn](#output\_cluster\_fqdn) | The FQDN of the Azure Kubernetes Managed Cluster. | | [cluster\_identity](#output\_cluster\_identity) | The `azurerm_kubernetes_cluster`'s `identity` block. | +| [cluster\_portal\_fqdn](#output\_cluster\_portal\_fqdn) | The FQDN for the Azure Portal resources when private link has been enabled, which is only resolvable inside the Virtual Network used by the Kubernetes Cluster. | +| [cluster\_private\_fqdn](#output\_cluster\_private\_fqdn) | The FQDN for the Kubernetes Cluster when private link has been enabled, which is only resolvable inside the Virtual Network used by the Kubernetes Cluster. | | [generated\_cluster\_private\_ssh\_key](#output\_generated\_cluster\_private\_ssh\_key) | The cluster will use this generated private key as ssh key when `var.public_ssh_key` is empty or null. Private key data in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. | | [generated\_cluster\_public\_ssh\_key](#output\_generated\_cluster\_public\_ssh\_key) | The cluster will use this generated public key as ssh key when `var.public_ssh_key` is empty or null. The fingerprint of the public key data in OpenSSH MD5 hash format, e.g. `aa:bb:cc:....` Only available if the selected private key format is compatible, similarly to `public_key_openssh` and the [ECDSA P224 limitations](https://registry.terraform.io/providers/hashicorp/tls/latest/docs#limitations). | | [host](#output\_host) | The `host` in the `azurerm_kubernetes_cluster`'s `kube_config` block. The Kubernetes cluster server host. | diff --git a/examples/startup/outputs.tf b/examples/startup/outputs.tf index 5c437911..d2be66b2 100644 --- a/examples/startup/outputs.tf +++ b/examples/startup/outputs.tf @@ -47,6 +47,14 @@ output "test_cluster_ca_certificate" { value = module.aks.client_certificate } +output "test_cluster_portal_fqdn" { + value = module.aks.cluster_portal_fqdn +} + +output "test_cluster_private_fqdn" { + value = module.aks.cluster_private_fqdn +} + output "test_host" { sensitive = true value = module.aks.host diff --git a/outputs.tf b/outputs.tf index ee42b717..cfd6298a 100644 --- a/outputs.tf +++ b/outputs.tf @@ -93,11 +93,26 @@ output "cluster_ca_certificate" { value = azurerm_kubernetes_cluster.main.kube_config[0].cluster_ca_certificate } +output "cluster_fqdn" { + description = "The FQDN of the Azure Kubernetes Managed Cluster." + value = azurerm_kubernetes_cluster.main.fqdn +} + output "cluster_identity" { description = "The `azurerm_kubernetes_cluster`'s `identity` block." value = try(azurerm_kubernetes_cluster.main.identity[0], null) } +output "cluster_portal_fqdn" { + description = "The FQDN for the Azure Portal resources when private link has been enabled, which is only resolvable inside the Virtual Network used by the Kubernetes Cluster." + value = azurerm_kubernetes_cluster.main.portal_fqdn +} + +output "cluster_private_fqdn" { + description = "The FQDN for the Kubernetes Cluster when private link has been enabled, which is only resolvable inside the Virtual Network used by the Kubernetes Cluster." + value = azurerm_kubernetes_cluster.main.private_fqdn +} + output "generated_cluster_private_ssh_key" { description = "The cluster will use this generated private key as ssh key when `var.public_ssh_key` is empty or null. Private key data in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format." sensitive = true diff --git a/test/e2e/terraform_aks_test.go b/test/e2e/terraform_aks_test.go index 1a4e52d5..d07ef740 100644 --- a/test/e2e/terraform_aks_test.go +++ b/test/e2e/terraform_aks_test.go @@ -26,9 +26,17 @@ func TestExamplesStartup(t *testing.T) { aksId, ok := output["test_aks_id"].(string) assert.True(t, ok) assert.Regexp(t, regexp.MustCompile("/subscriptions/.+/resourceGroups/.+/providers/Microsoft.ContainerService/managedClusters/.+"), aksId) + assertOutputNotEmpty(t, output, "test_cluster_portal_fqdn") + assertOutputNotEmpty(t, output, "test_cluster_private_fqdn") }) } +func assertOutputNotEmpty(t *testing.T, output test_helper.TerraformOutput, name string) { + o, ok := output[name].(string) + assert.True(t, ok) + assert.NotEqual(t, "", o) +} + func TestExamplesWithoutMonitor(t *testing.T) { var vars map[string]interface{} managedIdentityId := os.Getenv("MSI_ID")