Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tfc backend #2

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,28 @@ jobs:
with:
# terraform_version: 0.13.0:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2

- name: Test var
id: testvar
run: echo "${{ vars.TF_VAR_STATE_BUCKET }}"

- name: Download backend
id: s3d
run: aws s3api get-object --bucket ${{ vars.TF_VAR_STATE_BUCKET }} --key backend.personal.tfvars backend.personal.tfvars

- name: Terraform Format
id: fmt
run: terraform fmt -check

- name: Terraform Init
id: init
run: terraform init
run: terraform init -backend-config="backend.personal.tfvars"

- name: Terraform Validate
id: validate
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ crash.*.log
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json
# *.tfvars
# *.tfvars.json

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
Expand Down
13 changes: 8 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ terraform {
}
}
required_version = ">= 1.1.0"
# cloud {
# organization = "cornebester"

cloud {
organization = "REPLACE_ME"
# workspaces {
# name = "gh-actions-demo"
# }
# }

workspaces {
name = "gh-actions-demo"
}
backend "s3" {
bucket = var.state_bucket
}
}

Expand Down