-
-
Notifications
You must be signed in to change notification settings - Fork 47
/
main.tf
133 lines (124 loc) · 5.92 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# A Terraform module to bring up Hashiqube in the Cloud.
# https://hashiqube.com
# DO NOT USE THIS IN PRODUCTION
terraform {
required_providers {
# https://registry.terraform.io/providers/hashicorp/aws/latest
aws = {
source = "hashicorp/aws"
version = "~> 4.67"
}
# https://registry.terraform.io/providers/hashicorp/azurerm/latest
azurerm = {
source = "hashicorp/azurerm"
version = "3.57.0"
}
# https://registry.terraform.io/providers/hashicorp/google/latest
google = {
source = "hashicorp/google"
version = "~> 4.66"
}
}
}
provider "aws" {
region = var.aws_region
# Default authentication is via ENV variables see: https://registry.terraform.io/providers/hashicorp/aws/latest/docs#environment-variables
# shared_credentials_files = [file(var.aws_credentials)]
# profile = var.aws_profile
}
provider "azurerm" {
# Default authentication is via ENV variables see: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/service_principal_client_secret#creating-a-service-principal
features {}
}
provider "google" {
# Default authentication is via ENV variables see: https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference.html#authentication-configuration
# credentials = file(var.gcp_credentials)
project = var.gcp_project
region = var.gcp_region
}
data "external" "myipaddress" {
program = ["bash", "-c", "curl -m 10 -sk 'https://api.ipify.org?format=json'"]
}
resource "null_resource" "hashiqube" {
triggers = {
deploy_to_azure = var.deploy_to_azure
deploy_to_gcp = var.deploy_to_gcp
deploy_to_aws = var.deploy_to_aws
debug_user_data = var.debug_user_data
my_ipaddress = data.external.myipaddress.result.ip
vagrant_provisioners = var.vagrant_provisioners
}
}
module "gcp-hashiqube" {
count = var.deploy_to_gcp ? 1 : 0
# When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you
# to a specific version of the modules, such as the following example:
# source = "git::[email protected]:star3am/terraform-hashicorp-hashiqube.git//modules/gcp-hashiqube?ref=v0.0.1"
source = "./modules/gcp-hashiqube"
deploy_to_aws = var.deploy_to_aws
deploy_to_azure = var.deploy_to_azure
deploy_to_gcp = var.deploy_to_gcp
whitelist_cidr = var.whitelist_cidr
gcp_project = var.gcp_project
gcp_credentials = var.gcp_credentials
gcp_cluster_description = var.gcp_cluster_description
gcp_cluster_name = var.gcp_cluster_name
gcp_cluster_size = var.gcp_cluster_size
gcp_machine_type = var.gcp_machine_type
gcp_region = var.gcp_region
gcp_account_id = var.gcp_account_id
gcp_root_volume_disk_size_gb = var.gcp_root_volume_disk_size_gb
gcp_root_volume_disk_type = var.gcp_root_volume_disk_type
gcp_zones = var.gcp_zones
gcp_cluster_tag_name = var.gcp_cluster_tag_name
gcp_custom_metadata = var.gcp_custom_metadata
ssh_public_key = var.ssh_public_key
ssh_private_key = var.ssh_private_key
debug_user_data = var.debug_user_data
aws_hashiqube_ip = var.deploy_to_aws ? try(module.aws-hashiqube[0].hashiqube_ip, null) : null
azure_hashiqube_ip = var.deploy_to_azure ? try(module.azure-hashiqube[0].hashiqube_ip, null) : null
my_ipaddress = data.external.myipaddress.result.ip
vagrant_provisioners = var.vagrant_provisioners
}
module "aws-hashiqube" {
count = var.deploy_to_aws ? 1 : 0
# When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you
# to a specific version of the modules, such as the following example:
# source = "git::[email protected]:star3am/terraform-hashicorp-hashiqube.git//modules/aws-hashiqube?ref=v0.0.1"
source = "./modules/aws-hashiqube"
deploy_to_aws = var.deploy_to_aws
deploy_to_azure = var.deploy_to_azure
deploy_to_gcp = var.deploy_to_gcp
ssh_public_key = var.ssh_public_key
ssh_private_key = var.ssh_private_key
debug_user_data = var.debug_user_data
aws_credentials = var.aws_credentials
aws_instance_type = var.aws_instance_type
aws_profile = var.aws_profile
aws_region = var.aws_region
whitelist_cidr = var.whitelist_cidr
azure_hashiqube_ip = var.deploy_to_azure ? try(module.azure-hashiqube[0].hashiqube_ip, null) : null
gcp_hashiqube_ip = var.deploy_to_gcp ? try(module.gcp-hashiqube[0].hashiqube_ip, null) : null
my_ipaddress = data.external.myipaddress.result.ip
vagrant_provisioners = var.vagrant_provisioners
}
module "azure-hashiqube" {
count = var.deploy_to_azure ? 1 : 0
# When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you
# to a specific version of the modules, such as the following example:
# source = "git::[email protected]:star3am/terraform-hashicorp-hashiqube.git//modules/azure-hashiqube?ref=v0.0.1"
source = "./modules/azure-hashiqube"
deploy_to_aws = var.deploy_to_aws
deploy_to_azure = var.deploy_to_azure
deploy_to_gcp = var.deploy_to_gcp
whitelist_cidr = var.whitelist_cidr
ssh_public_key = var.ssh_public_key
ssh_private_key = var.ssh_private_key
debug_user_data = var.debug_user_data
aws_hashiqube_ip = var.deploy_to_aws ? try(module.aws-hashiqube[0].hashiqube_ip, null) : null
gcp_hashiqube_ip = var.deploy_to_gcp ? try(module.gcp-hashiqube[0].hashiqube_ip, null) : null
my_ipaddress = data.external.myipaddress.result.ip
azure_region = var.azure_region
azure_instance_type = var.azure_instance_type
vagrant_provisioners = var.vagrant_provisioners
}