This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from packet-labs/use-vsphere-module
use Equinix Metal VMWare vSphere module
- Loading branch information
Showing
32 changed files
with
473 additions
and
2,089 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
name: 'integration' | ||
# This workflow intends to verify that the module provisions | ||
# successfully for all software and infrastructure defined. | ||
# https://learn.hashicorp.com/tutorials/terraform/automate-terraform | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
paths-ignore: | ||
- 'LICENSE' | ||
- '**.md' | ||
|
||
jobs: | ||
integrate: | ||
name: Integration Tests | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 120 | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
tf: [0.14.8] | ||
vsphere: | ||
#- vmware_os: vmware_esxi_6_7 | ||
# vcenter_iso: VMware-VCSA-all-6.7.0-14367737.iso | ||
- vmware_os: vmware_esxi_7_0 | ||
vcenter_iso: VMware-VCSA-all-7.0.0-16189094.iso | ||
env: | ||
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | ||
TF_IN_AUTOMATION: 1 | ||
TF_VERSION: ${{ matrix.tf }} | ||
TF_VAR_control_plane_node_count: 0 | ||
TF_VAR_vcenter_iso_name: ${{ matrix.vsphere.vcenter_iso }} | ||
TF_VAR_vmware_os: ${{ matrix.vsphere.vmware_os }} | ||
TF_VAR_esxi_host_count: 2 | ||
TF_VAR_esxi_size: "c3.medium.x86" | ||
TF_VAR_router_size: "c2.medium.x86" | ||
TF_VAR_facility: "sjc1" | ||
TF_VAR_create_project : false | ||
# TODO only provide this to terraform steps that need it | ||
TF_VAR_auth_token: ${{ secrets.METAL_AUTH_TOKEN }} | ||
TF_VAR_organization_id: ${{ secrets.METAL_ORGANIZATION_ID }} | ||
TF_VAR_s3_url: ${{ secrets.S3_URL }} | ||
TF_VAR_object_store_bucket_name: ${{ secrets.S3_BUCKET_NAME }} | ||
TF_VAR_s3_access_key: ${{ secrets.S3_ACCESS_KEY }} | ||
TF_VAR_s3_secret_key: ${{ secrets.S3_SECRET_KEY }} | ||
TF_VAR_s3_boolean: true | ||
TF_VAR_anthos_version: "1.4.0-gke.13" | ||
TF_VAR_anthos_gcp_project_id: ${{ secrets.ANTHOS_GCP_PROJECT_ID }} | ||
# TODO remove this secret and variable if the "Cluster Name" setting works below | ||
TF_VAR_anthos_user_cluster_name: ${{ secrets.ANTHOS_USER_CLUSTER_NAME }} | ||
steps: | ||
- name: Checkout from Github | ||
uses: actions/checkout@v2 | ||
- name: Add SHORT_SHA env property with commit short sha | ||
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV | ||
|
||
- name: Install Terraform | ||
uses: hashicorp/setup-terraform@v1 | ||
with: | ||
terraform_version: ${{ env.TF_VERSION }} | ||
- name: GCP Keys | ||
env: | ||
GCP_CONNECT_KEY: ${{ secrets.GCP_CONNECT_KEY }} | ||
GCP_REGISTER_KEY: ${{ secrets.GCP_REGISTER_KEY }} | ||
GCP_STACKDRIVER_KEY: ${{ secrets.GCP_STACKDRIVER_KEY }} | ||
GCP_STORAGE_READER_KEY: ${{ secrets.GCP_STORAGE_READER_KEY }} | ||
GCP_WHITELISTED_KEY: ${{ secrets.GCP_WHITELISTED_KEY }} | ||
run: | | ||
mkdir -p anthos/gcp_keys | ||
echo "${GCP_CONNECT_KEY}" > anthos/gcp_keys/connect-key.json | ||
echo "${GCP_REGISTER_KEY}" > anthos/gcp_keys/register-key.json | ||
echo "${GCP_STACKDRIVER_KEY}" > anthos/gcp_keys/stackdriver-key.json | ||
echo "${GCP_STORAGE_READER_KEY}" > anthos/gcp_keys/storage-reader-key.json | ||
echo "${GCP_WHITELISTED_KEY}" > anthos/gcp_keys/whitelisted-key.json | ||
- name: Initialize Terraform, Modules, and Plugins | ||
id: init | ||
run: terraform init -input=false | ||
- id: project | ||
uses: displague/[email protected] | ||
env: | ||
METAL_AUTH_TOKEN: ${{ secrets.METAL_AUTH_TOKEN }} | ||
# Configure an SSH Agent with a key that can access the project | ||
- name: SSH Agent | ||
run: | | ||
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | ||
ssh-add <(echo $METAL_SSH_PRIVATE_KEY_BASE64 | base64 -d) | ||
- name: Terraform Vars - Cluster Name | ||
# TODO can we use this as a the anthos user cluster name? | ||
run: | | ||
echo "TF_VAR_vcenter_cluster_name=tfacc-${SHORT_SHA}" >> $GITHUB_ENV | ||
echo "TF_VAR_anthos_user_cluster_name=tfacc-${SHORT_SHA}" >> $GITHUB_ENV | ||
- name: Terraform Vars - Project ID | ||
run: echo "TF_VAR_project_id=${{ steps.project.outputs.projectID }}" >> $GITHUB_ENV | ||
- name: Terraform Plan | ||
id: plan | ||
timeout-minutes: 120 | ||
run: terraform plan -out=tfplan -input=false | ||
- name: Terraform Apply | ||
id: apply | ||
timeout-minutes: 120 | ||
run: terraform apply -input=false tfplan | ||
- name: Terraform Destroy | ||
id: destroy | ||
if: ${{ always() }} | ||
run: terraform destroy -input=false -auto-approve | ||
- name: Project Delete | ||
if: ${{ always() }} | ||
uses: displague/[email protected] | ||
with: | ||
keepProject: 'false' | ||
env: | ||
METAL_PROJECT_ID: ${{ steps.project.outputs.projectID }} | ||
METAL_AUTH_TOKEN: ${{ secrets.METAL_AUTH_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: 'terraform' | ||
# This workflow verifies that the Terraform configs are valid, | ||
# without running Google Anthos or building any Packet infrastructure. | ||
# https://learn.hashicorp.com/tutorials/terraform/automate-terraform | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
TF_IN_AUTOMATION: 1 | ||
TF_VERSION: ${{ matrix.tf }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
tf: [0.14.8] | ||
steps: | ||
- name: Checkout from Github | ||
uses: actions/checkout@v2 | ||
- name: Install Terraform | ||
uses: hashicorp/setup-terraform@v1 | ||
with: | ||
terraform_version: ${{ env.TF_VERSION }} | ||
- name: Check Terraform formatting | ||
id: fmt | ||
run: terraform fmt | ||
continue-on-error: true | ||
- name: Initialize Terraform, Modules, and Plugins | ||
id: init | ||
run: terraform init -input=false | ||
- name: Validate Terraform syntax | ||
id: validate | ||
run: terraform validate -no-color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
/.terraform* | ||
/override.tf | ||
/terraform.tfvars | ||
**/.terraform/* | ||
*.tfstate | ||
*.tfstate.* | ||
crash.log | ||
*.tfvars | ||
override.tf | ||
override.tf.json | ||
*_override.tf | ||
*_override.tf.json | ||
terraform.tfvars | ||
.terraformrc | ||
terraform.rc | ||
/anthos_ssh_priv_key | ||
/anthos/gcp_keys/* | ||
terraform.tfstate* | ||
/ksa_token.txt |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module "vsphere" { | ||
source = "equinix/vsphere/metal" | ||
version = "2.3.0" | ||
|
||
auth_token = var.auth_token | ||
organization_id = var.organization_id | ||
project_name = var.project_name | ||
create_project = var.create_project | ||
project_id = var.project_id | ||
private_subnets = var.private_subnets | ||
public_subnets = var.public_subnets | ||
router_hostname = var.router_hostname | ||
esxi_hostname = var.esxi_hostname | ||
router_size = var.router_size | ||
esxi_size = var.esxi_size | ||
facility = var.facility | ||
router_os = var.router_os | ||
vmware_os = var.vmware_os | ||
billing_cycle = var.billing_cycle | ||
esxi_host_count = var.esxi_host_count | ||
vcenter_portgroup_name = var.vcenter_portgroup_name | ||
domain_name = var.domain_name | ||
vpn_user = var.vpn_user | ||
vcenter_datacenter_name = var.vcenter_datacenter_name | ||
vcenter_cluster_name = var.vcenter_cluster_name | ||
vcenter_domain = var.vcenter_domain | ||
vcenter_user_name = var.vcenter_user_name | ||
s3_url = var.s3_url | ||
s3_access_key = var.s3_access_key | ||
s3_secret_key = var.s3_secret_key | ||
s3_version = var.s3_version | ||
object_store_tool = var.object_store_tool | ||
object_store_bucket_name = var.object_store_bucket_name | ||
relative_path_to_gcs_key = var.relative_path_to_gcs_key | ||
vcenter_iso_name = var.vcenter_iso_name | ||
} |
Oops, something went wrong.