Skip to content

Commit

Permalink
Bump tf module and pass auth keys from secrets on deploy
Browse files Browse the repository at this point in the history
This will create a new secret in AWS SecretsManager
  • Loading branch information
aymanbagabas committed Aug 13, 2021
1 parent 6d7752b commit 89d2aa8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
AWS_DEFAULT_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SMOOTHIE_REPO_KEYS: "${{ secrets.SMOOTHIE_REPO_KEYS }}"

steps:
- name: Install Go
Expand Down Expand Up @@ -72,9 +73,10 @@ jobs:
id: tfvars
run: |
TF_VARS=$(cat <<EOF
-var "environment=$ENVIRONMENT" \
-var "aws_region=$AWS_DEFAULT_REGION" \
-var "app_image=$CONTAINER_REPO:$GITHUB_SHA-snapshot"
-var environment="$ENVIRONMENT" \
-var aws_region="$AWS_DEFAULT_REGION" \
-var app_image="$CONTAINER_REPO:$GITHUB_SHA-snapshot" \
-var authorization_keys="$(echo -n $SMOOTHIE_REPO_KEYS)"
EOF
)
echo "::set-output name=vars::$TF_VARS"
Expand Down
7 changes: 6 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ variable "force_new_deployment" {
default = false
}

variable "authorization_keys" {
default = ""
}

module "smoothie" {
/* source = "../terraform-aws-smoothie" */
source = "app.terraform.io/charm/smoothie/aws"
version = "0.1.4"
version = "0.2.0"

environment = var.environment
aws_region = var.aws_region
Expand All @@ -37,4 +41,5 @@ module "smoothie" {
fargate_memory = "2048"
force_new_deployment = var.force_new_deployment
app_use_default_ssh_port = true
authorization_keys = var.authorization_keys
}

0 comments on commit 89d2aa8

Please sign in to comment.