Skip to content

Commit cdb5eac

Browse files
feat: adapt variables
1 parent bbe8ef4 commit cdb5eac

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

.github/workflows/terraform-deploy.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ on:
1212
required: true
1313
type: string
1414
aws_session_token:
15-
description: "AWS Session Token from Learner Lab (if required)"
16-
required: false
15+
description: "AWS Session Token from Learner Lab"
16+
required: true
1717
type: string
1818
push:
1919
branches:
@@ -41,9 +41,9 @@ jobs:
4141
cd infrastructure/terraform
4242
terraform apply -auto-approve
4343
env:
44-
AWS_ACCESS_KEY_ID: ${{ github.event.inputs.aws_access_key_id }}
45-
AWS_SECRET_ACCESS_KEY: ${{ github.event.inputs.aws_secret_access_key }}
46-
AWS_SESSION_TOKEN: ${{ github.event.inputs.aws_session_token }}
44+
TF_VAR_aws_access_key: ${{ github.event.inputs.aws_access_key_id }}
45+
TF_VAR_aws_secret_key: ${{ github.event.inputs.aws_secret_access_key }}
46+
TF_VAR_aws_session_token: ${{ github.event.inputs.aws_session_token }}
4747

4848
- name: Get EC2 Public IP
4949
id: get-ip

infrastructure/terraform/main.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
provider "aws" {
2-
region = var.aws_region
2+
region = var.aws_region
3+
access_key = var.aws_access_key
4+
secret_key = var.aws_secret_key
5+
token = var.aws_session_token
36
}
47

58
# Create a security group

infrastructure/terraform/variables.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ variable "aws_region" {
44
default = "us-east-1"
55
}
66

7+
variable "aws_access_key" {
8+
description = "AWS access key"
9+
type = string
10+
sensitive = true
11+
}
12+
13+
variable "aws_secret_key" {
14+
description = "AWS secret key"
15+
type = string
16+
sensitive = true
17+
}
18+
19+
variable "aws_session_token" {
20+
description = "AWS session token"
21+
type = string
22+
sensitive = true
23+
}
24+
725
variable "ami_id" {
826
description = "AMI ID for the EC2 instance"
927
type = string

0 commit comments

Comments
 (0)