-
Notifications
You must be signed in to change notification settings - Fork 807
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #225 from TomArcherMsft/UserStory90135
User Story 90135
- Loading branch information
Showing
8 changed files
with
151 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Create Azure AD App Registration | ||
resource "azuread_application" "app" { | ||
display_name = "my-app" | ||
owners = [local.current_user_id] | ||
} | ||
|
||
# Create Service Principal | ||
resource "azuread_service_principal" "app" { | ||
application_id = azuread_application.app.application_id | ||
app_role_assignment_required = true | ||
owners = [local.current_user_id] | ||
} | ||
|
||
# Create Service Principal password | ||
resource "azuread_service_principal_password" "app" { | ||
service_principal_id = azuread_service_principal.app.id | ||
} | ||
|
||
# Sleep for 30 seconds to allow for propagation | ||
# of the Service Principal creation before attempting | ||
# to create the AKS cluster. | ||
resource "time_sleep" "wait_30_seconds" { | ||
create_duration = "30s" | ||
|
||
depends_on = [azuread_service_principal_password.app] | ||
} | ||
|
||
# Output the Service Principal and password | ||
output "sp" { | ||
value = azuread_service_principal.app.id | ||
sensitive = true | ||
} | ||
|
||
output "sp_password" { | ||
value = azuread_service_principal_password.app.value | ||
sensitive = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
resource "random_pet" "ssh_key_name" { | ||
prefix = "ssh" | ||
separator = "" | ||
} | ||
|
||
resource "azapi_resource" "ssh_public_key" { | ||
type = "Microsoft.Compute/sshPublicKeys@2022-11-01" | ||
name = random_pet.ssh_key_name.id | ||
location = "westus3" | ||
parent_id = azurerm_resource_group.rg.id | ||
} | ||
|
||
resource "azapi_resource_action" "ssh_public_key_gen" { | ||
type = "Microsoft.Compute/sshPublicKeys@2022-11-01" | ||
resource_id = azapi_resource.ssh_public_key.id | ||
action = "generateKeyPair" | ||
method = "POST" | ||
|
||
response_export_values = ["publicKey"] | ||
} | ||
|
||
output "key_data" { | ||
value = azapi_resource.ssh_public_key.body | ||
sensitive = true | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,44 @@ | ||
variable "agent_count" { | ||
default = 3 | ||
} | ||
|
||
# The following two variable declarations are placeholder references. | ||
# Set the values for these variable in terraform.tfvars | ||
variable "aks_service_principal_app_id" { | ||
default = "" | ||
} | ||
|
||
variable "aks_service_principal_client_secret" { | ||
default = "" | ||
variable "resource_group_location" { | ||
type = string | ||
default = "eastus" | ||
description = "Location of the resource group." | ||
} | ||
|
||
variable "cluster_name" { | ||
default = "k8stest" | ||
variable "resource_group_name_prefix" { | ||
type = string | ||
default = "rg" | ||
description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription." | ||
} | ||
|
||
variable "dns_prefix" { | ||
default = "k8stest" | ||
variable "node_count" { | ||
type = number | ||
description = "The initial quantity of nodes for the node pool." | ||
default = 3 | ||
} | ||
|
||
# Refer to https://azure.microsoft.com/global-infrastructure/services/?products=monitor for available Log Analytics regions. | ||
# For available Log Analytics regions, refer to: | ||
# https://azure.microsoft.com/global-infrastructure/services/?products=monitor | ||
variable "log_analytics_workspace_location" { | ||
default = "eastus" | ||
} | ||
|
||
variable "log_analytics_workspace_name" { | ||
default = "testLogAnalyticsWorkspaceName" | ||
type = string | ||
default = "eastus" | ||
description = "Location of the Log Analytics workspace." | ||
} | ||
|
||
# Refer to https://azure.microsoft.com/pricing/details/monitor/ for Log Analytics pricing | ||
# For Log Analytics pricing, refer to: | ||
# https://azure.microsoft.com/pricing/details/monitor | ||
variable "log_analytics_workspace_sku" { | ||
default = "PerGB2018" | ||
} | ||
type = string | ||
description = "The SKU of the Log Analytics workspace. Choose from: Free, PerNode, Premium, Standard, Standalone, Unlimited, CapacityReservation, PerGB2018" | ||
default = "PerGB2018" | ||
|
||
variable "resource_group_location" { | ||
default = "eastus" | ||
description = "Location of the resource group." | ||
validation { | ||
condition = contains(["Free", "PerNode", "Premium", "Standard", "Standalone", "Unlimited", "CapacityReservation", "PerGB2018"], var.log_analytics_workspace_sku) | ||
error_message = "The Log Analytics workspace SKU must be one of the following: Free, PerNode, Premium, Standard, Standalone, Unlimited, CapacityReservation, PerGB2018" | ||
} | ||
} | ||
|
||
variable "resource_group_name_prefix" { | ||
default = "rg" | ||
description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription." | ||
} | ||
|
||
variable "ssh_public_key" { | ||
default = "~/.ssh/id_rsa.pub" | ||
} | ||
variable "msi_id" { | ||
type = string | ||
description = "The Managed Service Identity ID used to create the service principal. If this value is null (the default), the AzureRM provider configuration Object ID is used.." | ||
default = null | ||
} |