Skip to content

Commit 972e711

Browse files
committed
Add support for a key pair
1 parent a1a6220 commit 972e711

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/aws.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ async function startEc2Instance(label, githubRegistrationToken) {
2929
SecurityGroupIds: [config.input.securityGroupId],
3030
IamInstanceProfile: { Name: config.input.iamRoleName },
3131
TagSpecifications: config.tagSpecifications,
32+
KeyName: config.input.keyPairName
3233
};
3334

3435
try {

src/config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class Config {
1313
label: core.getInput('label'),
1414
ec2InstanceId: core.getInput('ec2-instance-id'),
1515
iamRoleName: core.getInput('iam-role-name'),
16+
keyPairName: core.getInput('key-pair-name')
1617
};
1718

1819
const tags = JSON.parse(core.getInput('aws-resource-tags'));
@@ -41,6 +42,10 @@ class Config {
4142
throw new Error(`The 'github-token' input is not specified`);
4243
}
4344

45+
if (!this.input.keyPairName) {
46+
throw new Error(`Must specify a key pair name`);
47+
}
48+
4449
if (this.input.mode === 'start') {
4550
if (!this.input.ec2ImageId || !this.input.ec2InstanceType || !this.input.subnetId || !this.input.securityGroupId) {
4651
throw new Error(`Not all the required inputs are provided for the 'start' mode`);

0 commit comments

Comments
 (0)