diff --git a/.gitignore b/.gitignore index a0d2c74..df814a5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ .terraform .terraform* -!.terraform.lock.hcl +.terraform.lock.hcl ignition.bu terraform.tfstate terraform.tfstate.backup diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl deleted file mode 100644 index e811f18..0000000 --- a/.terraform.lock.hcl +++ /dev/null @@ -1,190 +0,0 @@ -# This file is maintained automatically by "terraform init". -# Manual edits may be lost in future updates. - -provider "registry.terraform.io/cloudflare/cloudflare" { - version = "3.6.0" - constraints = "3.6.0" - hashes = [ - "h1:0ESwUqp8rhdP0Wy6rsauVruGF8z5JIytGD04vpc/cPs=", - "zh:00fd3e98ef0e8f0cba3ef640fb0353328c292e85076cfbcd582a6765a5e747bf", - "zh:2386a835a1f920db97ad597048244664b810694f81efd729484681e64811b95c", - "zh:2e892efeaac9244c20c8fc9e6971b7ec479b10232c11ab354523ce244badcada", - "zh:32c7ec995ecc8feaef7d2e304bdadda716358552520f5cb31ac8ad823876e777", - "zh:73be34d0abf19156ea256a976496351e082a9257fcedd7d2a180b2513d6d6134", - "zh:757fb3efbfdf2e912dcb7b3102e64cd8d2b378857e14933b95c1b9f8a051adf7", - "zh:7bb9acadfaf7e0fd2e256ba84e4642db7af3470a8ea3351d115fc284399de643", - "zh:7cedc56618b56d1bdde98bdf7c5167681b98907e7dfb7e2725f1ec36b6d3b416", - "zh:7d5ed91f3e843f687b78db0db6be57180b2f1799323636fe4d74c860b7a130c3", - "zh:83c75cf0ffa937654228b85bde542529e4ae1cc87af6abf0a1ece09108057bff", - "zh:93269070cbc52e4865e490291f798e07398fb4efe879b425821006c68dfa5e7d", - "zh:93d2467d9680d0d11028ec3a78ec8139afa18c45cff83b0e5aa84d8b9e5a91f2", - "zh:bb31aae955bc306b635d2592dcd07c37a863981caf450ffa7c8adb1cc8d70053", - "zh:c0f4324ff34349ce2ae0a8af81a04aec988f83ae7b876290ab7eb86d1a5d61af", - ] -} - -provider "registry.terraform.io/equinix/equinix" { - version = "1.14.1" - constraints = "1.14.1" - 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/aws" { - version = "3.76.1" - constraints = "~> 3.0" - hashes = [ - "h1:nrYpq9ne3FNUmjekbc0ayKE7wNu7BaMpV7oSC+qjAC4=", - "h1:z1+WjdwuRX8Aa9a7YKXErhZ5AuvoXiDq7FHts30sZak=", - "zh:1cf933104a641ffdb64d71a76806f4df35d19101b47e0eb02c9c36bd64bfdd2d", - "zh:273afaf908775ade6c9d32462938e7739ee8b00a0de2ef3cdddc5bc115bb1d4f", - "zh:2bc24ae989e38f575de034083082c69b41c54b8df69d35728853257c400ce0f4", - "zh:53ba88dbdaf9f818d35001c3d519a787f457283d9341f562dc3d0af51fd9606e", - "zh:5cdac7afea68bbd89d3bdb345d99470226482eff41f375f220fe338d2e5808da", - "zh:63127808890ac4be6cff6554985510b15ac715df698d550a3e722722dc56523c", - "zh:97a1237791f15373743189b078a0e0f2fa4dd7d7474077423376cd186312dc55", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:a4f625e97e5f25073c08080e4a619f959bc0149fc853a6b1b49ab41d58b59665", - "zh:b56cca54019237941f7614e8d2712586a6ab3092e8e9492c70f06563259171e9", - "zh:d4bc33bfd6ac78fb61e6d48a61c179907dfdbdf149b89fb97272c663989a7fcd", - "zh:e0089d73fa56d128c574601305634a774eebacf4a84babba71da10040cecf99a", - "zh:e957531f1d92a6474c9b02bd9200da91b99ba07a0ab761c8e3176400dd41721c", - "zh:eceb85818d57d8270db4df7564cf4ed51b5c650a361aaa017c42227158e1946b", - "zh:f565e5caa1b349ec404c6d03d01c68b02233f5485ed038d0aab810dd4023a880", - ] -} - -provider "registry.terraform.io/hashicorp/external" { - version = "2.3.1" - hashes = [ - "h1:9rJggijNdRdFk//ViQPGZdK0xu9XU/9qBDijNsZJMg0=", - "h1:gznGscVJ0USxy4CdihpjRKPsKvyGr/zqPvBoFLJTQDc=", - "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=", - "h1:ZUEYUmm2t4vxwzxy1BvN1wL6SDWrDxfH7pxtzX8c6d0=", - "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=", - "h1:ydA0/SNRVB1o95btfshvYsmxA+jZFRZcvKzZSB+4S1M=", - "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/tls" { - version = "4.0.4" - hashes = [ - "h1:GZcFizg5ZT2VrpwvxGBHQ/hO9r6g0vYdQqx3bFD3anY=", - "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", - ] -} - -provider "registry.terraform.io/linode/linode" { - version = "2.0.0" - hashes = [ - "h1:NLg13i6WnObZOznxKCn8/Y7mbSZRcTyAN3K8ilRTDPc=", - "zh:0c6e070a352f87d1e60fb1410808312de8e6065010811ffd7482558affef803d", - "zh:431477fb56989be089561bd8e0210ab7dabbc969a7fd3b8e72570c290b5bc911", - "zh:4e09042bddcbc5cf246d079e42da8b1d2ef353c37709a5f67ebe90d23192ff82", - "zh:4fbae3fa75e825649d007706b2d36460ae9c66fc8e18eb7012f526c9bcb2eeca", - "zh:6b734bf6ceca37b587080ec5e86c659d03e33af2db1557b35d8d667083d38e86", - "zh:78856cc4fb4422537580bca76278fb253cfc50d2ea3cc9bc1a3f9553663a85c6", - "zh:902b78e81a6d4f9e0c4cbd354895196dd143bb928c73da4522a323e16965d58a", - "zh:92001fbc49e80ee2bd4b8ab1cc7388dcbe1fc9ddf754754e5bdb37d1ee48bad7", - "zh:98f9e0ffba36b2acef28c3c2e02ff56806dc08ddcc8c6242e97fc740b8f8bc80", - "zh:ab902186e66cd3c1f27b6ffb870dd1361c4af1b26bf145b1ecb84281ed8f0d9a", - "zh:bb9640323bb08090bdf3d692c9f8d9580e31bf65ee80d183fa0ab0593bebefe1", - "zh:e60f92fb3a588bf118fecc8b96aeb8631b7664287257774cf5b77b97c5962a75", - "zh:eeb4822e840b3686334b62a808d5937ec6288bcf0c8c58e592f7097d2ce055c6", - "zh:f9bba3139aab1905666b455fae57406adcbaef2db62ce8be87c769d48140de42", - ] -} diff --git a/CLOUDFLARE.md b/CLOUDFLARE.md index 0a2aa98..0e01f0a 100644 --- a/CLOUDFLARE.md +++ b/CLOUDFLARE.md @@ -11,7 +11,7 @@ This deployment automation uses the Cloudflare Managed DNS service. This domain name (in its "base domain" form) will be used later as a value for the `cluster_basedomain` variable in the Terraform configuration. ```console - Example of the cluster_basedomain value: "domain.com" + Example of the cluster_basedomain value: "example.com" ``` 1. Create Cloudflare account @@ -32,22 +32,12 @@ This deployment automation uses the Cloudflare Managed DNS service. 1. Copy the API key - On the same page as above click on the “Get your API token” link. + Follow the directions on to create an API Token for use with this zone. - You will be presented with the “API Token” tab from the “My Profile” page, click the “View” button at the “Global API key”. - - Save this key value, it will be used later as value of the `dns_options` `api_key` option in the Terraform configuration. - - ```console - Example of the cf_api_key parameter value: "65ca543659011ba2a13b2ab06dab12c158bcb" - ``` - -1. Copy email address - - On the page above, change to the “Communication” page and save the “Email Address” value, it will be used later as the `dns_options` `email` option in the Terraform configuration. + Save this key value. You will use it in your Terraform environment by defining it as `CLOUDFLARE_API_TOKEN` in the environment. ```console - Example of the cf_email parameter value: "me@mywork.org" + Example of the cf_api_token parameter value: "65ca543659011ba2a13b2ab06dab12c158bcb" ``` [Top](README.md) diff --git a/EQUINIX.md b/EQUINIX.md index f532000..09a2b49 100644 --- a/EQUINIX.md +++ b/EQUINIX.md @@ -1,8 +1,8 @@ # Equinix Metal -1. Sign up for a Equinix Metal account at https://console.equinix.com/signup +1. Sign up for a Equinix Metal account at -2. Follow the wizard **"Getting Started with Equinix Metal"** at https://console.equinix.com/getting-started/overview that guides you through creating a project. +2. Follow the wizard **"Getting Started with Equinix Metal"** at that guides you through creating a project. **IMPORTANT:** @@ -10,20 +10,22 @@ Using the Equinix Metal [web portal](https://console.equinix.com/), upload one o These keys will be automatically added (to `.ssh/authorized_keys`) on every server created by you on Equinix Metal. These keys must be generated for every SSH client you will be using to access these servers. -See details at https://metal.equinix.com/developers/docs/servers/key-features/ssh-keys/ +See details at One of these SSH keys must be generated in the host system used for driving the deployment. Copy location and names of these SSH key files on that system, they will be used later as values for `ssh_private_key_path` and `ssh_public_key_path` variables in the Terraform configuration. -3. After the project has been created, navigate to its *"Project Settings"*, and at the *"General"* tab locate the project ID, copy it as is, it will be used later as a value for the `project_id` variable in the Terraform configuration. +3. After the project has been created, navigate to its *"Project Settings"*, and at the *"General"* tab locate the project ID, copy it as is, it will be used later as a value for the `metal_project_id` variable in the Terraform configuration. ``` -Example of the project_id value: "e36a901f-d5e1-28e1-0f21-efb1c3676d89" +Example of the metal_project_id value: "e36a901f-d5e1-28e1-0f21-efb1c3676d89" ``` -4. Create a single API key, either from either your *"Personal Settings"* or from your project *"Project Settings"*, give it a descriptive name and *"Read/Write"* permissions. Copy this key's token value as is, it will be used later as a value for the `auth_token` variable in the Terraform configuration. +4. Create a single API key, either from either your *"Personal Settings"* or from your project *"Project Settings"*, give it a descriptive name and *"Read/Write"* permissions. Copy this key's token value as is, it will be used later as a value for the `metal_auth_token` variable in the Terraform configuration. + +See details at ``` -Example of the auth_token value: "atBncno1a8ipxEYAKNTpuFp7CyyDDZVA" +Example of the metal_auth_token value: "atBncno1a8ipxEYAKNTpuFp7CyyDDZVA" ``` Next, follow [this](CLOUDFLARE.md) diff --git a/OWNERS.md b/OWNERS.md deleted file mode 100644 index 2854790..0000000 --- a/OWNERS.md +++ /dev/null @@ -1,8 +0,0 @@ -# Project Maintainers - - - [JR Morgan](https://github.com/liveaverage) - - [Cody Hill](https://github.com/c0dyhi11) - -# Project Contributors - - - [Contributions](https://github.com/equinix/terraform-metal-openshift-on-baremetal/graphs/contributors) diff --git a/README.md b/README.md index 9200546..6f7ed95 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -[![Terraform CI](https://github.com/equinix/terraform-metal-openshift-on-baremetal/workflows/Terraform%20CI/badge.svg)](https://github.com/equinix/terraform-metal-openshift-on-baremetal/actions?query=workflow%3A%22Terraform+CI%22) [![](https://img.shields.io/badge/stability-experimental-red.svg)](#experimental-statatement) +[![terraform](https://github.com/equinix/terraform-equinix-metal-openshift-on-baremetal/actions/workflows/terraform.yaml/badge.svg)](https://github.com/equinix/terraform-equinix-metal-openshift-on-baremetal/actions/workflows/terraform.yaml) +[![](https://img.shields.io/badge/stability-experimental-red.svg)](https://github.com/equinix-labs/equinix-labs/blob/main/experimental-statement.md#experimental-statement) # OpenShift via Terraform on Equinix Metal @@ -6,7 +7,7 @@ This collection of modules will deploy a bare metal [OpenShift](https://docs.ope ## Install -With your [Equinix Metal account, project, and a **User** API token](https://metal.equinix.com/developers/docs/accounts/users/), you can use [Terraform v1+](https://learn.hashicorp.com/tutorials/terraform/install-cli) to install a proof-of-concept demonstration environment for OpenShift on Equinix Metal. +With your [Equinix Metal account, project, and a **User** API token](https://deploy.equinix.com/developers/docs/metal/identity-access-management/users/), you can use [Terraform v1+](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli) to install a proof-of-concept demonstration environment for OpenShift on Equinix Metal. ### Additional requirements @@ -20,30 +21,35 @@ With your [Equinix Metal account, project, and a **User** API token](https://met To download this project, run the following command: ```bash -git clone https://github.com/equinix/terraform-metal-openshift-on-baremetal.git -cd terraform-metal-openshift +git clone https://github.com/equinix/terraform-equinix-metal-openshift-on-baremetal.git +cd terraform-equinix-metal-openshift ``` ## Usage 1. Follow [this](EQUINIX.md) to configure your Equinix Metal project and collect required parameters. -1. Follow [this](CLOUDFLARE.md) to configure your Cloudflare account and collect required parameters. +1. Follow [this](CLOUDFLARE.md) to configure your Cloudflare account and collect required parameters (AWS and Linode DNS options are also available). 1. [Obtain an OpenShift Cluster Manager API Token](https://cloud.redhat.com/openshift/token) for pullSecret generation. 1. Configure TF_VARs applicable to your Equinix Metal project, DNS settings, and OpenShift API Token: ```bash - export TF_VAR_project_id="kajs886-l59-8488-19910kj" - export TF_VAR_auth_token="lka6702KAmVAP8957Abny01051" + export TF_VAR_metal_project_id="fake-uuid-4159-8488-19910kj" + export TF_VAR_metal_auth_token="faketokenAP8957Abny01051" + ``` + + If you have the [Metal CLI](https://deploy.equinix.com/labs/metal-cli) installed, you can use `eval $(metal env --export -o terraform)` to use the token and project configured for use by Metal CLI. + ```bash export TF_VAR_cluster_basedomain="domain.com" - export TF_VAR_ocp_cluster_manager_token="eyJhbGc...d8Agva" - export TF_VAR_dns_provider="cloudflare" # aws and linode are also supported - export TF_VAR_dns_options='{"email": "abc@xyz.com", "api_key": "...", "api_token": "..."}' # fields differ by DNS provider + export TF_VAR_ocp_cluster_manager_token="eyJhbGc...d8Agva" # https://cloud.redhat.com/openshift/token + export TF_VAR_dns_provider="cloudflare" # aws and linode are also offered ``` + Alternatively, copy `terraform.tfvars.example` to `terraform.tfvars` and modify the values in that file accordingly. + 1. Initialize and validate terraform: ```bash @@ -57,22 +63,120 @@ cd terraform-metal-openshift terraform apply ``` + The Terraform output will look like the following after a successful deployment: + + ```console + Apply complete! Resources: X added, 0 changed, 0 destroyed. + + Outputs: + + Information = < + ssh_private_key_file = "/Users/username/.ssh/id_rsa_mos-mx94n" + ssh_public_key = "ssh-rsa AAAA...==" + username = "kubeadm" + ``` + + To view this output later, use `terraform output`. + 1. Cleanup the boostrap node once provisioning and installation is complete by permanently (recommended) or temporarily setting `count_bootstrap=0` ```bash - terraform apply -var="count_bootstrap=0" + export TF_VAR_count_bootstrap=0 # use the terraform.tfvars file to persist this change + terraform apply ``` If you need to obtain your `kubeadmin` credentials at a later time: ```sh - terraform output + terraform output -raw password + ``` + +1. Login to the various nodes via SSH + + Bastion: + + ```sh + ssh -i $(terraform output -raw ssh_private_key_file) root@$(terraform output -raw bastion_ip) ``` -## Experimental Statement + Bootstrap Node: + + ```sh + ssh -i $(terraform output -raw ssh_private_key_file) core@$(terraform output -json openshift_bootstrap_ip | jq -r '.[0]') + ``` + + Three Control Plane Nodes (default, 0-2): + + ```sh + ssh -i $(terraform output -raw ssh_private_key_file) core@$(terraform output -json openshift_controlplane_ips | jq -r '.[0].[0]') # Change the last 0 for other nodes + ``` + + Two Worker Nodes (default, 0-1): + + ```sh + ssh -i $(terraform output -raw ssh_private_key_file) core@$(terraform output -json openshift_worker_ips | jq -r '.[0].[0]') # Change the last 0 for other nodes + ``` + +1. Access the console (MacOS, Linux) + + ```sh + open $(terraform output -raw console) + ``` + + You will have to navigate your browser settings to access the URL with an invalid certificate. + +1. View OpenShift nodes with Kubernetes CLI (`kubectl`) -This repository is [Experimental](https://github.com/packethost/standards/blob/master/experimental-statement.md)! + ```sh + % kubectl --kubeconfig $(terraform output -raw kubeconfig) get nodes + NAME STATUS ROLES AGE VERSION + master-0.mos.meyu.us Ready control-plane,master 6h28m v1.25.16+306a47e + master-1.mos.meyu.us Ready control-plane,master 6h28m v1.25.16+306a47e + master-2.mos.meyu.us Ready control-plane,master 6h28m v1.25.16+306a47e + worker-0.mos.meyu.us Ready worker 6h17m v1.25.16+306a47e + worker-1.mos.meyu.us Ready worker 6h14m v1.25.16+306a47e + ``` --- -1 As of OpenShift Container Platform 4.5 you can [deploy three-node clusters on bare metal](https://docs.openshift.com/container-platform/4.5/installing/installing_bare_metal/installing-bare-metal.html#installation-three-node-cluster_installing-bare-metal). Setting `count_compute=0` will support deployment of a 3-node cluster. [↩](#openshift-via-terraform-on-equinix-metal) +1 As of OpenShift Container Platform 4.12 you can [deploy three-node clusters on bare metal](https://docs.openshift.com/container-platform/4.12/installing/installing_bare_metal/installing-bare-metal.html#installing-bare-metal). Setting `count_compute=0` will support deployment of a 3-node cluster. [↩](#openshift-via-terraform-on-equinix-metal) diff --git a/main.tf b/main.tf index 94d61c3..a13e089 100644 --- a/main.tf +++ b/main.tf @@ -1,5 +1,5 @@ provider "equinix" { - auth_token = var.auth_token + auth_token = var.metal_auth_token } module "sshkey" { @@ -12,8 +12,8 @@ module "bastion" { source = "./modules/bastion" depends_on = [module.sshkey] - project_id = var.project_id - metro = var.metro + project_id = var.metal_project_id + metro = var.metal_metro plan = var.plan_bastion operating_system = var.bastion_operating_system ssh_private_key_path = module.sshkey.ssh_private_key_file @@ -28,7 +28,6 @@ module "dns_lb" { source = "./modules/dns" dns_provider = var.dns_provider - dns_options = var.dns_options cluster_name = var.cluster_name cluster_basedomain = var.cluster_basedomain @@ -60,9 +59,9 @@ module "openshift_bootstrap" { cluster_basedomain = var.cluster_basedomain node_count = var.count_bootstrap plan = var.plan_controlplane - metro = var.metro + metro = var.metal_metro ssh_private_key_path = module.sshkey.ssh_private_key_file - project_id = var.project_id + project_id = var.metal_project_id bastion_ip = module.bastion.lb_ip node_type = "bootstrap" depends = [module.prepare_openshift.finished] @@ -72,7 +71,6 @@ module "dns_bootstrap" { source = "./modules/dns" dns_provider = var.dns_provider - dns_options = var.dns_options cluster_name = var.cluster_name cluster_basedomain = var.cluster_basedomain @@ -88,9 +86,9 @@ module "openshift_controlplane" { cluster_basedomain = var.cluster_basedomain node_count = var.count_controlplane plan = var.plan_controlplane - metro = var.metro + metro = var.metal_metro ssh_private_key_path = module.sshkey.ssh_private_key_file - project_id = var.project_id + project_id = var.metal_project_id bastion_ip = module.bastion.lb_ip node_type = "master" depends = [module.prepare_openshift.finished] @@ -100,7 +98,6 @@ module "dns_controlplane" { source = "./modules/dns" dns_provider = var.dns_provider - dns_options = var.dns_options cluster_name = var.cluster_name cluster_basedomain = var.cluster_basedomain @@ -116,9 +113,9 @@ module "openshift_workers" { cluster_basedomain = var.cluster_basedomain node_count = var.count_compute plan = var.plan_compute - metro = var.metro + metro = var.metal_metro ssh_private_key_path = module.sshkey.ssh_private_key_file - project_id = var.project_id + project_id = var.metal_project_id bastion_ip = module.bastion.lb_ip node_type = "worker" depends = [module.prepare_openshift.finished] @@ -128,7 +125,6 @@ module "dns_workers" { source = "./modules/dns" dns_provider = var.dns_provider - dns_options = var.dns_options cluster_name = var.cluster_name cluster_basedomain = var.cluster_basedomain @@ -156,11 +152,16 @@ module "openshift_install" { ocp_virtualization_enable = var.ocp_virtualization_enable } + resource "null_resource" "get_kubeconfig" { depends_on = [module.prepare_openshift.finished] provisioner "local-exec" { - command = "mkdir -p ${path.root}/auth; scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ${module.sshkey.ssh_private_key_file} root@${module.bastion.lb_ip}:/tmp/artifacts/install/auth/* ${path.root}/auth/" + command = <