Skip to content

Commit

Permalink
add inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Silvija Tovernic committed Sep 27, 2024
1 parent b8db0c4 commit b000e41
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 10 deletions.
37 changes: 30 additions & 7 deletions .github/workflows/pulumi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,30 @@ on:
options:
- dev
default: dev
image_uri:
az_number:
type: string
description: Number of Availability Zones
default: "2"
container_image_uri:
type: string
description: Image URI
default: nginx
default: "nginx"
container_cpu:
type: string
description: Container CPU
default: "256"
container_memory:
type: string
description: Container Memory
default: "512"
container_port:
type: string
description: Container Port
default: "80"
host_port:
type: string
description: Container Port
default: "80"

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand All @@ -24,11 +44,12 @@ env:

AWS_RESOURCE_PREFIX: "pulumi-${{ inputs.environment }}"
AWS_RESOURCE_SHORT_PREFIX: "p-${{ inputs.environment }}" # Max 6 chars
AWS_AZ_NUMBER: "2"
CONTAINER_IMAGE_URI: ${{ inputs.image_uri }}
CONTAINER_CPU: "256"
CONTAINER_MEMORY: "512"
CONTAINER_PORT: "80"
AWS_AZ_NUMBER: ${{ inputs.az_number }}
CONTAINER_IMAGE_URI: ${{ inputs.container_image_uri }}
CONTAINER_CPU: ${{ inputs.container_cpu }}
CONTAINER_MEMORY: ${{ inputs.container_memory }}
CONTAINER_PORT: ${{ inputs.container_port }}
HOST_PORT: ${{ inputs.host_port }}


jobs:
Expand Down Expand Up @@ -69,6 +90,7 @@ jobs:
pulumi config set cpu $CONTAINER_CPU
pulumi config set memory $CONTAINER_MEMORY
pulumi config set container_port $CONTAINER_PORT
pulumi config set host_port $HOST_PORT
working-directory: pulumi

- name: Pulumi Preview
Expand Down Expand Up @@ -120,6 +142,7 @@ jobs:
pulumi config set cpu $CONTAINER_CPU
pulumi config set memory $CONTAINER_MEMORY
pulumi config set container_port $CONTAINER_PORT
pulumi config set host_port $HOST_PORT
working-directory: pulumi

- name: Pulumi Deploy Infrastructure
Expand Down
1 change: 1 addition & 0 deletions pulumi/Pulumi.original.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ config:
cpu: 256
memory: 512
container_port: 80
host_port: 80
6 changes: 3 additions & 3 deletions pulumi/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
cpu = config.require("cpu")
memory = config.require("memory")
container_port = config.require_int("container_port")

host_port = config.require_int("host_port")

# Functions
def prefixed(name):
Expand Down Expand Up @@ -242,8 +242,8 @@ def create_tags(name):
'name': 'app',
'image': image_uri,
'portMappings': [{
'containerPort': 80,
'hostPort': 80,
'containerPort': container_port,
'hostPort': host_port,
'protocol': 'tcp'
}]
}]),
Expand Down

0 comments on commit b000e41

Please sign in to comment.