Skip to content

Commit

Permalink
addung hashiqube example
Browse files Browse the repository at this point in the history
  • Loading branch information
star3am committed Jun 25, 2024
1 parent d2e72cc commit 4c190d8
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
**.DS_Store
*.zip
**.terraform
**terraform.auto.tfvars
**.tfstate**
**.backup
**.rli
Expand Down
47 changes: 47 additions & 0 deletions localstack/hashiqube/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Deploy HashiQube on AWS, GCP, Azure or All of them

You simple need to configure your Cloud authentication, and this is done by exporting the following Environment variables, be sure to look at the helpful links

## Authentication

Azure: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/service_principal_client_secret#creating-a-service-principal
AWS: https://registry.terraform.io/providers/hashicorp/aws/latest/docs#environment-variables
GCP: https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference.html#authentication-configuration

# https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/service_principal_client_secret#creating-a-service-principal
export AWS_ACCESS_KEY_ID=YOUR_AWS_ACCESS_KEY_ID
export AWS_SECRET_ACCESS_KEY=YOUR_AWS_SECRET_ACCESS_KEY
export AWS_REGION=YOUR_AWS_REGION

# https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference.html#authentication-configuration
export GOOGLE_CREDENTIALS='YOUR_GOOGLE_CREDENTIALS_FILE_JSON'

# https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/service_principal_client_secret#creating-a-service-principal
export ARM_CLIENT_ID=YOUR_ARM_CLIENT_ID
export ARM_CLIENT_SECRET=YOUR_ARM_CLIENT_SECRET
export ARM_SUBSCRIPTION_ID=YOUR_ARM_SUBSCRIPTION_ID
export ARM_TENANT_ID=YOUR_ARM_TENANT_ID

## Terraform Auto TFVars

Rename localstack/hashiqube/terraform.auto.tfvars.example to localstack/hashiqube/terraform.auto.tfvars

Add your SSH Public Key and Private key in localstack/hashiqube/terraform.auto.tfvars

You should already have Terraform installed, if you don't see this link: https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli

## Run Terraform

Now you can run:

- terraform init
- terraform plan
- terraform apply

You will see HashiQube launching and it will stream the User Data debug output,

For further reading see:

- https://hashiqube.com
- https://registry.terraform.io/modules/star3am/hashiqube/hashicorp/latest

42 changes: 42 additions & 0 deletions localstack/hashiqube/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
terraform {
required_version = "~> 1.5"

required_providers {
# https://registry.terraform.io/providers/hashicorp/aws/latest
aws = {
source = "hashicorp/aws"
version = "~> 4.67"
}
external = {
source = "hashicorp/external"
version = "~> 2.3"
}
null = {
source = "hashicorp/null"
version = "~> 3.0"
}
}
}

data "external" "myipaddress" {
program = ["bash", "-c", "curl -m 10 -sk 'https://api.ipify.org?format=json'"]
}

provider "aws" {}

module "hashiqube" {
source = "star3am/hashiqube/hashicorp//modules/aws-hashiqube"
version = "1.1.6"

deploy_to_aws = true
aws_instance_type = "t2.large"
use_packer_image = false
deploy_to_azure = false
deploy_to_gcp = false
debug_user_data = true
ssh_private_key = var.ssh_private_key
ssh_public_key = var.ssh_public_key
docker_version = "5:24.0.8-1~ubuntu.22.04~jammy"
whitelist_cidrs = ["${data.external.myipaddress.result.ip}/32"]
vagrant_provisioners = "basetools,docker,minikube,ansible-tower"
}
6 changes: 6 additions & 0 deletions localstack/hashiqube/terraform.auto.tfvars.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ssh_public_key = "ssh-rsa AAAA... PASTE YOUR SSH PUBLIC KEY IN HERE"
ssh_private_key = <<EOF
-----BEGIN OPENSSH PRIVATE KEY-----
PASTE YOUR SSH PRTIVATE KEY IN HERE
-----END OPENSSH PRIVATE KEY-----
EOF
2 changes: 2 additions & 0 deletions localstack/hashiqube/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
variable "ssh_private_key" {}
variable "ssh_public_key" {}

0 comments on commit 4c190d8

Please sign in to comment.