Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change provider from deprecated Metal provider to Equinix #63

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
ssh-add <(echo $METAL_SSH_PRIVATE_KEY_BASE64 | base64 -d)
# Arrays of strings are hard to define via TF env vars (in yaml)
- run: |
echo 'metal_facilities = ["da11"]' > terraform.tfvars
echo 'metal_metro = "da"' > terraform.tfvars
echo 'metal_project_id = "${{ steps.project.outputs.projectID }}"' >> terraform.tfvars
- name: Terraform Plan
id: plan
Expand Down
137 changes: 74 additions & 63 deletions .terraform.lock.hcl
100755 → 100644

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions BareMetal.tf
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
resource "metal_project" "new_project" {
resource "equinix_metal_project" "new_project" {
count = var.metal_create_project ? 1 : 0
name = (var.metal_project_name != "") ? var.metal_project_name : format("openstack-%s", random_id.cloud.b64_url)
organization_id = var.metal_organization_id
}

provider "metal" {
provider "equinix" {
auth_token = var.metal_auth_token
}

locals {
ssh_key_name = "metal-key"
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
}

resource "tls_private_key" "ssh_key_pair" {
algorithm = "RSA"
rsa_bits = 4096
}

resource "metal_ssh_key" "ssh_pub_key" {
resource "equinix_metal_ssh_key" "ssh_pub_key" {
name = random_id.cloud.b64_url
public_key = chomp(tls_private_key.ssh_key_pair.public_key_openssh)
}
Expand All @@ -35,7 +35,7 @@ resource "local_file" "cluster_public_key" {
file_permission = "0600"
}

resource "metal_device" "controller" {
resource "equinix_metal_device" "controller" {
hostname = "controller"
tags = ["openstack-${random_id.cloud.b64_url}"]

Expand All @@ -48,7 +48,7 @@ resource "metal_device" "controller" {
private_key = local_file.cluster_private_key_pem.content
}
user_data = "#cloud-config\n\nssh_authorized_keys:\n - \"${local_file.cluster_public_key.content}\""
facilities = var.metal_facilities
metro = var.metal_metro
project_id = local.metal_project_id
billing_cycle = "hourly"
# ip_address {
Expand All @@ -57,7 +57,7 @@ resource "metal_device" "controller" {
# }
}

resource "metal_device" "dashboard" {
resource "equinix_metal_device" "dashboard" {
hostname = "dashboard"
tags = ["openstack-${random_id.cloud.hex} "]

Expand All @@ -71,12 +71,12 @@ resource "metal_device" "dashboard" {
}
user_data = "#cloud-config\n\nssh_authorized_keys:\n - \"${local_file.cluster_public_key.content}\""

facilities = var.metal_facilities
metro = var.metal_metro
project_id = local.metal_project_id
billing_cycle = "hourly"
}

resource "metal_device" "compute-x86" {
resource "equinix_metal_device" "compute-x86" {
hostname = format("compute-x86-%02d", count.index)
tags = ["openstack-${random_id.cloud.hex} "]

Expand All @@ -91,12 +91,12 @@ resource "metal_device" "compute-x86" {
private_key = file(local_file.cluster_private_key_pem)
}
user_data = "#cloud-config\n\nssh_authorized_keys:\n - \"${local_file.cluster_public_key.content}\""
facilities = var.metal_facilities
metro = var.metal_metro
project_id = local.metal_project_id
billing_cycle = "hourly"
}

resource "metal_device" "compute-arm" {
resource "equinix_metal_device" "compute-arm" {
hostname = format("compute-arm-%02d", count.index)
tags = ["openstack-${random_id.cloud.hex} "]

Expand All @@ -111,7 +111,7 @@ resource "metal_device" "compute-arm" {
private_key = file(local_file.cluster_private_key_pem)
}
user_data = "#cloud-config\n\nssh_authorized_keys:\n - \"${local_file.cluster_public_key.content}\""
facilities = var.metal_facilities
metro = var.metal_metro
project_id = local.metal_project_id
billing_cycle = "hourly"
}
Expand Down
4 changes: 2 additions & 2 deletions DNS.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
# domain = "openstacksandiego.us"
# name = "controller-${random_id.cloud.hex}"
# value = "${metal_device.dashboard.access_public_ipv4}"
# value = "${equinix_metal_device.dashboard.access_public_ipv4}"
# type = "A"
# ttl = 3600
#}
Expand All @@ -26,7 +26,7 @@
#
# domain = "openstacksandiego.us"
# name = "dashboard-${random_id.cloud.hex}"
# value = "${metal_device.dashboard.access_public_ipv4}"
# value = "${equinix_metal_device.dashboard.access_public_ipv4}"
# type = "A"
# ttl = 3600
#}
4 changes: 2 additions & 2 deletions DistributeKeys.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

resource "null_resource" "controller-distribute-keys" {
connection {
host = metal_device.controller.access_public_ipv4
host = equinix_metal_device.controller.access_public_ipv4
private_key = local_file.cluster_private_key_pem.content
}

Expand All @@ -23,7 +23,7 @@ resource "null_resource" "controller-distribute-keys" {

resource "null_resource" "dashboard-distribute-keys" {
connection {
host = metal_device.dashboard.access_public_ipv4
host = equinix_metal_device.dashboard.access_public_ipv4
private_key = local_file.cluster_private_key_pem.content
}

Expand Down
16 changes: 8 additions & 8 deletions Hostfile.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ resource "null_resource" "controller-generate-hostfile" {
depends_on = [null_resource.blank-hostfile]

provisioner "local-exec" {
command = "echo ${metal_device.controller.access_private_ipv4} ${metal_device.controller.hostname} >> ${path.module}/assets/hostfile"
command = "echo ${equinix_metal_device.controller.access_private_ipv4} ${equinix_metal_device.controller.hostname} >> ${path.module}/assets/hostfile"
}
}

resource "null_resource" "dashboard-generate-hostfile" {
depends_on = [null_resource.blank-hostfile]

provisioner "local-exec" {
command = "echo ${metal_device.dashboard.access_private_ipv4} ${metal_device.dashboard.hostname} >> ${path.module}/assets/hostfile"
command = "echo ${equinix_metal_device.dashboard.access_private_ipv4} ${equinix_metal_device.dashboard.hostname} >> ${path.module}/assets/hostfile"
}
}

Expand All @@ -33,7 +33,7 @@ resource "null_resource" "compute-x86-generate-hostfile" {
count = var.openstack_compute-x86_count

provisioner "local-exec" {
command = "echo ${element(metal_device.compute-x86.*.access_private_ipv4, count.index)} ${element(metal_device.compute-x86.*.hostname, count.index)} >> ${path.module}/assets/hostfile"
command = "echo ${element(equinix_metal_device.compute-x86.*.access_private_ipv4, count.index)} ${element(equinix_metal_device.compute-x86.*.hostname, count.index)} >> ${path.module}/assets/hostfile"
}
}

Expand All @@ -43,7 +43,7 @@ resource "null_resource" "compute-arm-generate-hostfile" {
count = var.openstack_compute-arm_count

provisioner "local-exec" {
command = "echo ${element(metal_device.compute-arm.*.access_private_ipv4, count.index)} ${element(metal_device.compute-arm.*.hostname, count.index)} >> ${path.module}/assets/hostfile"
command = "echo ${element(equinix_metal_device.compute-arm.*.access_private_ipv4, count.index)} ${element(equinix_metal_device.compute-arm.*.hostname, count.index)} >> ${path.module}/assets/hostfile"
}
}

Expand All @@ -66,7 +66,7 @@ resource "null_resource" "controller-write-hostfile" {
depends_on = [null_resource.hostfile-generated]

connection {
host = metal_device.controller.access_public_ipv4
host = equinix_metal_device.controller.access_public_ipv4
private_key = local_file.cluster_private_key_pem.content
}

Expand All @@ -86,7 +86,7 @@ resource "null_resource" "dashboard-write-hostfile" {
depends_on = [null_resource.hostfile-generated]

connection {
host = metal_device.dashboard.access_public_ipv4
host = equinix_metal_device.dashboard.access_public_ipv4
private_key = local_file.cluster_private_key_pem.content
}

Expand All @@ -108,7 +108,7 @@ resource "null_resource" "compute-x86-write-hostfile" {
count = var.openstack_compute-x86_count

connection {
host = element(metal_device.compute-x86.*.access_public_ipv4, count.index)
host = element(equinix_metal_device.compute-x86.*.access_public_ipv4, count.index)
private_key = local_file.cluster_private_key_pem.content
}

Expand All @@ -130,7 +130,7 @@ resource "null_resource" "compute-arm-write-hostfile" {
count = var.openstack_compute-arm_count

connection {
host = element(metal_device.compute-arm.*.access_public_ipv4, count.index)
host = element(equinix_metal_device.compute-arm.*.access_public_ipv4, count.index)
private_key = local_file.cluster_private_key_pem.content
}

Expand Down
2 changes: 1 addition & 1 deletion OWNERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ This project is governed by [Equinix](https://metal.equinix.com) and benefits fr

Members of the Equinix Github organization will strive to triage issues in a timely manner.

See the [packethost/standards glossary](https://github.com/packethost/standards/blob/master/glossary.md#ownersmd) for more details about this file.
See the [equinix-labs/equinix-labs glossary](https://github.com/equinix-labs/equinix-labs/blob/main/glossary.md#ownersmd) for more details about this file.
Loading