Skip to content

Commit

Permalink
add test-infra acctest for equinixmetal
Browse files Browse the repository at this point in the history
Signed-off-by: Marques Johansson <[email protected]>
  • Loading branch information
displague committed Sep 1, 2022
1 parent c3812be commit 98e7e5c
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,12 @@ jobs:
- acctest:
provider-test-infra-dir: triton
provider-go-test-dir: triton

equinixmetal-provider:
executor: go
steps:
- acctest:
provider-test-infra-dir: equinixmetal
provider-go-test-dir: equinixmetal
workflows:
version: 2
acceptance:
Expand Down Expand Up @@ -253,3 +258,7 @@ workflows:
requires:
- go-test
filters: *ignore_prs
- equinixmetal-provider:
requires:
- go-test
filters: *ignore_prs
46 changes: 46 additions & 0 deletions test/tf/equinixmetal/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
provider "metal" {
version = "~> 2.8.1"
}

provider "random" {
version = "~> 2.2.1"
}

variable "metro" {
default = ["sv"]
}

variable "tags" {
default = ["tag1", "tag1", "tag2", "tag3"]
}

variable "metal_project" {
description = "Existing Equinix Metal project"
}

resource "random_string" "vm_name_suffix" {
count = 4
length = 8
upper = false
special = false
}

resource "metal_device" "discover-metal01" {
count = 4
hostname = "go-discover.metal-device-${element(random_string.vm_name_suffix.*.result, count.index)}"
plan = "c3.small.x86"
metro = var.metro
# TF-UPGRADE-TODO: In Terraform v0.10 and earlier, it was sometimes necessary to
# force an interpolation expression to be interpreted as a list by wrapping it
# in an extra set of list brackets. That form was supported for compatibility in
# v0.11, but is no longer supported in Terraform v0.12.
#
# If the expression in the following list itself returns a list, remove the
# brackets to avoid interpretation as a list of lists. If the expression
# returns a single list item then leave it as-is and remove this TODO comment.
tags = [element(var.tags, count.index)]
operating_system = "ubuntu_18_04"
billing_cycle = "hourly"
project_id = var.metal_project
}

10 changes: 10 additions & 0 deletions test/tf/equinixmetal/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

terraform {
required_version = ">= 0.13"
required_providers {
metal = {
source = "equinix/metal"
version = "~> 2.1"
}
}
}

0 comments on commit 98e7e5c

Please sign in to comment.