-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
azure-container-apps.pp
106 lines (95 loc) 路 2.33 KB
/
azure-container-apps.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
config sqlAdmin string {
default = "pulumi"
}
config retentionInDays int {
default = 30
}
sharedKey = secret(invoke("azure-native:operationalinsights:getSharedKeys", {
resourceGroupName = resourceGroup.name,
workspaceName = workspace.name
}).primarySharedKey)
adminRegistryCreds = invoke("azure-native:containerregistry:listRegistryCredentials", {
resourceGroupName = resourceGroup.name,
registryName = registry.name
})
adminUsername = adminRegistryCreds.username
adminPasswords = secret(adminRegistryCreds.passwords)
resource resourceGroup "azure-native:resources:ResourceGroup" {
__logicalName = "resourceGroup"
}
resource workspace "azure-native:operationalinsights:Workspace" {
__logicalName = "workspace"
resourceGroupName = resourceGroup.name
sku = {
name = "PerGB2018"
}
retentionInDays = retentionInDays
}
resource kubeEnv "azure-native:web:KubeEnvironment" {
__logicalName = "kubeEnv"
resourceGroupName = resourceGroup.name
environmentType = "Managed"
appLogsConfiguration = {
destination = "log-analytics",
logAnalyticsConfiguration = {
customerId = workspace.customerId,
sharedKey = sharedKey
}
}
}
resource registry "azure-native:containerregistry:Registry" {
__logicalName = "registry"
resourceGroupName = resourceGroup.name
sku = {
name = "Basic"
}
adminUserEnabled = true
}
resource provider "pulumi:providers:docker" {
__logicalName = "provider"
registryAuth = [{
address = registry.loginServer,
username = adminUsername,
password = adminPasswords[0].value
}]
}
resource myImage "docker:index/registryImage:RegistryImage" {
__logicalName = "myImage"
name = "${registry.loginServer}/node-app:v1.0.0"
build = {
context = "${cwd()}/node-app"
}
options {
provider = provider
}
}
resource containerapp "azure-native:web:ContainerApp" {
__logicalName = "containerapp"
resourceGroupName = resourceGroup.name
kubeEnvironmentId = kubeEnv.id
configuration = {
ingress = {
external = true,
targetPort = 80
},
registries = [{
server = registry.loginServer,
username = adminUsername,
passwordSecretRef = "pwd"
}],
secrets = [{
name = "pwd",
value = adminPasswords[0].value
}]
}
template = {
containers = [{
name = "myapp",
image = myImage.name
}]
}
}
output endpoint {
__logicalName = "endpoint"
value = "https://${containerapp.configuration.ingress.fqdn}"
}