diff --git a/.github/workflows/promote-enterprisedocs-staging-to-production.yml b/.github/workflows/promote-enterprisedocs-staging-to-production.yml index c18395205..451577573 100644 --- a/.github/workflows/promote-enterprisedocs-staging-to-production.yml +++ b/.github/workflows/promote-enterprisedocs-staging-to-production.yml @@ -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 diff --git a/.github/workflows/promote-staging-to-production.yml b/.github/workflows/promote-staging-to-production.yml index 0876f69f5..0b91fc2ec 100644 --- a/.github/workflows/promote-staging-to-production.yml +++ b/.github/workflows/promote-staging-to-production.yml @@ -1,4 +1,3 @@ - # Terraform Action to promote content and redirects from staging to production name: Promote Docs Staging to Production on: @@ -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 @@ -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 \ No newline at end of file diff --git a/.github/workflows/send-docs-redirects-to-staging.yml b/.github/workflows/send-docs-redirects-to-staging.yml index 251e02653..aa0095778 100644 --- a/.github/workflows/send-docs-redirects-to-staging.yml +++ b/.github/workflows/send-docs-redirects-to-staging.yml @@ -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 @@ -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: @@ -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' }} @@ -105,4 +112,4 @@ jobs: - name: Terraform Apply if: ${{ github.event_name == 'push' }} - run: terraform apply -auto-approve + run: terraform apply -auto-approve \ No newline at end of file diff --git a/.github/workflows/send-enterprise-redirects-to-staging.yml b/.github/workflows/send-enterprise-redirects-to-staging.yml index 27866366b..77546c8e6 100644 --- a/.github/workflows/send-enterprise-redirects-to-staging.yml +++ b/.github/workflows/send-enterprise-redirects-to-staging.yml @@ -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 @@ -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: @@ -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 \ No newline at end of file diff --git a/scripts/redirect_creation/main.tf b/scripts/redirect_creation/main.tf index e4d92cd18..caa4cf203 100644 --- a/scripts/redirect_creation/main.tf +++ b/scripts/redirect_creation/main.tf @@ -7,6 +7,7 @@ terraform { data "terraform_remote_state" "state" { backend = "remote" config = { + hostname = "spacelift.io" organization = "liquibase" workspaces = { name = "liquibase-${var.env}" diff --git a/scripts/redirect_creation/prod.remote.tfbackend b/scripts/redirect_creation/prod.remote.tfbackend index 747384de8..76d57aa7b 100644 --- a/scripts/redirect_creation/prod.remote.tfbackend +++ b/scripts/redirect_creation/prod.remote.tfbackend @@ -1,3 +1,4 @@ #Selecting the prod TF Cloud workspace workspaces { name = "liquibase-docs-prod" } organization = "liquibase" +hostname = "spacelift.io" \ No newline at end of file diff --git a/scripts/redirect_creation/staging.remote.tfbackend b/scripts/redirect_creation/staging.remote.tfbackend index fd8666f7a..6e4104ae1 100644 --- a/scripts/redirect_creation/staging.remote.tfbackend +++ b/scripts/redirect_creation/staging.remote.tfbackend @@ -1,3 +1,4 @@ #Selecting the staging TF Cloud workspace workspaces { name = "liquibase-docs-staging" } organization = "liquibase" +hostname = "spacelift.io" \ No newline at end of file