Container App
Container App. API Version: 2022-03-01.
Example Usage
Create or Update Container App
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var containerApp = new AzureNative.App.ContainerApp("containerApp", new()
{
Configuration = new AzureNative.App.Inputs.ConfigurationArgs
{
Dapr = new AzureNative.App.Inputs.DaprArgs
{
AppPort = 3000,
AppProtocol = "http",
Enabled = true,
},
Ingress = new AzureNative.App.Inputs.IngressArgs
{
CustomDomains = new[]
{
new AzureNative.App.Inputs.CustomDomainArgs
{
BindingType = "SniEnabled",
CertificateId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com",
Name = "www.my-name.com",
},
new AzureNative.App.Inputs.CustomDomainArgs
{
BindingType = "SniEnabled",
CertificateId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com",
Name = "www.my-other-name.com",
},
},
External = true,
TargetPort = 3000,
Traffic = new[]
{
new AzureNative.App.Inputs.TrafficWeightArgs
{
Label = "production",
RevisionName = "testcontainerApp0-ab1234",
Weight = 100,
},
},
},
},
ContainerAppName = "testcontainerApp0",
Location = "East US",
ManagedEnvironmentId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
ResourceGroupName = "rg",
Template = new AzureNative.App.Inputs.TemplateArgs
{
Containers = new[]
{
new AzureNative.App.Inputs.ContainerArgs
{
Image = "repo/testcontainerApp0:v1",
Name = "testcontainerApp0",
Probes = new[]
{
new AzureNative.App.Inputs.ContainerAppProbeArgs
{
HttpGet = new AzureNative.App.Inputs.ContainerAppProbeHttpGetArgs
{
HttpHeaders = new[]
{
new AzureNative.App.Inputs.ContainerAppProbeHttpHeadersArgs
{
Name = "Custom-Header",
Value = "Awesome",
},
},
Path = "/health",
Port = 8080,
},
InitialDelaySeconds = 3,
PeriodSeconds = 3,
Type = "Liveness",
},
},
},
},
Scale = new AzureNative.App.Inputs.ScaleArgs
{
MaxReplicas = 5,
MinReplicas = 1,
Rules = new[]
{
new AzureNative.App.Inputs.ScaleRuleArgs
{
Custom = new AzureNative.App.Inputs.CustomScaleRuleArgs
{
Metadata =
{
{ "concurrentRequests", "50" },
},
Type = "http",
},
Name = "httpscalingrule",
},
},
},
},
});
});
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.app.ContainerApp;
import com.pulumi.azurenative.app.ContainerAppArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var containerApp = new ContainerApp("containerApp", ContainerAppArgs.builder()
.configuration(Map.ofEntries(
Map.entry("dapr", Map.ofEntries(
Map.entry("appPort", 3000),
Map.entry("appProtocol", "http"),
Map.entry("enabled", true)
)),
Map.entry("ingress", Map.ofEntries(
Map.entry("customDomains",
Map.ofEntries(
Map.entry("bindingType", "SniEnabled"),
Map.entry("certificateId", "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com"),
Map.entry("name", "www.my-name.com")
),
Map.ofEntries(
Map.entry("bindingType", "SniEnabled"),
Map.entry("certificateId", "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com"),
Map.entry("name", "www.my-other-name.com")
)),
Map.entry("external", true),
Map.entry("targetPort", 3000),
Map.entry("traffic", Map.ofEntries(
Map.entry("label", "production"),
Map.entry("revisionName", "testcontainerApp0-ab1234"),
Map.entry("weight", 100)
))
))
))
.containerAppName("testcontainerApp0")
.location("East US")
.managedEnvironmentId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube")
.resourceGroupName("rg")
.template(Map.ofEntries(
Map.entry("containers", Map.ofEntries(
Map.entry("image", "repo/testcontainerApp0:v1"),
Map.entry("name", "testcontainerApp0"),
Map.entry("probes", Map.ofEntries(
Map.entry("httpGet", Map.ofEntries(
Map.entry("httpHeaders", Map.ofEntries(
Map.entry("name", "Custom-Header"),
Map.entry("value", "Awesome")
)),
Map.entry("path", "/health"),
Map.entry("port", 8080)
)),
Map.entry("initialDelaySeconds", 3),
Map.entry("periodSeconds", 3),
Map.entry("type", "Liveness")
))
)),
Map.entry("scale", Map.ofEntries(
Map.entry("maxReplicas", 5),
Map.entry("minReplicas", 1),
Map.entry("rules", Map.ofEntries(
Map.entry("custom", Map.ofEntries(
Map.entry("metadata", Map.of("concurrentRequests", "50")),
Map.entry("type", "http")
)),
Map.entry("name", "httpscalingrule")
))
))
))
.build());
}
}
Content copied to clipboard
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:app:ContainerApp testcontainerApp0 /subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/testcontainerApp0
Content copied to clipboard
Properties
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard