Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #64 from equinix/displague-patch-1
Browse files Browse the repository at this point in the history
update GitHub actions to use equinix-labs
  • Loading branch information
displague authored Jun 3, 2024
2 parents cdea3e3 + 173d965 commit 28441ee
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
39 changes: 20 additions & 19 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
tf: [1.0.7]
tf: [1.4]
vsphere:
#- vmware_os: vmware_esxi_6_7
# vcenter_iso: VMware-VCSA-all-6.7.0-14367737.iso
Expand All @@ -34,40 +34,41 @@ jobs:
TF_VAR_esxi_host_count: 2
TF_VAR_esxi_size: "c3.medium.x86"
TF_VAR_router_size: "c3.medium.x86"
TF_VAR_facility: "dc13"
TF_VAR_metro: "dc"
TF_VAR_create_project : false
# TODO only provide this to terraform steps that need it
TF_VAR_auth_token: ${{ secrets.METAL_AUTH_TOKEN }}
TF_VAR_s3_url: ${{ secrets.S3_URL }}
TF_VAR_object_store_bucket_name: ${{ secrets.S3_BUCKET_NAME }}
TF_VAR_s3_access_key: ${{ secrets.S3_ACCESS_KEY }}
TF_VAR_s3_secret_key: ${{ secrets.S3_SECRET_KEY }}
steps:
- name: Checkout from Github
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Add SHORT_SHA env property with commit short sha
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV

- name: Install Terraform
uses: hashicorp/setup-terraform@v1
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TF_VERSION }}
- name: Initialize Terraform, Modules, and Plugins
id: init
run: terraform init -input=false
- id: project
uses: displague/metal-project-action@v0.10.0
env:
METAL_AUTH_TOKEN: ${{ secrets.METAL_AUTH_TOKEN }}
uses: equinix-labs/metal-project-action@v0.14.1
with:
userToken: ${{ secrets.METAL_AUTH_TOKEN }}
# Configure an SSH Agent with a key that can access the project
- name: SSH Agent
run: |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add <(echo $METAL_SSH_PRIVATE_KEY_BASE64 | base64 -d)
ssh-add <(echo ${{ steps.project.outputs.projectSSHPrivateKeyBase64 }} | base64 -d)
- name: Terraform Vars - Cluster Name
run: echo "TF_VAR_vcenter_cluster_name=tfacc-${SHORT_SHA}" >> $GITHUB_ENV
- name: Terraform Vars - Project ID
run: echo "TF_VAR_project_id=${{ steps.project.outputs.projectID }}" >> $GITHUB_ENV
run: |
echo "TF_VAR_project_id=${{ steps.project.outputs.projectID }}" >> $GITHUB_ENV
echo "METAL_AUTH_TOKEN=${{ steps.project.outputs.projectToken }}" >> $GITHUB_ENV # used by Equinix provider when auth_token not specified
echo "TF_VAR_auth_token=${{ steps.project.outputs.projectToken }}" >> $GITHUB_ENV
echo "TF_VAR_s3_url=${{ secrets.S3_URL }}" >> $GITHUB_ENV
echo "TF_VAR_object_store_bucket_name=${{ secrets.S3_BUCKET_NAME }}" >> $GITHUB_ENV
echo "TF_VAR_s3_access_key=${{ secrets.S3_ACCESS_KEY }}" >> $GITHUB_ENV
echo "TF_VAR_s3_secret_key=${{ secrets.S3_SECRET_KEY }}" >> $GITHUB_ENV
- name: Terraform Plan
id: plan
timeout-minutes: 120
Expand All @@ -82,7 +83,7 @@ jobs:
run: terraform destroy -input=false -auto-approve
- name: Project Delete
if: ${{ always() }}
uses: displague/metal-sweeper-action@v0.3.0
env:
METAL_PROJECT_ID: ${{ steps.project.outputs.projectID }}
METAL_AUTH_TOKEN: ${{ secrets.METAL_AUTH_TOKEN }}
uses: equinix-labs/metal-sweeper-action@v0.6.1
with:
authToken: ${{ secrets.METAL_AUTH_TOKEN }}
projectID: ${{ steps.project.outputs.projectID }}
2 changes: 1 addition & 1 deletion .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
tf: [0.14.8]
tf: [1.4]
steps:
- name: Checkout from Github
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
experiments = [module_variable_optional_attrs]
required_version = "~> 1.4"
required_providers {
null = {
source = "hashicorp/null"
Expand Down

0 comments on commit 28441ee

Please sign in to comment.