diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 23ac0fa..a4bb40b 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -10,16 +10,17 @@ jobs: strategy: matrix: python-version: - - 3.6.7 # Match the version on the gateway node + - 3.12 # Match the version on the gateway node steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - id: fmt_and_lint run: | - pip install black==21.4b2 pylama + pip install black pylama black --check --diff . pylama diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index d268597..4b7deae 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -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 @@ -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 @@ -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 }} diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index 64fc216..f664f29 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -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 diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl deleted file mode 100644 index 837bf4a..0000000 --- a/.terraform.lock.hcl +++ /dev/null @@ -1,137 +0,0 @@ -# This file is maintained automatically by "terraform init". -# Manual edits may be lost in future updates. - -provider "registry.terraform.io/equinix/equinix" { - version = "1.14.1" - constraints = "~> 1.14" - hashes = [ - "h1:k8eFYlT/bsI54TQOG84bzqWelZK8fNzvYIkJwd+cEnM=", - "zh:1b478c206ae88a3bfd4ab376ce19e5c577b8f3389005cc159bb041b6dc9e00b1", - "zh:24b793281076cd57ac42665d919406ba4077768db01b0f1f1e7daff814159a49", - "zh:35d2902215d27592ff6cbbe478910aa40474ee0f0875a42ea06a11b32cae4ff7", - "zh:3ca24f4c577042ef4232105eb92b18fd83e59e1a99955507526a7a96edcd83de", - "zh:4f0ef4b10eca14fc091be18547d125fdf687b290ec3925bfcb3006033a6d8155", - "zh:50fe98f600a1cb15fb1b7153a5f70a2432e2920b9d99498a327db7c81fdbaaec", - "zh:8a1619f0fb5aa0eebec1133a2e7795da503425252300ffd286587a91f1316bd5", - "zh:8baf418e8acb130e32ab0402bcc2545fd1d0ac8ad3d6d337f51acb70eb99719d", - "zh:9062cdbbd2bedf1ad1ace95eca13f962d6dd8deb6db2e25e153027098e1aa985", - "zh:bc9160faff9ddb9e532e6ae7c79f8e66163ba19eadc34b0975a0c7b0084db02b", - "zh:bf67edb2daae4fe6728e4f879aecd9b4130beb82c0ad79e4cd2b159b48c93c02", - "zh:c125746c76a8580a403c56b69d702d0831523cfea3b7a3889ffc48835b7403ce", - "zh:c6fe46df23138c80d70cec18a791f02ccdf5c6c0b77a3f85964c0ddd33ad0025", - "zh:dd50a69bb647668a5255db0d01e655dc708b1e3a0ea780db2efb2418a6599ccd", - ] -} - -provider "registry.terraform.io/hashicorp/external" { - version = "2.3.1" - hashes = [ - "h1:9rJggijNdRdFk//ViQPGZdK0xu9XU/9qBDijNsZJMg0=", - "zh:001e2886dc81fc98cf17cf34c0d53cb2dae1e869464792576e11b0f34ee92f54", - "zh:2eeac58dd75b1abdf91945ac4284c9ccb2bfb17fa9bdb5f5d408148ff553b3ee", - "zh:2fc39079ba61411a737df2908942e6970cb67ed2f4fb19090cd44ce2082903dd", - "zh:472a71c624952cff7aa98a7b967f6c7bb53153dbd2b8f356ceb286e6743bb4e2", - "zh:4cff06d31272aac8bc35e9b7faec42cf4554cbcbae1092eaab6ab7f643c215d9", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:7ed16ccd2049fa089616b98c0bd57219f407958f318f3c697843e2397ddf70df", - "zh:842696362c92bf2645eb85c739410fd51376be6c488733efae44f4ce688da50e", - "zh:8985129f2eccfd7f1841ce06f3bf2bbede6352ec9e9f926fbaa6b1a05313b326", - "zh:a5f0602d8ec991a5411ef42f872aa90f6347e93886ce67905c53cfea37278e05", - "zh:bf4ab82cbe5256dcef16949973bf6aa1a98c2c73a98d6a44ee7bc40809d002b8", - "zh:e70770be62aa70198fa899526d671643ff99eecf265bf1a50e798fc3480bd417", - ] -} - -provider "registry.terraform.io/hashicorp/local" { - version = "2.4.0" - hashes = [ - "h1:Bs7LAkV/iQTLv72j+cTMrvx2U3KyXrcVHaGbdns1NcE=", - "zh:53604cd29cb92538668fe09565c739358dc53ca56f9f11312b9d7de81e48fab9", - "zh:66a46e9c508716a1c98efbf793092f03d50049fa4a83cd6b2251e9a06aca2acf", - "zh:70a6f6a852dd83768d0778ce9817d81d4b3f073fab8fa570bff92dcb0824f732", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:82a803f2f484c8b766e2e9c32343e9c89b91997b9f8d2697f9f3837f62926b35", - "zh:9708a4e40d6cc4b8afd1352e5186e6e1502f6ae599867c120967aebe9d90ed04", - "zh:973f65ce0d67c585f4ec250c1e634c9b22d9c4288b484ee2a871d7fa1e317406", - "zh:c8fa0f98f9316e4cfef082aa9b785ba16e36ff754d6aba8b456dab9500e671c6", - "zh:cfa5342a5f5188b20db246c73ac823918c189468e1382cb3c48a9c0c08fc5bf7", - "zh:e0e2b477c7e899c63b06b38cd8684a893d834d6d0b5e9b033cedc06dd7ffe9e2", - "zh:f62d7d05ea1ee566f732505200ab38d94315a4add27947a60afa29860822d3fc", - "zh:fa7ce69dde358e172bd719014ad637634bbdabc49363104f4fca759b4b73f2ce", - ] -} - -provider "registry.terraform.io/hashicorp/null" { - version = "3.2.1" - hashes = [ - "h1:tSj1mL6OQ8ILGqR2mDu7OYYYWf+hoir0pf9KAQ8IzO8=", - "zh:58ed64389620cc7b82f01332e27723856422820cfd302e304b5f6c3436fb9840", - "zh:62a5cc82c3b2ddef7ef3a6f2fedb7b9b3deff4ab7b414938b08e51d6e8be87cb", - "zh:63cff4de03af983175a7e37e52d4bd89d990be256b16b5c7f919aff5ad485aa5", - "zh:74cb22c6700e48486b7cabefa10b33b801dfcab56f1a6ac9b6624531f3d36ea3", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:79e553aff77f1cfa9012a2218b8238dd672ea5e1b2924775ac9ac24d2a75c238", - "zh:a1e06ddda0b5ac48f7e7c7d59e1ab5a4073bbcf876c73c0299e4610ed53859dc", - "zh:c37a97090f1a82222925d45d84483b2aa702ef7ab66532af6cbcfb567818b970", - "zh:e4453fbebf90c53ca3323a92e7ca0f9961427d2f0ce0d2b65523cc04d5d999c2", - "zh:e80a746921946d8b6761e77305b752ad188da60688cfd2059322875d363be5f5", - "zh:fbdb892d9822ed0e4cb60f2fedbdbb556e4da0d88d3b942ae963ed6ff091e48f", - "zh:fca01a623d90d0cad0843102f9b8b9fe0d3ff8244593bd817f126582b52dd694", - ] -} - -provider "registry.terraform.io/hashicorp/random" { - version = "3.5.1" - hashes = [ - "h1:sZ7MTSD4FLekNN2wSNFGpM+5slfvpm5A/NLVZiB7CO0=", - "zh:04e3fbd610cb52c1017d282531364b9c53ef72b6bc533acb2a90671957324a64", - "zh:119197103301ebaf7efb91df8f0b6e0dd31e6ff943d231af35ee1831c599188d", - "zh:4d2b219d09abf3b1bb4df93d399ed156cadd61f44ad3baf5cf2954df2fba0831", - "zh:6130bdde527587bbe2dcaa7150363e96dbc5250ea20154176d82bc69df5d4ce3", - "zh:6cc326cd4000f724d3086ee05587e7710f032f94fc9af35e96a386a1c6f2214f", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:b6d88e1d28cf2dfa24e9fdcc3efc77adcdc1c3c3b5c7ce503a423efbdd6de57b", - "zh:ba74c592622ecbcef9dc2a4d81ed321c4e44cddf7da799faa324da9bf52a22b2", - "zh:c7c5cde98fe4ef1143bd1b3ec5dc04baf0d4cc3ca2c5c7d40d17c0e9b2076865", - "zh:dac4bad52c940cd0dfc27893507c1e92393846b024c5a9db159a93c534a3da03", - "zh:de8febe2a2acd9ac454b844a4106ed295ae9520ef54dc8ed2faf29f12716b602", - "zh:eab0d0495e7e711cca367f7d4df6e322e6c562fc52151ec931176115b83ed014", - ] -} - -provider "registry.terraform.io/hashicorp/template" { - version = "2.2.0" - hashes = [ - "h1:0wlehNaxBX7GJQnPfQwTNvvAf38Jm0Nv7ssKGMaG6Og=", - "h1:94qn780bi1qjrbC3uQtjJh3Wkfwd5+tTtJHOb7KTg9w=", - "zh:01702196f0a0492ec07917db7aaa595843d8f171dc195f4c988d2ffca2a06386", - "zh:09aae3da826ba3d7df69efeb25d146a1de0d03e951d35019a0f80e4f58c89b53", - "zh:09ba83c0625b6fe0a954da6fbd0c355ac0b7f07f86c91a2a97849140fea49603", - "zh:0e3a6c8e16f17f19010accd0844187d524580d9fdb0731f675ffcf4afba03d16", - "zh:45f2c594b6f2f34ea663704cc72048b212fe7d16fb4cfd959365fa997228a776", - "zh:77ea3e5a0446784d77114b5e851c970a3dde1e08fa6de38210b8385d7605d451", - "zh:8a154388f3708e3df5a69122a23bdfaf760a523788a5081976b3d5616f7d30ae", - "zh:992843002f2db5a11e626b3fc23dc0c87ad3729b3b3cff08e32ffb3df97edbde", - "zh:ad906f4cebd3ec5e43d5cd6dc8f4c5c9cc3b33d2243c89c5fc18f97f7277b51d", - "zh:c979425ddb256511137ecd093e23283234da0154b7fa8b21c2687182d9aea8b2", - ] -} - -provider "registry.terraform.io/hashicorp/tls" { - version = "4.0.4" - hashes = [ - "h1:Wd3RqmQW60k2QWPN4sK5CtjGuO1d+CRNXgC+D4rKtXc=", - "zh:23671ed83e1fcf79745534841e10291bbf34046b27d6e68a5d0aab77206f4a55", - "zh:45292421211ffd9e8e3eb3655677700e3c5047f71d8f7650d2ce30242335f848", - "zh:59fedb519f4433c0fdb1d58b27c210b27415fddd0cd73c5312530b4309c088be", - "zh:5a8eec2409a9ff7cd0758a9d818c74bcba92a240e6c5e54b99df68fff312bbd5", - "zh:5e6a4b39f3171f53292ab88058a59e64825f2b842760a4869e64dc1dc093d1fe", - "zh:810547d0bf9311d21c81cc306126d3547e7bd3f194fc295836acf164b9f8424e", - "zh:824a5f3617624243bed0259d7dd37d76017097dc3193dac669be342b90b2ab48", - "zh:9361ccc7048be5dcbc2fafe2d8216939765b3160bd52734f7a9fd917a39ecbd8", - "zh:aa02ea625aaf672e649296bce7580f62d724268189fe9ad7c1b36bb0fa12fa60", - "zh:c71b4cd40d6ec7815dfeefd57d88bc592c0c42f5e5858dcc88245d371b4b8b1e", - "zh:dabcd52f36b43d250a3d71ad7abfa07b5622c69068d989e60b79b2bb4f220316", - "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", - ] -} diff --git a/main.tf b/main.tf index 7c0c885..3e6a376 100644 --- a/main.tf +++ b/main.tf @@ -187,6 +187,7 @@ resource "null_resource" "reboot_post_upgrade" { command = "sleep 250" } } + resource "equinix_metal_port" "esxi_hosts" { count = length(equinix_metal_device.esxi_hosts) bonded = false @@ -420,6 +421,7 @@ resource "null_resource" "apply_esx_network_config" { count = length(equinix_metal_device.esxi_hosts) depends_on = [ null_resource.reboot_post_upgrade, + equinix_metal_port.esxi_hosts, null_resource.esx_network_prereqs, null_resource.copy_update_uplinks, null_resource.install_vpn_server diff --git a/versions.tf b/versions.tf index c53454e..5a9467d 100644 --- a/versions.tf +++ b/versions.tf @@ -1,4 +1,6 @@ terraform { + required_version = "~> 1.4" + required_providers { null = { source = "hashicorp/null" @@ -20,7 +22,7 @@ terraform { source = "hashicorp/local" } } - required_version = ">= 1.3.0" + provider_meta "equinix" { module_name = "equinix-metal-vsphere" }