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

use metal_ variables instead of equinix_metal_ #85

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: 'terraform'
on:
push:
branches:
- master
- main
pull_request:

jobs:
Expand All @@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
tf: [0.13.2]
tf: [1]
steps:
- name: Checkout from Github
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ override.tf.json
# Include override files you do wish to add to version control using negated pattern
#
# !example_override.tf
!.terraform.lock.hcl
.terraform.lock.hcl

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*
Expand Down
153 changes: 0 additions & 153 deletions .terraform.lock.hcl

This file was deleted.

16 changes: 8 additions & 8 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
provider "equinix" {
auth_token = var.equinix_metal_auth_token
auth_token = var.metal_auth_token
}

provider "google" {
Expand All @@ -13,9 +13,9 @@ resource "random_string" "cluster_suffix" {
}

resource "equinix_metal_project" "new_project" {
count = var.equinix_metal_create_project ? 1 : 0
name = var.equinix_metal_project_name
organization_id = var.equinix_metal_organization_id
count = var.metal_create_project ? 1 : 0
name = var.metal_project_name
organization_id = var.metal_organization_id
bgp_config {
deployment_type = "local"
asn = var.bgp_asn
Expand All @@ -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.equinix_metal_create_project ? equinix_metal_project.new_project[0].id : var.equinix_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")
Expand Down Expand Up @@ -97,12 +97,12 @@ data "cloudinit_config" "cp_user_data" {
eip = cidrhost(equinix_metal_reserved_ip_block.cp_vip.cidr_notation, 0)
count = 0
kube_vip_ver = var.kube_vip_version
auth_token = var.equinix_metal_auth_token
auth_token = var.metal_auth_token
project_id = local.metal_project_id
})

ccm_secret = templatefile("${path.module}/templates/ccm_secret.yaml", {
auth_token = var.equinix_metal_auth_token
auth_token = var.metal_auth_token
project_id = local.metal_project_id
})
})
Expand Down Expand Up @@ -298,7 +298,7 @@ resource "null_resource" "kube_vip_install_remaining_cp" {
eip = cidrhost(equinix_metal_reserved_ip_block.cp_vip.cidr_notation, 0)
count = 1
kube_vip_ver = var.kube_vip_version
auth_token = var.equinix_metal_auth_token
auth_token = var.metal_auth_token
project_id = local.metal_project_id
})

Expand Down
12 changes: 6 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
variable "equinix_metal_auth_token" {
variable "metal_auth_token" {
type = string
description = "Equinix Metal API Key"
}

variable "equinix_metal_project_id" {
variable "metal_project_id" {
type = string
default = "null"
description = "Equinix Metal Project ID"
}

variable "equinix_metal_organization_id" {
variable "metal_organization_id" {
type = string
default = "null"
description = "Equinix Metal Organization ID"
Expand Down Expand Up @@ -73,13 +73,13 @@ variable "cluster_name" {
}
}

variable "equinix_metal_create_project" {
variable "metal_create_project" {
type = bool
default = true
description = "Create a Metal Project if this is 'true'. Else use provided 'equinix_metal_project_id'"
description = "Create a Metal Project if this is 'true'. Else use provided 'metal_project_id'"
}

variable "equinix_metal_project_name" {
variable "metal_project_name" {
type = string
default = "baremetal-anthos"
description = "The name of the Metal project if 'create_project' is 'true'."
Expand Down