diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl index 8404473..e811f18 100644 --- a/.terraform.lock.hcl +++ b/.terraform.lock.hcl @@ -24,24 +24,24 @@ provider "registry.terraform.io/cloudflare/cloudflare" { } provider "registry.terraform.io/equinix/equinix" { - version = "1.11.1" - constraints = "1.11.1" + version = "1.14.1" + constraints = "1.14.1" hashes = [ - "h1:zY9lHFA+SPAZxeElvaNt0/2d/e6GaPVObnwseI8A/m0=", - "zh:0441965d03d1b378ab99205e55067cc5fc60b2a22886ee1ef62f910a988cd2d8", - "zh:1013a1276f95ee5deefed9ddea97d9018490843151af90558f0f4e656f9a037e", - "zh:182ebd08581581e572f680689b08bad7928bf183b7258ded5aab31e0b9dd0138", - "zh:58c0c4fe74581855e7240124a5c200d09f2b2834f0640b2a61e6b8c1fd0e778d", - "zh:5c8ed70611d980dd34aebcf8f6faecc028535df6e2c6ec2ec40fd918623da7b7", - "zh:5d388a2bc4acb25c2e7728c94cc18b0af1e367a716b296e24d58a361d31e6363", - "zh:61fe36fc2ba1e78f96bfc09c401d264d96dc6d09df9d58f83120630ee1941de5", - "zh:6d0f4705c6ab48e0e983688b9dc171ef9e1e2b9706927701a53a234519f25b36", - "zh:70fbfd6e59f644c2d5467085c7ab073a6b6313d95fd90a626e34c126a3078a7c", - "zh:823df43ac4e4d38e5b6b4310f3c888b7ffe0f6cd234897a0c76edebef4842f42", - "zh:8824ba6ac9689bfd570566796843407df3aa995b18cf4986db9d541701500209", - "zh:a5dede4d4c4dae6574e0efaf1f91d310cca8382002b95bf690b4cb336ec26876", - "zh:ed8bfd649f636e2fa91fc962c1da1d6a3fc2e5769222664f8a7b382c3dbf85fe", - "zh:f54cecbdec8e82e71be3561cf5c68351dbbe2f290826068fa19b5a30735a444a", + "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", ] } @@ -50,6 +50,7 @@ provider "registry.terraform.io/hashicorp/aws" { constraints = "~> 3.0" hashes = [ "h1:nrYpq9ne3FNUmjekbc0ayKE7wNu7BaMpV7oSC+qjAC4=", + "h1:z1+WjdwuRX8Aa9a7YKXErhZ5AuvoXiDq7FHts30sZak=", "zh:1cf933104a641ffdb64d71a76806f4df35d19101b47e0eb02c9c36bd64bfdd2d", "zh:273afaf908775ade6c9d32462938e7739ee8b00a0de2ef3cdddc5bc115bb1d4f", "zh:2bc24ae989e38f575de034083082c69b41c54b8df69d35728853257c400ce0f4", @@ -69,40 +70,42 @@ provider "registry.terraform.io/hashicorp/aws" { } provider "registry.terraform.io/hashicorp/external" { - version = "2.2.3" + version = "2.3.1" hashes = [ - "h1:D2RKjqoU26isFINpmeKG9NS0LvkPmrQkNXeYO2TdgyA=", - "zh:184ecd339d764de845db0e5b8a9c87893dcd0c9d822167f73658f89d80ec31c9", - "zh:2661eaca31d17d6bbb18a8f673bbfe3fe1b9b7326e60d0ceb302017003274e3c", - "zh:2c0a180f6d1fc2ba6e03f7dfc5f73b617e45408681f75bca75aa82f3796df0e4", - "zh:4b92ae44c6baef4c4952c47be00541055cb5280dd3bc8031dba5a1b2ee982387", - "zh:5641694d5daf3893d7ea90be03b6fa575211a08814ffe70998d5adb8b59cdc0a", - "zh:5bd55a2be8a1c20d732ac9c604b839e1cadc8c49006315dffa4d709b6874df32", - "zh:6e0ef5d11e1597202424b7d69b9da7b881494c9b13a3d4026fc47012dc651c79", + "h1:9rJggijNdRdFk//ViQPGZdK0xu9XU/9qBDijNsZJMg0=", + "h1:gznGscVJ0USxy4CdihpjRKPsKvyGr/zqPvBoFLJTQDc=", + "zh:001e2886dc81fc98cf17cf34c0d53cb2dae1e869464792576e11b0f34ee92f54", + "zh:2eeac58dd75b1abdf91945ac4284c9ccb2bfb17fa9bdb5f5d408148ff553b3ee", + "zh:2fc39079ba61411a737df2908942e6970cb67ed2f4fb19090cd44ce2082903dd", + "zh:472a71c624952cff7aa98a7b967f6c7bb53153dbd2b8f356ceb286e6743bb4e2", + "zh:4cff06d31272aac8bc35e9b7faec42cf4554cbcbae1092eaab6ab7f643c215d9", "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:9e19f89fa25004d3b926a8d15ea630b4bde62f1fa4ed5e11a3d27aabddb77353", - "zh:b763efdd69fd097616b4a4c89cf333b4cee9699ac6432d73d2756f8335d1213f", - "zh:e3b561efdee510b2b445f76a52a902c52bee8e13095e7f4bed7c80f10f8d294a", - "zh:fe660bb8781ee043a093b9a20e53069974475dcaa5791a1f45fd03c61a26478a", + "zh:7ed16ccd2049fa089616b98c0bd57219f407958f318f3c697843e2397ddf70df", + "zh:842696362c92bf2645eb85c739410fd51376be6c488733efae44f4ce688da50e", + "zh:8985129f2eccfd7f1841ce06f3bf2bbede6352ec9e9f926fbaa6b1a05313b326", + "zh:a5f0602d8ec991a5411ef42f872aa90f6347e93886ce67905c53cfea37278e05", + "zh:bf4ab82cbe5256dcef16949973bf6aa1a98c2c73a98d6a44ee7bc40809d002b8", + "zh:e70770be62aa70198fa899526d671643ff99eecf265bf1a50e798fc3480bd417", ] } provider "registry.terraform.io/hashicorp/local" { - version = "2.3.0" + version = "2.4.0" hashes = [ - "h1:7y8CXQKtfyvrMCSWgCkCclNN9L161u6jO1dEGVaB5RQ=", - "zh:1f1920b3f78c31c6b69cdfe1e016a959667c0e2d01934e1a084b94d5a02cd9d2", - "zh:550a3cdae0ddb350942624e7b2e8b31d28bc15c20511553432413b1f38f4b214", - "zh:68d1d9ccbfce2ce56b28a23b22833a5369d4c719d6d75d50e101a8a8dbe33b9b", - "zh:6ae3ad6d865a906920c313ec2f413d080efe32c230aca711fd106b4cb9022ced", + "h1:Bs7LAkV/iQTLv72j+cTMrvx2U3KyXrcVHaGbdns1NcE=", + "h1:ZUEYUmm2t4vxwzxy1BvN1wL6SDWrDxfH7pxtzX8c6d0=", + "zh:53604cd29cb92538668fe09565c739358dc53ca56f9f11312b9d7de81e48fab9", + "zh:66a46e9c508716a1c98efbf793092f03d50049fa4a83cd6b2251e9a06aca2acf", + "zh:70a6f6a852dd83768d0778ce9817d81d4b3f073fab8fa570bff92dcb0824f732", "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:a0f413d50f54124057ae3dcd9353a797b84e91dc34bcf85c34a06f8aef1f9b12", - "zh:a2ac6d4088ceddcd73d88505e18b8226a6e008bff967b9e2d04254ef71b4ac6b", - "zh:a851010672e5218bdd4c4ea1822706c9025ef813a03da716d647dd6f8e2cffb0", - "zh:aa797561755041ef2fad99ee9ffc12b5e724e246bb019b21d7409afc2ece3232", - "zh:c6afa960a20d776f54bb1fc260cd13ead17280ebd87f05b9abcaa841ed29d289", - "zh:df0975e86b30bb89717b8c8d6d4690b21db66de06e79e6d6cfda769f3304afe6", - "zh:f0d3cc3da72135efdbe8f4cfbfb0f2f7174827887990a5545e6db1981f0d3a7c", + "zh:82a803f2f484c8b766e2e9c32343e9c89b91997b9f8d2697f9f3837f62926b35", + "zh:9708a4e40d6cc4b8afd1352e5186e6e1502f6ae599867c120967aebe9d90ed04", + "zh:973f65ce0d67c585f4ec250c1e634c9b22d9c4288b484ee2a871d7fa1e317406", + "zh:c8fa0f98f9316e4cfef082aa9b785ba16e36ff754d6aba8b456dab9500e671c6", + "zh:cfa5342a5f5188b20db246c73ac823918c189468e1382cb3c48a9c0c08fc5bf7", + "zh:e0e2b477c7e899c63b06b38cd8684a893d834d6d0b5e9b033cedc06dd7ffe9e2", + "zh:f62d7d05ea1ee566f732505200ab38d94315a4add27947a60afa29860822d3fc", + "zh:fa7ce69dde358e172bd719014ad637634bbdabc49363104f4fca759b4b73f2ce", ] } @@ -110,6 +113,7 @@ 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", @@ -126,45 +130,28 @@ provider "registry.terraform.io/hashicorp/null" { } provider "registry.terraform.io/hashicorp/random" { - version = "3.4.3" + version = "3.5.1" hashes = [ - "h1:tL3katm68lX+4lAncjQA9AXL4GR/VM+RPwqYf4D2X8Q=", - "zh:41c53ba47085d8261590990f8633c8906696fa0a3c4b384ff6a7ecbf84339752", - "zh:59d98081c4475f2ad77d881c4412c5129c56214892f490adf11c7e7a5a47de9b", - "zh:686ad1ee40b812b9e016317e7f34c0d63ef837e084dea4a1f578f64a6314ad53", + "h1:sZ7MTSD4FLekNN2wSNFGpM+5slfvpm5A/NLVZiB7CO0=", + "zh:04e3fbd610cb52c1017d282531364b9c53ef72b6bc533acb2a90671957324a64", + "zh:119197103301ebaf7efb91df8f0b6e0dd31e6ff943d231af35ee1831c599188d", + "zh:4d2b219d09abf3b1bb4df93d399ed156cadd61f44ad3baf5cf2954df2fba0831", + "zh:6130bdde527587bbe2dcaa7150363e96dbc5250ea20154176d82bc69df5d4ce3", + "zh:6cc326cd4000f724d3086ee05587e7710f032f94fc9af35e96a386a1c6f2214f", "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:84103eae7251384c0d995f5a257c72b0096605048f757b749b7b62107a5dccb3", - "zh:8ee974b110adb78c7cd18aae82b2729e5124d8f115d484215fd5199451053de5", - "zh:9dd4561e3c847e45de603f17fa0c01ae14cae8c4b7b4e6423c9ef3904b308dda", - "zh:bb07bb3c2c0296beba0beec629ebc6474c70732387477a65966483b5efabdbc6", - "zh:e891339e96c9e5a888727b45b2e1bb3fcbdfe0fd7c5b4396e4695459b38c8cb1", - "zh:ea4739860c24dfeaac6c100b2a2e357106a89d18751f7693f3c31ecf6a996f8d", - "zh:f0c76ac303fd0ab59146c39bc121c5d7d86f878e9a69294e29444d4c653786f8", - "zh:f143a9a5af42b38fed328a161279906759ff39ac428ebcfe55606e05e1518b93", - ] -} - -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", + "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", @@ -182,22 +169,22 @@ provider "registry.terraform.io/hashicorp/tls" { } provider "registry.terraform.io/linode/linode" { - version = "1.30.0" + version = "2.0.0" hashes = [ - "h1:KUMWKSVxJTBArIstRoMlwrniIr3MECFDnGScrdwLYlM=", - "zh:197c61c5eb2252f65c18d2aa65cdc0511617b13e2388118f3fe063d7969dd7ad", - "zh:1a66470682acb13dc57308d5b1eaa19ff60c2404a3b15714e3072d02d569b1a5", - "zh:368cdcf17073a39687da830c02cf3ce50e0d8f03b7ec808b49561628be798abc", - "zh:42f2510a70afbb7fc8928df119d1e14ce1b61d2aded13b88072858ee5861feb2", - "zh:57734dd1e8255abd52a33ff79c20ef4efc3831850b22dd1a628e6301c3cf95c6", - "zh:61d614a7a4607bfc4ab6bfd0501007501957b973dbd028e0e513a3d4df07f12e", - "zh:79243f22fc0a9adfc1123abdd17c515f0ce4d8147302889033b6c44f6a48337e", - "zh:9f7cd46185bbe2c001dab1d0bd6c17a9740e7279d3fffe93755f2c964e267213", - "zh:9fdc9f8f47bde4140bc14cf082bbc2ceb63a3bebf0683df2fefd83c9e248274c", - "zh:aa1fd80a7ea245f8b852e40c68ccde2d8b6446e2138ebdec7425c67e82099881", - "zh:bb31f1ba5b0e001cf343d3a4cfafa70e6f3e30fd8a200d2cd7e077663efe0456", - "zh:da87881fa030287df2009028c49581e1fd0ff89baef0d8543b27ca506eff2971", - "zh:ed6afd7b1bc7237a9dff5c721ca3a5c7c505803cd5ea0b4ad0dfdf07ed6f9b0d", - "zh:ee653d5d08cb331ce2d8dc1010e68d363470ae87be62c0515e5d2418727cd02b", + "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/assets/cnv/11_cnv_sample.sh b/assets/cnv/11_cnv_sample.sh index f6fe2be..92469ae 100755 --- a/assets/cnv/11_cnv_sample.sh +++ b/assets/cnv/11_cnv_sample.sh @@ -12,7 +12,7 @@ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@lb-0.${TF_V ## Stage a Windows 2019 image from Vagrant on you bastion/LB -version=`curl -L -H "Accept: application/json" https://app.vagrantup.com/peru/boxes/windows-server-2019-standard-x64-eval | jq -r '.versions[0].version'` +version=`curl -fsSL -L -H "Accept: application/json" https://app.vagrantup.com/peru/boxes/windows-server-2019-standard-x64-eval | jq -r '.versions[0].version'` #ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ${TF_VAR_ssh_private_key_path} root@lb-0.${TF_VAR_cluster_name}.${TF_VAR_cluster_basedomain} << EOF # wget https://app.vagrantup.com/peru/boxes/windows-server-2016-standard-x64-eval/versions/${version}/providers/libvirt.box -O /usr/share/nginx/html/libvirt.box diff --git a/main.tf b/main.tf index 2285e50..94d61c3 100644 --- a/main.tf +++ b/main.tf @@ -13,7 +13,7 @@ module "bastion" { depends_on = [module.sshkey] project_id = var.project_id - facility = var.facility + metro = var.metro plan = var.plan_bastion operating_system = var.bastion_operating_system ssh_private_key_path = module.sshkey.ssh_private_key_file @@ -60,7 +60,7 @@ module "openshift_bootstrap" { cluster_basedomain = var.cluster_basedomain node_count = var.count_bootstrap plan = var.plan_controlplane - facility = var.facility + metro = var.metro ssh_private_key_path = module.sshkey.ssh_private_key_file project_id = var.project_id bastion_ip = module.bastion.lb_ip @@ -88,7 +88,7 @@ module "openshift_controlplane" { cluster_basedomain = var.cluster_basedomain node_count = var.count_controlplane plan = var.plan_controlplane - facility = var.facility + metro = var.metro ssh_private_key_path = module.sshkey.ssh_private_key_file project_id = var.project_id bastion_ip = module.bastion.lb_ip @@ -116,7 +116,7 @@ module "openshift_workers" { cluster_basedomain = var.cluster_basedomain node_count = var.count_compute plan = var.plan_compute - facility = var.facility + metro = var.metro ssh_private_key_path = module.sshkey.ssh_private_key_file project_id = var.project_id bastion_ip = module.bastion.lb_ip diff --git a/modules/bastion/main.tf b/modules/bastion/main.tf index 9d2c642..44074f1 100644 --- a/modules/bastion/main.tf +++ b/modules/bastion/main.tf @@ -1,33 +1,3 @@ -data "template_file" "user_data" { - template = file("${path.module}/assets/user_data_${var.operating_system}.sh") -} - -data "template_file" "ipxe_script" { - depends_on = [equinix_metal_device.lb] - for_each = toset(var.nodes) - template = file("${path.module}/assets/ipxe.tpl") - - vars = { - node_type = each.value - bastion_ip = equinix_metal_device.lb.access_public_ipv4 - ocp_version = var.ocp_version - ocp_version_zstream = var.ocp_version_zstream - } -} - -data "template_file" "ignition_append" { - depends_on = [equinix_metal_device.lb] - for_each = toset(var.nodes) - template = file("${path.module}/assets/ignition-append.json.tpl") - - vars = { - node_type = each.value - bastion_ip = equinix_metal_device.lb.access_public_ipv4 - cluster_name = var.cluster_name - cluster_basedomain = var.cluster_basedomain - } -} - locals { arch = "x86_64" coreos_baseurl = "https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos" @@ -42,12 +12,11 @@ locals { resource "equinix_metal_device" "lb" { hostname = "lb-0.${var.cluster_name}.${var.cluster_basedomain}" plan = var.plan - facilities = [var.facility] + metro = var.metro operating_system = var.operating_system billing_cycle = var.billing_cycle project_id = var.project_id - user_data = data.template_file.user_data.rendered - + user_data = file("${path.module}/assets/user_data_${var.operating_system}.sh") } resource "null_resource" "dircheck" { @@ -81,9 +50,9 @@ resource "null_resource" "ocp_install_ignition" { inline = [ - "curl -L -o /usr/share/nginx/html/${local.coreos_img} ${local.coreos_url}/${local.coreos_img}", - "curl -L -o /usr/share/nginx/html/${local.coreos_kernel} ${local.coreos_url}/${local.coreos_kernel}", - "curl -L -o /usr/share/nginx/html/${local.coreos_initrd} ${local.coreos_url}/${local.coreos_initrd}", + "curl -fsSL -o /usr/share/nginx/html/${local.coreos_img} ${local.coreos_url}/${local.coreos_img}", + "curl -fsSL -o /usr/share/nginx/html/${local.coreos_kernel} ${local.coreos_url}/${local.coreos_kernel}", + "curl -fsSL -o /usr/share/nginx/html/${local.coreos_initrd} ${local.coreos_url}/${local.coreos_initrd}", "chmod -R 0755 /usr/share/nginx/html/" ] } @@ -91,8 +60,8 @@ resource "null_resource" "ocp_install_ignition" { resource "null_resource" "ipxe_files" { - depends_on = [null_resource.dircheck] - for_each = data.template_file.ipxe_script + depends_on = [equinix_metal_device.lb, null_resource.dircheck] + for_each = toset(var.nodes) provisioner "file" { @@ -101,7 +70,12 @@ resource "null_resource" "ipxe_files" { host = equinix_metal_device.lb.access_public_ipv4 } - content = each.value.rendered + content = templatefile("${path.module}/assets/ipxe.tpl", { + node_type = each.value + bastion_ip = equinix_metal_device.lb.access_public_ipv4 + ocp_version = var.ocp_version + ocp_version_zstream = var.ocp_version_zstream + }) destination = "/usr/share/nginx/html/${each.key}.ipxe" } @@ -121,8 +95,8 @@ resource "null_resource" "ipxe_files" { resource "null_resource" "ignition_append_files" { - depends_on = [null_resource.dircheck] - for_each = data.template_file.ignition_append + depends_on = [equinix_metal_device.lb, null_resource.dircheck] + for_each = toset(var.nodes) provisioner "file" { @@ -131,7 +105,12 @@ resource "null_resource" "ignition_append_files" { host = equinix_metal_device.lb.access_public_ipv4 } - content = each.value.rendered + content = templatefile("${path.module}/assets/ignition-append.json.tpl", { + node_type = each.value + bastion_ip = equinix_metal_device.lb.access_public_ipv4 + cluster_name = var.cluster_name + cluster_basedomain = var.cluster_basedomain + }) destination = "/usr/share/nginx/html/${each.key}-append.ign" } diff --git a/modules/bastion/variables.tf b/modules/bastion/variables.tf index 5227967..2313e94 100644 --- a/modules/bastion/variables.tf +++ b/modules/bastion/variables.tf @@ -17,13 +17,13 @@ variable "billing_cycle" { variable "plan" { description = "The server type to deploy" - default = "c2.medium.x86" + default = "c3.small.x86" type = string } -variable "facility" { +variable "metro" { description = "The location of the servers" - default = "sjc1" + default = "da" type = string } diff --git a/modules/bastion/versions.tf b/modules/bastion/versions.tf index 78b6a1f..b97be6b 100644 --- a/modules/bastion/versions.tf +++ b/modules/bastion/versions.tf @@ -6,9 +6,6 @@ terraform { null = { source = "hashicorp/null" } - template = { - source = "hashicorp/template" - } } required_version = ">= 0.14" } diff --git a/modules/install/assets/nfs-provisioner.sh b/modules/install/assets/nfs-provisioner.sh index e8a4ab1..760e8d2 100755 --- a/modules/install/assets/nfs-provisioner.sh +++ b/modules/install/assets/nfs-provisioner.sh @@ -7,9 +7,9 @@ BASTION_IP=$2 export KUBECONFIG=$RDIR/artifacts/install/auth/kubeconfig; # Pull NFS Provisioner manifests -curl https://raw.githubusercontent.com/kubernetes-incubator/external-storage/master/nfs-client/deploy/rbac.yaml > $RDIR/artifacts/install/nfsp-rbac.yaml -curl https://raw.githubusercontent.com/kubernetes-incubator/external-storage/master/nfs-client/deploy/deployment.yaml > $RDIR/artifacts/install/nfsp-deployment.yaml -curl https://raw.githubusercontent.com/kubernetes-incubator/external-storage/master/nfs-client/deploy/class.yaml > $RDIR/artifacts/install/nfsp-class.yaml +curl -fsSL https://raw.githubusercontent.com/kubernetes-incubator/external-storage/master/nfs-client/deploy/rbac.yaml > $RDIR/artifacts/install/nfsp-rbac.yaml +curl -fsSL https://raw.githubusercontent.com/kubernetes-incubator/external-storage/master/nfs-client/deploy/deployment.yaml > $RDIR/artifacts/install/nfsp-deployment.yaml +curl -fsSL https://raw.githubusercontent.com/kubernetes-incubator/external-storage/master/nfs-client/deploy/class.yaml > $RDIR/artifacts/install/nfsp-class.yaml # Retarget oc binary export oc=$RDIR/artifacts/oc diff --git a/modules/install/main.tf b/modules/install/main.tf index a44948d..d86dac7 100644 --- a/modules/install/main.tf +++ b/modules/install/main.tf @@ -46,20 +46,6 @@ locals { haproxy_cfg_file = "/etc/haproxy/haproxy.cfg" } -data "template_file" "haproxy_lb" { - depends_on = [var.depends] - template = file("${path.module}/assets/haproxy.cfg.tpl") - - vars = { - expanded_controlplane = local.expanded_controlplane - expanded_compute_http = tonumber(var.count_compute) >= 1 ? local.expanded_compute_http : local.expanded_controlplane_http - expanded_compute_https = tonumber(var.count_compute) >= 1 ? local.expanded_compute_https : local.expanded_controlplane_https - expanded_mcs = local.expanded_mcs - expanded_bootstrap_api = local.expanded_bootstrap_api - expanded_bootstrap_mcs = local.expanded_bootstrap_mcs - } -} - resource "null_resource" "reconfig_lb" { depends_on = [var.depends] @@ -71,7 +57,14 @@ resource "null_resource" "reconfig_lb" { host = var.bastion_ip } - content = data.template_file.haproxy_lb.rendered + content = templatefile("${path.module}/assets/haproxy.cfg.tpl", { + expanded_controlplane = local.expanded_controlplane + expanded_compute_http = tonumber(var.count_compute) >= 1 ? local.expanded_compute_http : local.expanded_controlplane_http + expanded_compute_https = tonumber(var.count_compute) >= 1 ? local.expanded_compute_https : local.expanded_controlplane_https + expanded_mcs = local.expanded_mcs + expanded_bootstrap_api = local.expanded_bootstrap_api + expanded_bootstrap_mcs = local.expanded_bootstrap_mcs + }) destination = local.haproxy_cfg_file } @@ -101,7 +94,7 @@ resource "null_resource" "check_port" { inline = [<= 1 ? var.bootstrap_ip[0] : var.bastion_ip}:6443) != '403' ]]; do + while [[ $(curl -fsSL -k -s -o /dev/null -w ''%%{http_code}'' https://${length(var.bootstrap_ip) >= 1 ? var.bootstrap_ip[0] : var.bastion_ip}:6443) != '403' ]]; do ((i++)); echo "Waiting for TCP6443 on bootstrap/API (Retrying $i of 1200)"; sleep 2; @@ -135,13 +128,6 @@ resource "null_resource" "ocp_installer_wait_for_bootstrap" { } } -data "template_file" "nfs_exports" { - template = <<-EOT - ${local.expanded_controlplane_nfs} - ${local.expanded_compute_nfs} - EOT -} - resource "null_resource" "reconfig_nfs_exports" { depends_on = [var.depends] @@ -153,7 +139,10 @@ resource "null_resource" "reconfig_nfs_exports" { host = var.bastion_ip } - content = data.template_file.nfs_exports.rendered + content = <<-EOT + ${local.expanded_controlplane_nfs} + ${local.expanded_compute_nfs} + EOT destination = "/etc/exports" } diff --git a/modules/install/versions.tf b/modules/install/versions.tf index 3e70104..fc7a334 100644 --- a/modules/install/versions.tf +++ b/modules/install/versions.tf @@ -3,9 +3,6 @@ terraform { null = { source = "hashicorp/null" } - template = { - source = "hashicorp/template" - } } required_version = ">= 0.13" } diff --git a/modules/node/main.tf b/modules/node/main.tf index a31d9ac..bca8f37 100644 --- a/modules/node/main.tf +++ b/modules/node/main.tf @@ -4,7 +4,7 @@ resource "equinix_metal_device" "node" { operating_system = "custom_ipxe" ipxe_script_url = "http://${var.bastion_ip}:8080/${var.node_type}.ipxe" plan = var.plan - facilities = [var.facility] + metro = var.metro count = var.node_count billing_cycle = "hourly" project_id = var.project_id diff --git a/modules/node/variables.tf b/modules/node/variables.tf index 285cbb2..16d0155 100644 --- a/modules/node/variables.tf +++ b/modules/node/variables.tf @@ -1,6 +1,6 @@ variable "plan" {} variable "node_count" {} -variable "facility" {} +variable "metro" {} variable "cluster_name" {} variable "cluster_basedomain" {} variable "ssh_private_key_path" {} diff --git a/modules/prereq/assets/get-ocp-installer.sh b/modules/prereq/assets/get-ocp-installer.sh index f8aafe8..ad0c153 100755 --- a/modules/prereq/assets/get-ocp-installer.sh +++ b/modules/prereq/assets/get-ocp-installer.sh @@ -7,9 +7,9 @@ if [ -f $RDIR/artifacts/openshift-install.tar.gz ] && [ -f $RDIR/artifacts/oc.ta echo 'Openshift Installer Exists' else mkdir $RDIR/artifacts; - curl -L http://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest-${OCP_VERSION}/openshift-install-linux.tar.gz \ + curl -fsSL http://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest-${OCP_VERSION}/openshift-install-linux.tar.gz \ --output $RDIR/artifacts/openshift-install.tar.gz; - curl -L http://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/linux/oc.tar.gz \ + curl -fsSL http://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/linux/oc.tar.gz \ --output $RDIR/artifacts/oc.tar.gz; fi diff --git a/modules/prereq/assets/get-pull-secret.sh b/modules/prereq/assets/get-pull-secret.sh index 34289f1..e4226d8 100755 --- a/modules/prereq/assets/get-pull-secret.sh +++ b/modules/prereq/assets/get-pull-secret.sh @@ -2,7 +2,7 @@ export OFFLINE_ACCESS_TOKEN="$1" -export BEARER=$(curl \ +export BEARER=$(curl -fsSL \ --silent \ --data-urlencode "grant_type=refresh_token" \ --data-urlencode "client_id=cloud-services" \ @@ -10,7 +10,7 @@ export BEARER=$(curl \ https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token | \ jq -r .access_token) -export PULLSECRET=$(curl --silent -X POST https://api.openshift.com/api/accounts_mgmt/v1/access_token --header "Content-Type:application/json" --header "Authorization: Bearer $BEARER") +export PULLSECRET=$(curl -fsSL --silent -X POST https://api.openshift.com/api/accounts_mgmt/v1/access_token --header "Content-Type:application/json" --header "Authorization: Bearer $BEARER") ## Combine template outside of terraform: ##{ cat install-config.yaml.backup ; echo "pullSecret: '${PULLSECRET}'" ; } diff --git a/modules/prereq/main.tf b/modules/prereq/main.tf index 2371603..363ab87 100644 --- a/modules/prereq/main.tf +++ b/modules/prereq/main.tf @@ -56,29 +56,22 @@ resource "null_resource" "ocp_pullsecret" { } } -data "template_file" "installer_config" { - depends_on = [null_resource.ocp_pullsecret, null_resource.ocp_installer] - template = file("${path.module}/assets/install-config.yaml.tpl") - vars = { - cluster_name = var.cluster_name - cluster_basedomain = var.cluster_basedomain - ssh_public_key = var.ssh_public_key - count_controlplane = var.count_controlplane - count_compute = var.count_compute - } -} - resource "null_resource" "ocp_install_config" { - depends_on = [data.template_file.installer_config, null_resource.ocp_installer, null_resource.ocp_pullsecret] + depends_on = [null_resource.ocp_installer, null_resource.ocp_pullsecret] provisioner "file" { - connection { private_key = file(var.ssh_private_key_path) host = var.bastion_ip } - content = data.template_file.installer_config.rendered + content = templatefile("${path.module}/assets/install-config.yaml.tpl", { + cluster_name = var.cluster_name + cluster_basedomain = var.cluster_basedomain + ssh_public_key = var.ssh_public_key + count_controlplane = var.count_controlplane + count_compute = var.count_compute + }) destination = "/tmp/artifacts/install/install-config.yaml" } diff --git a/modules/prereq/versions.tf b/modules/prereq/versions.tf index 3e70104..fc7a334 100644 --- a/modules/prereq/versions.tf +++ b/modules/prereq/versions.tf @@ -3,9 +3,6 @@ terraform { null = { source = "hashicorp/null" } - template = { - source = "hashicorp/template" - } } required_version = ">= 0.13" } diff --git a/modules/sshkey/main.tf b/modules/sshkey/main.tf index 22db87a..90165fc 100644 --- a/modules/sshkey/main.tf +++ b/modules/sshkey/main.tf @@ -21,7 +21,7 @@ resource "equinix_metal_ssh_key" "ssh_pub_key" { } resource "local_file" "cluster_private_key_pem" { - content = chomp(tls_private_key.ssh_key_pair.private_key_pem) + content = chomp(tls_private_key.ssh_key_pair.private_key_openssh) filename = pathexpand(format("~/.ssh/%s", local.ssh_key_name)) file_permission = "0600" } diff --git a/variables.tf b/variables.tf index e9109ae..1e45bb3 100644 --- a/variables.tf +++ b/variables.tf @@ -30,9 +30,9 @@ variable "bastion_operating_system" { default = "rhel_7" } -variable "facility" { - description = "Your primary facility" - default = "da11" +variable "metro" { + description = "Your primary metro" + default = "da" } variable "plan_bastion" { @@ -41,12 +41,12 @@ variable "plan_bastion" { } variable "plan_controlplane" { description = "Plan for Control Plane Nodes" - default = "c3.medium.x86" + default = "c3.small.x86" } variable "plan_compute" { description = "Plan for Compute Nodes" - default = "c2.medium.x86" + default = "c3.small.x86" } variable "count_bootstrap" { diff --git a/versions.tf b/versions.tf index 32cedb7..c102da2 100644 --- a/versions.tf +++ b/versions.tf @@ -14,11 +14,11 @@ terraform { equinix = { source = "equinix/equinix" - version = "1.11.1" + version = "1.14.1" } null = { source = "hashicorp/null" } } - required_version = ">= 0.14" + required_version = ">= 1" }