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

Add ACI Linux Public IP example #1039

Merged
merged 2 commits into from
Nov 30, 2020
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
54 changes: 54 additions & 0 deletions docs/examples/101/aci-linuxcontainer-public-ip/main.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
param name string
param image string = 'mcr.microsoft.com/azuredocs/aci-helloworld'
param port int = 80
param cpuCores int = 1
param memoryinGb int = 2
param restartPolicy string {
default: 'Always'
allowed: [
'Always'
'Never'
'OnFailure'
]
}
param location string = resourceGroup().location

resource containerGroup 'Microsoft.ContainerInstance/containerGroups@2019-12-01' = {
name: name
location: location
properties: {
containers: [
{
name: name
properties: {
image: image
ports: [
{
port: port
protocol: 'TCP'
}
]
resources: {
requests: {
cpu: cpuCores
memoryInGB: memoryinGb
}
}
}
}
]
osType: 'Linux'
restartPolicy: restartPolicy
ipAddress: {
type: 'Public'
ports: [
{
port: port
protocol: 'TCP'
}
]
}
}
}

output containerIPv4Address string = containerGroup.properties.ipAddress.ip
86 changes: 86 additions & 0 deletions docs/examples/101/aci-linuxcontainer-public-ip/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"type": "string"
},
"image": {
"type": "string",
"defaultValue": "mcr.microsoft.com/azuredocs/aci-helloworld"
},
"port": {
"type": "int",
"defaultValue": 80
},
"cpuCores": {
"type": "int",
"defaultValue": 1
},
"memoryinGb": {
"type": "int",
"defaultValue": 2
},
"restartPolicy": {
"type": "string",
"defaultValue": "Always",
"allowedValues": [
"Always",
"Never",
"OnFailure"
]
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]"
}
},
"functions": [],
"resources": [
{
"type": "Microsoft.ContainerInstance/containerGroups",
"apiVersion": "2019-12-01",
"name": "[parameters('name')]",
"location": "[parameters('location')]",
"properties": {
"containers": [
{
"name": "[parameters('name')]",
"properties": {
"image": "[parameters('image')]",
"ports": [
{
"port": "[parameters('port')]",
"protocol": "TCP"
}
],
"resources": {
"requests": {
"cpu": "[parameters('cpuCores')]",
"memoryInGB": "[parameters('memoryinGb')]"
}
}
}
}
],
"osType": "Linux",
"restartPolicy": "[parameters('restartPolicy')]",
"ipAddress": {
"type": "Public",
"ports": [
{
"port": "[parameters('port')]",
"protocol": "TCP"
}
]
}
}
}
],
"outputs": {
"containerIPv4Address": {
"type": "string",
"value": "[reference(resourceId('Microsoft.ContainerInstance/containerGroups', parameters('name'))).ipAddress.ip]"
}
}
}