From 16975d847ffc632ce10f5c092af9c47a5b7136f2 Mon Sep 17 00:00:00 2001 From: Marques Johansson Date: Mon, 11 Jul 2022 12:02:06 -0400 Subject: [PATCH] update TF metal provider to equinix Signed-off-by: Marques Johansson --- .terraform.lock.hcl | 145 ++++++++++++++++++++++---------------------- main.tf | 76 +++++++++++------------ output.tf | 8 +-- versions.tf | 4 +- 4 files changed, 117 insertions(+), 116 deletions(-) diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl index e97de05..49903bb 100644 --- a/.terraform.lock.hcl +++ b/.terraform.lock.hcl @@ -1,23 +1,24 @@ # This file is maintained automatically by "terraform init". # Manual edits may be lost in future updates. -provider "registry.terraform.io/equinix/metal" { - version = "3.2.1" +provider "registry.terraform.io/equinix/equinix" { + version = "1.6.1" hashes = [ - "h1:ZlFTM53deZU/b5I1CopmZEgmuhY7C8Z16Ko8/wF7E7g=", - "zh:001983330b8845ad07f1e7d8462cd2ba2f372d54523d64e382ae5bdd4fe690a5", - "zh:1ec8c9052c01acd43f10ac92998b715b693640bb1f53e4dad7b4f5b2a2b84574", - "zh:27785aec3fa7d4b1d4638a7eb36ae70d15fe457e3371365bc16a8fb1349d9649", - "zh:2a6b6cfb08a52f32e66142b21c3df72da3e66d5158a61e4fd1d56f29772b5460", - "zh:57309a5d762744588c4a9ff3592fa446e123e62bd1ec6e502671375075d35647", - "zh:636c16ef8acc57605a0dc011dc05ef00276980553b70a2b35ab09185434902f7", - "zh:6b31691a28f1e6877e5c48894acdcc463f0baa74ae254a2acf6e148971f87810", - "zh:84c82012f51f82977b27084e1d7410c020a5772645f3037c25f7e3df1a637611", - "zh:9ea35a527e95280f3440abf2670c449951c239f1ce5e8fd685e04af60b2d28ff", - "zh:a81ef5a2f29b928c23a83c86e157daa604e70c3ef9e2d49b494556103b58e9ad", - "zh:d2bc396da3a1b0110b64a305f09092136e3b10e4cdf99a4f1e013e01ffa6812d", - "zh:ed783f06adc8702ce6c171a23f918c998c89836a6fe8f4e4c7cd15b84b8708a5", - "zh:fde39924aa0de90b7d19da2dd4f561a7a8c92efb9e19ea1c319957ccd6019fdd", + "h1:zOJu3ktGfHyTX9/WRquqC4uwGOC17uOs0YmHWpLKE2k=", + "zh:01e8d859c28f3ed76c7a9d6e1cdadfa1b59cc151270131e1e13e584b724f8a6b", + "zh:0f9ad029052cdc10c1523a801da97ef3f49a2b36b2430f7800cde5f44f3064da", + "zh:14011e2c9729c727bc20fd78230438872b609b6ef232ba4b3fad487b1628fb91", + "zh:27db516edc506ff806d3b727bd6efda9a4849f408582b1c02677a40f86ed1f05", + "zh:2b44ed5a5f45721dce72d80dc6f313391880c5907bb1b8c74abe33eb1d572c2b", + "zh:3465207a400354cd6bdfc4b065c5f25d96c75caff5dd166b397b0ff747628784", + "zh:6836798ef351083223fa2e7303b7798a21aa8295646c05fcbee3056a5cd15de6", + "zh:75d720a250f0a59f5a211f842d8c356002c571295fab5f66cab975fb3790aaa4", + "zh:814ca1371da98b0d4c24abdf03252f2093c4607c24de8a1a1829302f47974f9e", + "zh:d467542aa27314a00e9a59242965aa28c5223edac4fdf0e7b302750cb339016b", + "zh:d8cf27182d20be69652751f0c10dea519f81fbc3eb540ce6fbeaf63af86719eb", + "zh:ed0716422d3079055e9c70fec03f9388fb8ca98e4124f91bccd58aa0ce164506", + "zh:f07d9305dd0a72ac36f6324a40060fd22e9d9b35547cba1e583ed671fabbd4f2", + "zh:f414563bb5e3ca2cc080862bbb38a940063608a18373fcdf1a433b5bf1329ed4", ] } @@ -59,59 +60,59 @@ provider "registry.terraform.io/hashicorp/google" { } provider "registry.terraform.io/hashicorp/local" { - version = "2.1.0" + version = "2.2.3" hashes = [ - "h1:EYZdckuGU3n6APs97nS2LxZm3dDtGqyM4qaIvsmac8o=", - "h1:KfieWtVyGWwplSoLIB5usKAUnrIkDQBkWaR5TI+4WYg=", - "zh:0f1ec65101fa35050978d483d6e8916664b7556800348456ff3d09454ac1eae2", - "zh:36e42ac19f5d68467aacf07e6adcf83c7486f2e5b5f4339e9671f68525fc87ab", - "zh:6db9db2a1819e77b1642ec3b5e95042b202aee8151a0256d289f2e141bf3ceb3", - "zh:719dfd97bb9ddce99f7d741260b8ece2682b363735c764cac83303f02386075a", - "zh:7598bb86e0378fd97eaa04638c1a4c75f960f62f69d3662e6d80ffa5a89847fe", - "zh:ad0a188b52517fec9eca393f1e2c9daea362b33ae2eb38a857b6b09949a727c1", - "zh:c46846c8df66a13fee6eff7dc5d528a7f868ae0dcf92d79deaac73cc297ed20c", - "zh:dc1a20a2eec12095d04bf6da5321f535351a594a636912361db20eb2a707ccc4", - "zh:e57ab4771a9d999401f6badd8b018558357d3cbdf3d33cc0c4f83e818ca8e94b", - "zh:ebdcde208072b4b0f8d305ebf2bfdc62c926e0717599dcf8ec2fd8c5845031c3", - "zh:ef34c52b68933bedd0868a13ccfd59ff1c820f299760b3c02e008dc95e2ece91", + "h1:KmHz81iYgw9Xn2L3Carc2uAzvFZ1XsE7Js3qlVeC77k=", + "zh:04f0978bb3e052707b8e82e46780c371ac1c66b689b4a23bbc2f58865ab7d5c0", + "zh:6484f1b3e9e3771eb7cc8e8bab8b35f939a55d550b3f4fb2ab141a24269ee6aa", + "zh:78a56d59a013cb0f7eb1c92815d6eb5cf07f8b5f0ae20b96d049e73db915b238", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:8aa9950f4c4db37239bcb62e19910c49e47043f6c8587e5b0396619923657797", + "zh:996beea85f9084a725ff0e6473a4594deb5266727c5f56e9c1c7c62ded6addbb", + "zh:9a7ef7a21f48fabfd145b2e2a4240ca57517ad155017e86a30860d7c0c109de3", + "zh:a63e70ac052aa25120113bcddd50c1f3cfe61f681a93a50cea5595a4b2cc3e1c", + "zh:a6e8d46f94108e049ad85dbed60354236dc0b9b5ec8eabe01c4580280a43d3b8", + "zh:bb112ce7efbfcfa0e65ed97fa245ef348e0fd5bfa5a7e4ab2091a9bd469f0a9e", + "zh:d7bec0da5c094c6955efed100f3fe22fca8866859f87c025be1760feb174d6d9", + "zh:fb9f271b72094d07cef8154cd3d50e9aa818a0ea39130bc193132ad7b23076fd", ] } provider "registry.terraform.io/hashicorp/null" { - version = "3.1.0" + version = "3.1.1" hashes = [ - "h1:vpC6bgUQoJ0znqIKVFevOdq+YQw42bRq0u+H3nto8nA=", - "h1:xhbHC6in3nQryvTQBWKxebi3inG5OCgHgc4fRxL0ymc=", - "zh:02a1675fd8de126a00460942aaae242e65ca3380b5bb192e8773ef3da9073fd2", - "zh:53e30545ff8926a8e30ad30648991ca8b93b6fa496272cd23b26763c8ee84515", - "zh:5f9200bf708913621d0f6514179d89700e9aa3097c77dac730e8ba6e5901d521", - "zh:9ebf4d9704faba06b3ec7242c773c0fbfe12d62db7d00356d4f55385fc69bfb2", - "zh:a6576c81adc70326e4e1c999c04ad9ca37113a6e925aefab4765e5a5198efa7e", - "zh:a8a42d13346347aff6c63a37cda9b2c6aa5cc384a55b2fe6d6adfa390e609c53", - "zh:c797744d08a5307d50210e0454f91ca4d1c7621c68740441cf4579390452321d", - "zh:cecb6a304046df34c11229f20a80b24b1603960b794d68361a67c5efe58e62b8", - "zh:e1371aa1e502000d9974cfaff5be4cfa02f47b17400005a16f14d2ef30dc2a70", - "zh:fc39cc1fe71234a0b0369d5c5c7f876c71b956d23d7d6f518289737a001ba69b", - "zh:fea4227271ebf7d9e2b61b89ce2328c7262acd9fd190e1fd6d15a591abfa848e", + "h1:Pctug/s/2Hg5FJqjYcTM0kPyx3AoYK1MpRWO0T9V2ns=", + "zh:063466f41f1d9fd0dd93722840c1314f046d8760b1812fa67c34de0afcba5597", + "zh:08c058e367de6debdad35fc24d97131c7cf75103baec8279aba3506a08b53faf", + "zh:73ce6dff935150d6ddc6ac4a10071e02647d10175c173cfe5dca81f3d13d8afe", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:8fdd792a626413502e68c195f2097352bdc6a0df694f7df350ed784741eb587e", + "zh:976bbaf268cb497400fd5b3c774d218f3933271864345f18deebe4dcbfcd6afa", + "zh:b21b78ca581f98f4cdb7a366b03ae9db23a73dfa7df12c533d7c19b68e9e72e5", + "zh:b7fc0c1615dbdb1d6fd4abb9c7dc7da286631f7ca2299fb9cd4664258ccfbff4", + "zh:d1efc942b2c44345e0c29bc976594cb7278c38cfb8897b344669eafbc3cddf46", + "zh:e356c245b3cd9d4789bab010893566acace682d7db877e52d40fc4ca34a50924", + "zh:ea98802ba92fcfa8cf12cbce2e9e7ebe999afbf8ed47fa45fc847a098d89468b", + "zh:eff8872458806499889f6927b5d954560f3d74bf20b6043409edf94d26cd906f", ] } provider "registry.terraform.io/hashicorp/random" { - version = "3.1.0" + version = "3.3.2" hashes = [ - "h1:BZMEPucF+pbu9gsPk0G0BHx7YP04+tKdq2MrRDF1EDM=", - "h1:rKYu5ZUbXwrLG1w81k7H3nce/Ys6yAxXhWcbtk36HjY=", - "zh:2bbb3339f0643b5daa07480ef4397bd23a79963cc364cdfbb4e86354cb7725bc", - "zh:3cd456047805bf639fbf2c761b1848880ea703a054f76db51852008b11008626", - "zh:4f251b0eda5bb5e3dc26ea4400dba200018213654b69b4a5f96abee815b4f5ff", - "zh:7011332745ea061e517fe1319bd6c75054a314155cb2c1199a5b01fe1889a7e2", - "zh:738ed82858317ccc246691c8b85995bc125ac3b4143043219bd0437adc56c992", - "zh:7dbe52fac7bb21227acd7529b487511c91f4107db9cc4414f50d04ffc3cab427", - "zh:a3a9251fb15f93e4cfc1789800fc2d7414bbc18944ad4c5c98f466e6477c42bc", - "zh:a543ec1a3a8c20635cf374110bd2f87c07374cf2c50617eee2c669b3ceeeaa9f", - "zh:d9ab41d556a48bd7059f0810cf020500635bfc696c9fc3adab5ea8915c1d886b", - "zh:d9e13427a7d011dbd654e591b0337e6074eef8c3b9bb11b2e39eaaf257044fd7", - "zh:f7605bd1437752114baf601bdf6931debe6dc6bfe3006eb7e9bb9080931dca8a", + "h1:Fu0IKMy46WsO5Y6KfuH9IFkkuxZjE/gIcgtB7GWkTtc=", + "zh:038293aebfede983e45ee55c328e3fde82ae2e5719c9bd233c324cfacc437f9c", + "zh:07eaeab03a723d83ac1cc218f3a59fceb7bbf301b38e89a26807d1c93c81cef8", + "zh:427611a4ce9d856b1c73bea986d841a969e4c2799c8ac7c18798d0cc42b78d32", + "zh:49718d2da653c06a70ba81fd055e2b99dfd52dcb86820a6aeea620df22cd3b30", + "zh:5574828d90b19ab762604c6306337e6cd430e65868e13ef6ddb4e25ddb9ad4c0", + "zh:7222e16f7833199dabf1bc5401c56d708ec052b2a5870988bc89ff85b68a5388", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:b1b2d7d934784d2aee98b0f8f07a8ccfc0410de63493ae2bf2222c165becf938", + "zh:b8f85b6a20bd264fcd0814866f415f0a368d1123cd7879c8ebbf905d370babc8", + "zh:c3813133acc02bbebddf046d9942e8ba5c35fc99191e3eb057957dafc2929912", + "zh:e7a41dbc919d1de800689a81c240c27eec6b9395564630764ebb323ea82ac8a9", + "zh:ee6d23208449a8eaa6c4f203e33f5176fa795b4b9ecf32903dffe6e2574732c2", ] } @@ -134,20 +135,20 @@ provider "registry.terraform.io/hashicorp/template" { } provider "registry.terraform.io/hashicorp/tls" { - version = "3.1.0" + version = "3.4.0" hashes = [ - "h1:XTU9f6sGMZHOT8r/+LWCz2BZOPH127FBTPjMMEAAu1U=", - "h1:fUJX8Zxx38e2kBln+zWr1Tl41X+OuiE++REjrEyiOM4=", - "zh:3d46616b41fea215566f4a957b6d3a1aa43f1f75c26776d72a98bdba79439db6", - "zh:623a203817a6dafa86f1b4141b645159e07ec418c82fe40acd4d2a27543cbaa2", - "zh:668217e78b210a6572e7b0ecb4134a6781cc4d738f4f5d09eb756085b082592e", - "zh:95354df03710691773c8f50a32e31fca25f124b7f3d6078265fdf3c4e1384dca", - "zh:9f97ab190380430d57392303e3f36f4f7835c74ea83276baa98d6b9a997c3698", - "zh:a16f0bab665f8d933e95ca055b9c8d5707f1a0dd8c8ecca6c13091f40dc1e99d", - "zh:be274d5008c24dc0d6540c19e22dbb31ee6bfdd0b2cddd4d97f3cd8a8d657841", - "zh:d5faa9dce0a5fc9d26b2463cea5be35f8586ab75030e7fa4d4920cd73ee26989", - "zh:e9b672210b7fb410780e7b429975adcc76dd557738ecc7c890ea18942eb321a5", - "zh:eb1f8368573d2370605d6dbf60f9aaa5b64e55741d96b5fb026dbfe91de67c0d", - "zh:fc1e12b713837b85daf6c3bb703d7795eaf1c5177aebae1afcf811dd7009f4b0", + "h1:fSRc/OyRitbAST9vE+mEcmgJiDp+Jx8pGPbUUeYEQRc=", + "zh:2442a0df0cfb550b8eba9b2af39ac06f54b62447eb369ecc6b1c29f739b33bbb", + "zh:3ebb82cacb677a099de55f844f0d02886bc804b1a2b94441bc40fabcb64d2a38", + "zh:436125c2a7e66bc62a4a7c68bdca694f071d7aa894e8637dc83f4a68fe322546", + "zh:5f03db9f1d77e8274ff4750ae32d5c16c42b862b06bcb0683e4d733c8db922e4", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:8190142ae8a539ab34193b7e75da0fa04035d1dcd8af8be94df1eafeeffb44b6", + "zh:8cdc7cd9221e27c189e5beaf78462fce4c2edb081f415a1eafc6da2949de31e2", + "zh:a5de0f7f5d63c59ebf61d3c1d94040f410665ff0aa04f66674efe24b39a11f94", + "zh:a9fce48db3c140cc3e06f8a3c7ef4d36735e457e7660442d6d5dcd2b0781adc3", + "zh:beb92de584c790c7c7f047e45ccd22b6ee3263c7b5a91ae4d6882ae6e7700570", + "zh:f373f8cc52846fb513f44f468d885f722ca4dc22af9ff1942368cafd16b796b3", + "zh:f69627fd6e5a920b17ff423cdbad2715078ca6d13146dc67668795582ab43748", ] } diff --git a/main.tf b/main.tf index 556d08a..969bc74 100644 --- a/main.tf +++ b/main.tf @@ -1,4 +1,4 @@ -provider "metal" { +provider "equinix" { auth_token = var.metal_auth_token } @@ -12,7 +12,7 @@ resource "random_string" "cluster_suffix" { upper = false } -resource "metal_project" "new_project" { +resource "equinix_metal_project" "new_project" { count = var.metal_create_project ? 1 : 0 name = var.metal_project_name organization_id = var.metal_organization_id @@ -28,7 +28,7 @@ locals { timestamp = timestamp() timestamp_sanitized = replace(local.timestamp, "/[- TZ:]/", "") ssh_key_name = format("anthos-%s-%s", var.cluster_name, random_string.cluster_suffix.result) - metal_project_id = var.metal_create_project ? metal_project.new_project[0].id : var.metal_project_id + metal_project_id = var.metal_create_project ? equinix_metal_project.new_project[0].id : var.metal_project_id gcr_sa_key = var.gcp_keys_path == "" ? base64decode(google_service_account_key.gcr_sa_key[0].private_key) : file("${var.gcp_keys_path}/gcr.json") connect_sa_key = var.gcp_keys_path == "" ? base64decode(google_service_account_key.connect_sa_key[0].private_key) : file("${var.gcp_keys_path}/connect.json") register_sa_key = var.gcp_keys_path == "" ? base64decode(google_service_account_key.register_sa_key[0].private_key) : file("${var.gcp_keys_path}/register.json") @@ -42,7 +42,7 @@ resource "tls_private_key" "ssh_key_pair" { rsa_bits = 4096 } -resource "metal_ssh_key" "ssh_pub_key" { +resource "equinix_metal_ssh_key" "ssh_pub_key" { name = local.cluster_name public_key = chomp(tls_private_key.ssh_key_pair.public_key_openssh) } @@ -53,14 +53,14 @@ resource "local_file" "cluster_private_key_pem" { file_permission = "0600" } -resource "metal_reserved_ip_block" "cp_vip" { +resource "equinix_metal_reserved_ip_block" "cp_vip" { project_id = local.metal_project_id metro = var.metro quantity = 1 description = format("Cluster: '%s' Contol Plane VIP", local.cluster_name) } -resource "metal_reserved_ip_block" "ingress_vip" { +resource "equinix_metal_reserved_ip_block" "ingress_vip" { project_id = local.metal_project_id metro = var.metro quantity = 1 @@ -94,7 +94,7 @@ data "cloudinit_config" "cp_user_data" { kube_vip_install = templatefile("${path.module}/templates/kube_vip_install.sh", { cluster_name = local.cluster_name - eip = cidrhost(metal_reserved_ip_block.cp_vip.cidr_notation, 0) + eip = cidrhost(equinix_metal_reserved_ip_block.cp_vip.cidr_notation, 0) count = 0 kube_vip_ver = var.kube_vip_version auth_token = var.metal_auth_token @@ -126,9 +126,9 @@ data "cloudinit_config" "worker_user_data" { } -resource "metal_device" "control_plane" { +resource "equinix_metal_device" "control_plane" { depends_on = [ - metal_ssh_key.ssh_pub_key + equinix_metal_ssh_key.ssh_pub_key ] count = local.cp_count hostname = format("%s-cp-%02d", local.cluster_name, count.index + 1) @@ -141,9 +141,9 @@ resource "metal_device" "control_plane" { tags = ["anthos", "baremetal", "control-plane"] } -resource "metal_device" "worker_nodes" { +resource "equinix_metal_device" "worker_nodes" { depends_on = [ - metal_ssh_key.ssh_pub_key + equinix_metal_ssh_key.ssh_pub_key ] count = var.worker_count hostname = format("%s-worker-%02d", local.cluster_name, count.index + 1) @@ -156,15 +156,15 @@ resource "metal_device" "worker_nodes" { tags = ["anthos", "baremetal", "worker"] } -resource "metal_bgp_session" "enable_cp_bgp" { +resource "equinix_metal_bgp_session" "enable_cp_bgp" { count = local.cp_count - device_id = element(metal_device.control_plane.*.id, count.index) + device_id = element(equinix_metal_device.control_plane.*.id, count.index) address_family = "ipv4" } -resource "metal_bgp_session" "enable_worker_bgp" { +resource "equinix_metal_bgp_session" "enable_worker_bgp" { count = var.worker_count - device_id = element(metal_device.worker_nodes.*.id, count.index) + device_id = element(equinix_metal_device.worker_nodes.*.id, count.index) address_family = "ipv4" } @@ -177,7 +177,7 @@ resource "null_resource" "prep_anthos_cluster" { type = "ssh" user = "root" private_key = chomp(tls_private_key.ssh_key_pair.private_key_pem) - host = metal_device.control_plane.0.access_public_ipv4 + host = equinix_metal_device.control_plane.0.access_public_ipv4 } @@ -185,12 +185,12 @@ resource "null_resource" "prep_anthos_cluster" { content = templatefile("${path.module}/templates/pre_reqs.sh", { cluster_name = local.cluster_name operating_system = var.operating_system - cp_vip = cidrhost(metal_reserved_ip_block.cp_vip.cidr_notation, 0) - ingress_vip = cidrhost(metal_reserved_ip_block.ingress_vip.cidr_notation, 0) - cp_ips = join(" ", metal_device.control_plane.*.access_private_ipv4) - cp_ids = join(" ", metal_device.control_plane.*.id) - worker_ips = join(" ", metal_device.worker_nodes.*.access_private_ipv4) - worker_ids = join(" ", metal_device.worker_nodes.*.id) + cp_vip = cidrhost(equinix_metal_reserved_ip_block.cp_vip.cidr_notation, 0) + ingress_vip = cidrhost(equinix_metal_reserved_ip_block.ingress_vip.cidr_notation, 0) + cp_ips = join(" ", equinix_metal_device.control_plane.*.access_private_ipv4) + cp_ids = join(" ", equinix_metal_device.control_plane.*.id) + worker_ips = join(" ", equinix_metal_device.worker_nodes.*.access_private_ipv4) + worker_ids = join(" ", equinix_metal_device.worker_nodes.*.id) anthos_ver = var.anthos_version }) destination = "/root/bootstrap/pre_reqs.sh" @@ -212,7 +212,7 @@ resource "null_resource" "deploy_anthos_cluster" { type = "ssh" user = "root" private_key = chomp(tls_private_key.ssh_key_pair.private_key_pem) - host = metal_device.control_plane.0.access_public_ipv4 + host = equinix_metal_device.control_plane.0.access_public_ipv4 } provisioner "remote-exec" { inline = [ @@ -225,21 +225,21 @@ resource "null_resource" "download_kube_config" { depends_on = [null_resource.deploy_anthos_cluster] provisioner "local-exec" { - command = "scp -i ~/.ssh/${local.ssh_key_name} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@${metal_device.control_plane.0.access_public_ipv4}:/root/baremetal/bmctl-workspace/${local.cluster_name}/${local.cluster_name}-kubeconfig ." + command = "scp -i ~/.ssh/${local.ssh_key_name} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@${equinix_metal_device.control_plane.0.access_public_ipv4}:/root/baremetal/bmctl-workspace/${local.cluster_name}/${local.cluster_name}-kubeconfig ." } } resource "null_resource" "kube_vip_install_first_cp" { depends_on = [ - metal_bgp_session.enable_cp_bgp, - metal_bgp_session.enable_worker_bgp, + equinix_metal_bgp_session.enable_cp_bgp, + equinix_metal_bgp_session.enable_worker_bgp, null_resource.prep_anthos_cluster, ] connection { type = "ssh" user = "root" private_key = chomp(tls_private_key.ssh_key_pair.private_key_pem) - host = metal_device.control_plane.0.access_public_ipv4 + host = equinix_metal_device.control_plane.0.access_public_ipv4 } provisioner "remote-exec" { inline = [ @@ -258,16 +258,16 @@ resource "null_resource" "add_remaining_cps" { type = "ssh" user = "root" private_key = chomp(tls_private_key.ssh_key_pair.private_key_pem) - host = metal_device.control_plane.0.access_public_ipv4 + host = equinix_metal_device.control_plane.0.access_public_ipv4 } provisioner "file" { content = templatefile("${path.module}/templates/add_remaining_cps.sh", { cluster_name = local.cluster_name - cp_ip_2 = metal_device.control_plane.1.access_private_ipv4 - cp_id_2 = metal_device.control_plane.1.id - cp_ip_3 = metal_device.control_plane.2.access_private_ipv4 - cp_id_3 = metal_device.control_plane.2.id + cp_ip_2 = equinix_metal_device.control_plane.1.access_private_ipv4 + cp_id_2 = equinix_metal_device.control_plane.1.id + cp_ip_3 = equinix_metal_device.control_plane.2.access_private_ipv4 + cp_id_3 = equinix_metal_device.control_plane.2.id }) destination = "/root/bootstrap/add_remaining_cps.sh" } @@ -287,7 +287,7 @@ resource "null_resource" "kube_vip_install_remaining_cp" { type = "ssh" user = "root" private_key = chomp(tls_private_key.ssh_key_pair.private_key_pem) - host = element(metal_device.control_plane.*.access_public_ipv4, count.index + 1) + host = element(equinix_metal_device.control_plane.*.access_public_ipv4, count.index + 1) } provisioner "remote-exec" { inline = ["mkdir -p /root/bootstrap"] @@ -295,7 +295,7 @@ resource "null_resource" "kube_vip_install_remaining_cp" { provisioner "file" { content = templatefile("${path.module}/templates/kube_vip_install.sh", { cluster_name = local.cluster_name - eip = cidrhost(metal_reserved_ip_block.cp_vip.cidr_notation, 0) + eip = cidrhost(equinix_metal_reserved_ip_block.cp_vip.cidr_notation, 0) count = 1 kube_vip_ver = var.kube_vip_version auth_token = var.metal_auth_token @@ -321,7 +321,7 @@ resource "null_resource" "install_ccm" { type = "ssh" user = "root" private_key = chomp(tls_private_key.ssh_key_pair.private_key_pem) - host = metal_device.control_plane.0.access_public_ipv4 + host = equinix_metal_device.control_plane.0.access_public_ipv4 } provisioner "remote-exec" { @@ -340,7 +340,7 @@ resource "null_resource" "install_kube_vip_daemonset" { type = "ssh" user = "root" private_key = chomp(tls_private_key.ssh_key_pair.private_key_pem) - host = metal_device.control_plane.0.access_public_ipv4 + host = equinix_metal_device.control_plane.0.access_public_ipv4 } provisioner "file" { content = templatefile("${path.module}/templates/kube_vip_ds.yaml", { @@ -363,11 +363,11 @@ module "storage" { ] ssh = { - host = metal_device.control_plane.0.access_public_ipv4 + host = equinix_metal_device.control_plane.0.access_public_ipv4 private_key = chomp(tls_private_key.ssh_key_pair.private_key_pem) user = "root" kubeconfig = "/root/baremetal/bmctl-workspace/${local.cluster_name}/${local.cluster_name}-kubeconfig" - worker_addresses = metal_device.worker_nodes.*.access_public_ipv4 + worker_addresses = equinix_metal_device.worker_nodes.*.access_public_ipv4 } cluster_name = local.cluster_name diff --git a/output.tf b/output.tf index 2c2f458..e541d4a 100644 --- a/output.tf +++ b/output.tf @@ -1,10 +1,10 @@ output "Control_Plane_Public_IPs" { - value = metal_device.control_plane.*.access_public_ipv4 + value = equinix_metal_device.control_plane.*.access_public_ipv4 description = "Control Plane Public IPs" } output "Worker_Public_IPs" { - value = metal_device.worker_nodes.*.access_public_ipv4 + value = equinix_metal_device.worker_nodes.*.access_public_ipv4 description = "Worker Node Public IPs" } @@ -14,12 +14,12 @@ output "ssh_key_location" { } output "Control_Plane_VIP" { - value = cidrhost(metal_reserved_ip_block.cp_vip.cidr_notation, 0) + value = cidrhost(equinix_metal_reserved_ip_block.cp_vip.cidr_notation, 0) description = "The Virtual IP for the Control Plane" } output "Ingress_VIP" { - value = cidrhost(metal_reserved_ip_block.ingress_vip.cidr_notation, 0) + value = cidrhost(equinix_metal_reserved_ip_block.ingress_vip.cidr_notation, 0) description = "The Virtual IP for Ingress" } diff --git a/versions.tf b/versions.tf index 77be853..2fa794c 100644 --- a/versions.tf +++ b/versions.tf @@ -3,8 +3,8 @@ terraform { null = { source = "hashicorp/null" } - metal = { - source = "equinix/metal" + equinix = { + source = "equinix/equinix" } random = { source = "hashicorp/random"