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

DAT-16244: changes as per spacelift migration #207

Closed
wants to merge 14 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@ jobs:
runs-on: ubuntu-20.04
env:
TF_VAR_env: "prod"
SPACELIFT_API_KEY_ENDPOINT: ${{ secrets.SPACELIFT_API_KEY_ENDPOINT }}
SPACELIFT_API_KEY_ID: ${{ secrets.SPACELIFT_API_KEY_ID }}
SPACELIFT_API_KEY_SECRET: ${{ secrets.SPACELIFT_API_KEY_SECRET }}
defaults:
run:
working-directory: scripts/redirect_creation
steps:
- uses: actions/checkout@v3

- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/promote-staging-to-production.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Terraform Action to promote content and redirects from staging to production
name: Promote Docs Staging to Production
on:
Expand Down Expand Up @@ -28,16 +27,14 @@ jobs:
runs-on: ubuntu-20.04
env:
TF_VAR_env: "prod"
SPACELIFT_API_KEY_ENDPOINT: ${{ secrets.SPACELIFT_API_KEY_ENDPOINT }}
SPACELIFT_API_KEY_ID: ${{ secrets.SPACELIFT_API_KEY_ID }}
SPACELIFT_API_KEY_SECRET: ${{ secrets.SPACELIFT_API_KEY_SECRET }}
defaults:
run:
working-directory: scripts/redirect_creation
steps:
- uses: actions/checkout@v3

- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
Expand All @@ -51,4 +48,4 @@ jobs:
run: terraform init -backend-config=$TF_VAR_env.remote.tfbackend

- name: Terraform Apply
run: terraform apply -auto-approve
run: terraform apply -auto-approve
21 changes: 14 additions & 7 deletions .github/workflows/send-docs-redirects-to-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ jobs:
runs-on: ubuntu-20.04
env:
TF_VAR_env: "staging"
SPACELIFT_API_KEY_ENDPOINT: ${{ secrets.SPACELIFT_API_KEY_ENDPOINT }}
SPACELIFT_API_KEY_ID: ${{ secrets.SPACELIFT_API_KEY_ID }}
SPACELIFT_API_KEY_SECRET: ${{ secrets.SPACELIFT_API_KEY_SECRET }}
SPACELIFT_API_KEY: ${{ secrets.SPACELIFT_API_KEY }}
defaults:
run:
working-directory: scripts/redirect_creation
Expand All @@ -26,11 +30,6 @@ jobs:
with:
ref: ${{ github.event.inputs.branch }}

- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
Expand All @@ -43,9 +42,17 @@ jobs:
id: fmt
run: terraform fmt

- name: Set up credentials
run: |
echo "credentials \"spacelift.io\" { \
token = \"${{ secrets.SPACELIFT_API_TOKEN }}\"}" > /home/runner/.terraformrc
#run: echo "credentials \"${{ secrets.SPACELIFT_API_TOKEN }}\"" > credentials.tfrc.json

- name: Terraform Init
id: init
run: terraform init -backend-config=$TF_VAR_env.remote.tfbackend
run: |
terraform init -backend-config=staging.remote.tfbackend -reconfigure


- name: Terraform Validate
if: ${{ github.event_name == 'pull_request' }}
Expand Down Expand Up @@ -105,4 +112,4 @@ jobs:

- name: Terraform Apply
if: ${{ github.event_name == 'push' }}
run: terraform apply -auto-approve
run: terraform apply -auto-approve
10 changes: 4 additions & 6 deletions .github/workflows/send-enterprise-redirects-to-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
runs-on: ubuntu-20.04
env:
TF_VAR_env: "staging"
SPACELIFT_API_KEY_ENDPOINT: ${{ secrets.SPACELIFT_API_KEY_ENDPOINT }}
SPACELIFT_API_KEY_ID: ${{ secrets.SPACELIFT_API_KEY_ID }}
SPACELIFT_API_KEY_SECRET: ${{ secrets.SPACELIFT_API_KEY_SECRET }}
defaults:
run:
working-directory: scripts/redirect_creation
Expand All @@ -23,11 +26,6 @@ jobs:
with:
ref: ${{ github.event.inputs.branch }}

- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
Expand Down Expand Up @@ -102,4 +100,4 @@ jobs:

- name: Terraform Apply
if: ${{ github.event_name == 'push' }}
run: terraform apply -target=aws_s3_object.enterprise_redirects -auto-approve
run: terraform apply -target=aws_s3_object.enterprise_redirects -auto-approve
1 change: 1 addition & 0 deletions scripts/redirect_creation/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ terraform {
data "terraform_remote_state" "state" {
backend = "remote"
config = {
hostname = "spacelift.io"
organization = "liquibase"
workspaces = {
name = "liquibase-${var.env}"
Expand Down
1 change: 1 addition & 0 deletions scripts/redirect_creation/prod.remote.tfbackend
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#Selecting the prod TF Cloud workspace
workspaces { name = "liquibase-docs-prod" }
organization = "liquibase"
hostname = "spacelift.io"
1 change: 1 addition & 0 deletions scripts/redirect_creation/staging.remote.tfbackend
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#Selecting the staging TF Cloud workspace
workspaces { name = "liquibase-docs-staging" }
organization = "liquibase"
hostname = "spacelift.io"
Loading