Skip to content

Commit

Permalink
Add required properties to container-aws-* templates (#692)
Browse files Browse the repository at this point in the history
  • Loading branch information
cnunciato authored Nov 28, 2023
1 parent b1d907e commit 5684bee
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions container-aws-csharp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
{
RepositoryUrl = repo.Url,
Context = "./app",
Platform = "linux/amd64",
});

var service = new Awsx.Ecs.FargateService("service", new()
Expand All @@ -32,6 +33,7 @@
{
Container = new Awsx.Ecs.Inputs.TaskDefinitionContainerDefinitionArgs
{
Name = "app",
Image = image.ImageUri,
Cpu = cpu,
Memory = memory,
Expand Down
2 changes: 2 additions & 0 deletions container-aws-go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func main() {
image, err := ecrx.NewImage(ctx, "image", &ecr.ImageArgs{
RepositoryUrl: repo.Url,
Context: pulumi.String("./app"),
Platform: pulumi.String("linux/amd64"),
})
if err != nil {
return err
Expand All @@ -61,6 +62,7 @@ func main() {
AssignPublicIp: pulumi.Bool(true),
TaskDefinitionArgs: &ecsx.FargateServiceTaskDefinitionArgs{
Container: &ecsx.TaskDefinitionContainerDefinitionArgs{
Name: pulumi.String("app"),
Image: image.ImageUri,
Cpu: pulumi.Int(cpu),
Memory: pulumi.Int(memory),
Expand Down
4 changes: 3 additions & 1 deletion container-aws-python/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
image = awsx.ecr.Image(
"image",
repository_url=repo.url,
path="./app")
context="./app",
platform="linux/amd64")

# Deploy an ECS Service on Fargate to host the application container
service = awsx.ecs.FargateService(
Expand All @@ -31,6 +32,7 @@
assign_public_ip=True,
task_definition_args=awsx.ecs.FargateServiceTaskDefinitionArgs(
container=awsx.ecs.TaskDefinitionContainerDefinitionArgs(
name="app",
image=image.image_uri,
cpu=cpu,
memory=memory,
Expand Down
1 change: 1 addition & 0 deletions container-aws-typescript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const repo = new awsx.ecr.Repository("repo", {
const image = new awsx.ecr.Image("image", {
repositoryUrl: repo.url,
context: "./app",
platform: "linux/amd64",
});

// Deploy an ECS Service on Fargate to host the application container
Expand Down
10 changes: 9 additions & 1 deletion container-aws-yaml/Pulumi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,29 @@ config:
default: 128

resources:

# An ECS cluster to deploy into
cluster:
type: aws:ecs:Cluster

# An ALB to serve the container endpoint to the internet
loadbalancer:
type: awsx:lb:ApplicationLoadBalancer

# An ECR repository to store our application's container image
repo:
type: awsx:ecr:Repository
properties:
forceDelete: true

# Build and publish our application's container image from ./app to the ECR repository
image:
type: awsx:ecr:Image
properties:
repositoryUrl: ${repo.url}
path: ./app
context: ./app
platform: linux/amd64

# Deploy an ECS Service on Fargate to host the application container
service:
type: awsx:ecs:FargateService
Expand All @@ -51,6 +57,7 @@ resources:
assignPublicIp: true
taskDefinitionArgs:
container:
name: app
image: ${image.imageUri}
cpu: ${cpu}
memory: ${memory}
Expand All @@ -60,5 +67,6 @@ resources:
targetGroup: ${loadbalancer.defaultTargetGroup}

outputs:

# The URL at which the container's HTTP endpoint will be available
url: http://${loadbalancer.loadBalancer.dnsName}

0 comments on commit 5684bee

Please sign in to comment.