Skip to content

Commit 0016d17

Browse files
authored
Merge pull request microsoft#108 from TomArcherMsft/UserStory1981979
User Story 1981979
2 parents 4832632 + 363738b commit 0016d17

File tree

19 files changed

+303
-87
lines changed

19 files changed

+303
-87
lines changed

quickstart/101-attestation-provider/main.tf

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ resource "random_pet" "rg_name" {
33
}
44

55
resource "azurerm_resource_group" "rg" {
6-
name = random_pet.rg_name.id
76
location = var.resource_group_location
7+
name = random_pet.rg_name.id
88
}
99

1010
resource "azurerm_attestation_provider" "corp_attestation" {
11-
name = var.attestation_provider_name
12-
resource_group_name = azurerm_resource_group.rg.name
13-
location = azurerm_resource_group.rg.location
14-
11+
location = azurerm_resource_group.rg.location
12+
name = var.attestation_provider_name
13+
resource_group_name = azurerm_resource_group.rg.name
1514
policy_signing_certificate_data = file(var.policy_file)
1615
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
output "resource_group_name" {
22
value = azurerm_resource_group.rg.name
3-
}
3+
}

quickstart/101-attestation-provider/providers.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ terraform {
66
source = "hashicorp/azurerm"
77
version = "~>2.0"
88
}
9+
random = {
10+
source = "hashicorp/random"
11+
version = "~>3.0"
12+
}
913
}
1014
}
1115

1216
provider "azurerm" {
1317
features {}
14-
}
18+
}
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
variable "resource_group_name_prefix" {
2-
default = "rg"
3-
description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription."
1+
variable "attestation_provider_name" {
2+
default = "attestationprovider007"
3+
}
4+
5+
variable "policy_file" {
6+
default = "~/.certs/cert.pem"
47
}
58

69
variable "resource_group_location" {
710
default = "eastus"
811
description = "Location of the resource group."
912
}
1013

11-
variable "policy_file" {
12-
default = "~/.certs/cert.pem"
13-
}
14-
15-
variable "attestation_provider_name" {
16-
default = "attestationprovider007"
14+
variable "resource_group_name_prefix" {
15+
default = "rg"
16+
description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription."
1717
}

quickstart/101-resource-group/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ resource "random_pet" "rg_name" {
33
}
44

55
resource "azurerm_resource_group" "rg" {
6-
name = random_pet.rg_name.id
76
location = var.resource_group_location
8-
}
7+
name = random_pet.rg_name.id
8+
}

quickstart/101-resource-group/providers.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ terraform {
66
source = "hashicorp/azurerm"
77
version = "~>2.0"
88
}
9+
random = {
10+
source = "hashicorp/random"
11+
version = "~>3.0"
12+
}
913
}
1014
}
1115

1216
provider "azurerm" {
1317
features {}
14-
}
18+
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
variable "resource_group_name_prefix" {
2-
default = "rg"
3-
description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription."
4-
}
5-
61
variable "resource_group_location" {
72
default = "eastus"
83
description = "Location of the resource group."
94
}
5+
6+
variable "resource_group_name_prefix" {
7+
default = "rg"
8+
description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription."
9+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Generate random resource group name
2+
resource "random_pet" "rg_name" {
3+
prefix = var.resource_group_name_prefix
4+
}
5+
6+
resource "azurerm_resource_group" "rg" {
7+
location = var.resource_group_location
8+
name = random_pet.rg_name.id
9+
}
10+
11+
resource "random_id" "log_analytics_workspace_name_suffix" {
12+
byte_length = 8
13+
}
14+
15+
resource "azurerm_log_analytics_workspace" "test" {
16+
location = var.log_analytics_workspace_location
17+
# The WorkSpace name has to be unique across the whole of azure, not just the current subscription/tenant.
18+
name = "${var.log_analytics_workspace_name}-${random_id.log_analytics_workspace_name_suffix.dec}"
19+
resource_group_name = azurerm_resource_group.rg.name
20+
sku = var.log_analytics_workspace_sku
21+
}
22+
23+
resource "azurerm_log_analytics_solution" "test" {
24+
location = azurerm_log_analytics_workspace.test.location
25+
resource_group_name = azurerm_resource_group.rg.name
26+
solution_name = "ContainerInsights"
27+
workspace_name = azurerm_log_analytics_workspace.test.name
28+
workspace_resource_id = azurerm_log_analytics_workspace.test.id
29+
30+
plan {
31+
product = "OMSGallery/ContainerInsights"
32+
publisher = "Microsoft"
33+
}
34+
}
35+
36+
resource "azurerm_kubernetes_cluster" "k8s" {
37+
location = azurerm_resource_group.rg.location
38+
name = var.cluster_name
39+
resource_group_name = azurerm_resource_group.rg.name
40+
dns_prefix = var.dns_prefix
41+
tags = {
42+
Environment = "Development"
43+
}
44+
45+
default_node_pool {
46+
name = "agentpool"
47+
vm_size = "Standard_D2_v2"
48+
node_count = var.agent_count
49+
}
50+
linux_profile {
51+
admin_username = "ubuntu"
52+
53+
ssh_key {
54+
key_data = file(var.ssh_public_key)
55+
}
56+
}
57+
network_profile {
58+
network_plugin = "kubenet"
59+
load_balancer_sku = "standard"
60+
}
61+
service_principal {
62+
client_id = var.aks_service_principal_app_id
63+
client_secret = var.aks_service_principal_client_secret
64+
}
65+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
output "client_certificate" {
2+
value = azurerm_kubernetes_cluster.k8s.kube_config[0].client_certificate
3+
sensitive = true
4+
}
5+
6+
output "client_key" {
7+
value = azurerm_kubernetes_cluster.k8s.kube_config[0].client_key
8+
sensitive = true
9+
}
10+
11+
output "cluster_ca_certificate" {
12+
value = azurerm_kubernetes_cluster.k8s.kube_config[0].cluster_ca_certificate
13+
sensitive = true
14+
}
15+
16+
output "cluster_password" {
17+
value = azurerm_kubernetes_cluster.k8s.kube_config[0].password
18+
sensitive = true
19+
}
20+
21+
output "cluster_username" {
22+
value = azurerm_kubernetes_cluster.k8s.kube_config[0].username
23+
sensitive = true
24+
}
25+
26+
output "host" {
27+
value = azurerm_kubernetes_cluster.k8s.kube_config[0].host
28+
sensitive = true
29+
}
30+
31+
output "kube_config" {
32+
value = azurerm_kubernetes_cluster.k8s.kube_config_raw
33+
sensitive = true
34+
}
35+
36+
output "resource_group_name" {
37+
value = azurerm_resource_group.rg.name
38+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
terraform {
2+
required_version = ">=1.0"
3+
4+
required_providers {
5+
azurerm = {
6+
source = "hashicorp/azurerm"
7+
version = "~>3.0"
8+
}
9+
random = {
10+
source = "hashicorp/random"
11+
version = "~>3.0"
12+
}
13+
}
14+
}
15+
16+
provider "azurerm" {
17+
features {}
18+
}

0 commit comments

Comments
 (0)