Skip to content

Commit fda904e

Browse files
committed
feat: Add assignPublicIp Input
1 parent b1148de commit fda904e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ inputs:
5858
run-task-started-by:
5959
description: "A name to use for the startedBy tag when running a task outside of a service. Will default to 'GitHub-Actions'."
6060
required: false
61+
run-task-assign-public-ip:
62+
description: "A boolean indicating whether to assign a public IP to the task."
63+
required: false
6164
wait-for-task-stopped:
6265
description: 'Whether to wait for the task to stop when running it outside of a service. Will default to not wait.'
6366
required: false

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes) {
3030
const launchType = core.getInput('run-task-launch-type', { required: false }) || 'FARGATE';
3131
const subnetIds = core.getInput('run-task-subnets', { required: false }) || '';
3232
const securityGroupIds = core.getInput('run-task-security-groups', { required: false }) || '';
33+
const assignPublicIp = core.getInput('run-task-assign-public-ip', { required: false }) || '';
3334
const containerOverrides = JSON.parse(core.getInput('run-task-container-overrides', { required: false }) || '[]');
3435
let awsvpcConfiguration = {}
3536

@@ -41,6 +42,10 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes) {
4142
awsvpcConfiguration["securityGroups"] = securityGroupIds.split(',')
4243
}
4344

45+
if (assignPublicIp != "") {
46+
awsvpcConfiguration["assignPublicIp"] = assignPublicIp ? "ENABLED" : "DISABLED"
47+
}
48+
4449
const runTaskResponse = await ecs.runTask({
4550
startedBy: startedBy,
4651
cluster: clusterName,

0 commit comments

Comments
 (0)