Skip to content

Commit 09dc9db

Browse files
committed
First commit
1 parent bcecb60 commit 09dc9db

File tree

30 files changed

+1223
-1
lines changed

30 files changed

+1223
-1
lines changed

Deploy-CBS-Greenfield/main.tf

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
terraform {
2+
required_providers {
3+
cbs = {
4+
source = "PureStorage-OpenConnect/cbs"
5+
version = "~> 0.9.0"
6+
}
7+
azurerm = {
8+
source = "hashicorp/azurerm"
9+
}
10+
random = {
11+
source = "hashicorp/random"
12+
version = "~> 3.1.0"
13+
}
14+
}
15+
required_version = ">= 0.13"
16+
}
17+
18+
/* If Authintication via Service Principles would be used:
19+
1. Uncomment the required params from main.tf and variables.tf
20+
2. Add your service principle in terraform.tfvars */
21+
22+
provider "azurerm" {
23+
features {}
24+
# client_id = var.azure_client_id
25+
# client_secret = var.azure_client_secret
26+
# tenant_id = var.azure_tenant_id
27+
# subscription_id = var.azure_subscription_id
28+
}
29+
30+
provider "cbs" {
31+
azure {
32+
# client_id = var.azure_client_id
33+
# client_secret = var.azure_client_secret
34+
# tenant_id = var.azure_tenant_id
35+
# subscription_id = var.azure_subscription_id
36+
}
37+
}
38+
39+
resource "azurerm_resource_group" "azure_rg" {
40+
name = format("%s%s", var.resource_group_name, var.resource_group_location)
41+
location = var.resource_group_location
42+
tags = var.tags
43+
}
44+
45+
46+
module "CBS_vNET" {
47+
source = "../Modules/CBS-VNet"
48+
resource_group_name = azurerm_resource_group.azure_rg.name
49+
resource_group_location = var.resource_group_location
50+
tags = var.tags
51+
}
52+
53+
module "CBS-NAT-GW" {
54+
source = "../Modules/CBS-NAT-GW"
55+
resource_group_name = azurerm_resource_group.azure_rg.name
56+
resource_group_location = var.resource_group_location
57+
cbs_system_subnet_id = module.CBS_vNET.azure_subnet_id.cbs_subnet_sys
58+
tags = var.tags
59+
}
60+
61+
module "VM-JUMPBOX" {
62+
source = "../Modules/VM-JUMPBOX"
63+
resource_group_name = azurerm_resource_group.azure_rg.name
64+
resource_group_location = var.resource_group_location
65+
tags = var.tags
66+
cbs_vnet_name = module.CBS_vNET.cbs_vnet_name
67+
cbs_subnet_vms_address = var.cbs_subnet_vms_address
68+
azure_vm_size = var.azure_vm_size
69+
azure_vm_username = var.azure_vm_username
70+
azure_vm_password = var.azure_vm_password
71+
}
72+
73+
module "CBS-Key-Vault" {
74+
source = "../Modules/CBS-Key-Vault"
75+
resource_group_name = azurerm_resource_group.azure_rg.name
76+
resource_group_location = var.resource_group_location
77+
}
78+
79+
module "CBS-Identity" {
80+
source = "../Modules/CBS-Identity"
81+
resource_group_name = azurerm_resource_group.azure_rg.name
82+
resource_group_location = var.resource_group_location
83+
cbs_vnet_id = module.CBS_vNET.cbs_vnet_id
84+
depends_on = [ azurerm_resource_group.azure_rg ]
85+
}
86+
87+
module "CBS-VNET-Peering" {
88+
source = "../Modules/CBS-VNet-Peering"
89+
resource_group_name = azurerm_resource_group.azure_rg.name
90+
cbs_vnet_id = module.CBS_vNET.cbs_vnet_id
91+
cbs_vnet_name = module.CBS_vNET.cbs_vnet_name
92+
azure_virtualnetwork_peer_name = var.azure_virtualnetwork_peer_name
93+
azure_virtualnetwork_peer_rg = var.azure_virtualnetwork_peer_rg
94+
}
95+
96+
module "CBS-Array" {
97+
source = "../Modules/CBS-Array"
98+
array_name = var.array_name
99+
resource_group_name = azurerm_resource_group.azure_rg.name
100+
resource_group_location = var.resource_group_location
101+
cbs_vnet_id = module.CBS_vNET.cbs_vnet_id
102+
cbs_subnet_mgmt_name = module.CBS_vNET.azure_subnet_name.cbs_subnet_mgmt
103+
cbs_subnet_iscsi_name = module.CBS_vNET.azure_subnet_name.cbs_subnet_iscsi
104+
cbs_subnet_repl_name = module.CBS_vNET.azure_subnet_name.cbs_subnet_repl
105+
cbs_subnet_sys_name = module.CBS_vNET.azure_subnet_name.cbs_subnet_sys
106+
license_key = var.license_key
107+
cbs_key_vault = module.CBS-Key-Vault.cbs_key_vault_id
108+
log_sender_domain = var.log_sender_domain
109+
alert_recipients = var.alert_recipients
110+
array_model = var.array_model
111+
zone = var.zone
112+
key_file_path = var.key_file_path
113+
jit_group_ids = var.jit_group_ids
114+
tags = var.tags
115+
user_assigned_identity = module.CBS-Identity.user_assigned_identity_id
116+
depends_on = [ module.CBS-Identity ]
117+
118+
}
119+
120+
121+
122+
123+
124+

Deploy-CBS-Greenfield/output.tf

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
output "cbs_azure_deployed_plan" {
2+
value = module.CBS-Array.cbs_azure_deployed_plans
3+
}
4+
5+
output "cbs_mgmt_endpoint" {
6+
value = module.CBS-Array.cbs_mgmt_endpoint
7+
}
8+
output "cbs_mgmt_endpoint_ct0" {
9+
value = module.CBS-Array.cbs_mgmt_endpoint_ct0
10+
}
11+
output "cbs_mgmt_endpoint_ct1" {
12+
value = module.CBS-Array.cbs_mgmt_endpoint_ct1
13+
}
14+
output "cbs_repl_endpoint_ct0" {
15+
value = module.CBS-Array.cbs_repl_endpoint_ct0
16+
}
17+
output "cbs_repl_endpoint_ct1" {
18+
value = module.CBS-Array.cbs_repl_endpoint_ct1
19+
}
20+
output "cbs_iscsi_endpoint_ct0" {
21+
value = module.CBS-Array.cbs_iscsi_endpoint_ct0
22+
}
23+
output "cbs_iscsi_endpoint_ct1" {
24+
value = module.CBS-Array.cbs_iscsi_endpoint_ct1
25+
}
26+
27+
output "VM_Jumpbox_Private_IP" {
28+
value = module.VM-JUMPBOX.VM_Jumpbox_Private_IP
29+
}
30+
31+
output "VM_Jumpbox_Public_IP" {
32+
value = module.VM-JUMPBOX.VM_Jumpbox_Public_IP
33+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
2+
#Azure Variables
3+
resource_group_name = "cbs-modules-prereq-" #Prefix for Jump Start Deployment Resources
4+
resource_group_location = "eastus" #Region see entries below
5+
# azure_client_id = "xxxxxxxx-xxxx-xxx-xxxx-xxxxxxxxxxxxxx"
6+
# azure_client_secret = "xxxxxxxx-xxxx-xxx-xxxx-xxxxxxxxxxxxxx"
7+
# azure_subscription_id = "xxxxxxxx-xxxx-xxx-xxxx-xxxxxxxxxxxxxx"
8+
# azure_tenant_id = "xxxxxxxx-xxxx-xxx-xxxx-xxxxxxxxxxxxxx"
9+
azure_vm_size = "Standard_B1s"
10+
azure_vm_username = "xxxxxxxxxx"
11+
azure_vm_password = "xxxxxxxx"
12+
13+
vnet_address_space = ["10.10.0.0/16"]
14+
15+
subnets = {
16+
cbs_subnet_mgmt = {
17+
name = "cbs_subnet_mgmt"
18+
address_prefixes = ["10.10.1.0/24"]
19+
}
20+
cbs_subnet_iscsi = {
21+
name = "cbs_subnet_iscsi"
22+
address_prefixes = ["10.10.2.0/24"]
23+
}
24+
cbs_subnet_repl = {
25+
name = "cbs_subnet_repl"
26+
address_prefixes = ["10.10.3.0/24"]
27+
}
28+
cbs_subnet_sys = {
29+
name = "cbs_subnet_sys"
30+
address_prefixes = ["10.10.4.0/24"]
31+
}
32+
}
33+
34+
cbs_subnet_vms_address = ["10.10.5.0/24"]
35+
36+
tags = {
37+
"Environment" = "Lab"
38+
"Owner" = "CBS"
39+
}
40+
41+
#CBS Array Name
42+
array_name = "CBS-Greenfiled"
43+
44+
45+
#CBS License key from Pure1
46+
license_key = "xxxxxxxxxxxxxxxxxxxxxxxxxx"
47+
#DNS Domain for Array
48+
log_sender_domain = "xxxxxxx.com"
49+
#Email for Alerts
50+
alert_recipients = ["xxxxxxxx@xxxxxxxx.com"]
51+
#Azure Zone
52+
zone = 1
53+
#Array Model ## Choose from (V10MUR1, V20MUR1, V20MP2R2)
54+
array_model = "V10MUR1"
55+
56+
azure_virtualnetwork_peer_name = "xxxxxx"
57+
azure_virtualnetwork_peer_rg = "xxxxxx"
58+
59+
#Azure AD Group for JIT Approval
60+
jit_group_ids = ["xxxxxxxxxxxxxxx"]
61+
# key file path for pureuser
62+
key_file_path = "~/.ssh/xxxxx"

Deploy-CBS-Greenfield/variables.tf

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
variable "resource_group_name" {
2+
type = string
3+
description = "RG name in Azure"
4+
}
5+
6+
variable "resource_group_location" {
7+
type = string
8+
description = "RG location in Azure"
9+
}
10+
11+
# variable "azure_client_id" {
12+
# type = string
13+
# }
14+
# variable "azure_client_secret" {
15+
# type = string
16+
# }
17+
# variable "azure_subscription_id" {
18+
# type = string
19+
# }
20+
# variable "azure_tenant_id" {
21+
# type = string
22+
# }
23+
24+
variable "tags" {
25+
type = map(string)
26+
description = "Tags used for the deployment"
27+
default = {
28+
"Environment" = "Lab"
29+
"Owner" = "CBS"
30+
}
31+
}
32+
33+
variable "vnet_address_space" {
34+
type = list(any)
35+
description = "the address space of the VNet"
36+
default = ["10.10.0.0/16"]
37+
}
38+
39+
variable "subnets" {
40+
type = map(any)
41+
}
42+
43+
variable "cbs_subnet_vms_address" {
44+
type = list(any)
45+
description = "the address space of the initior VMs subnet"
46+
default = ["10.10.0.0/24"]
47+
}
48+
49+
variable "array_name" {
50+
type = string
51+
}
52+
variable "azure_vm_size" {
53+
type = string
54+
}
55+
variable "azure_vm_username" {
56+
type = string
57+
}
58+
variable "azure_vm_password" {
59+
type = string
60+
}
61+
62+
variable "azure_virtualnetwork_peer_name" {
63+
type = string
64+
}
65+
66+
variable "azure_virtualnetwork_peer_rg" {
67+
type = string
68+
}
69+
70+
variable "zone" {
71+
type = number
72+
}
73+
variable "log_sender_domain" {
74+
type = string
75+
}
76+
77+
variable "alert_recipients" {
78+
type = list(string)
79+
}
80+
81+
variable "jit_group_ids" {
82+
type = list(string)
83+
}
84+
variable "array_model" {
85+
type = string
86+
}
87+
88+
variable "license_key" {
89+
type = string
90+
}
91+
92+
variable "key_file_path" {
93+
type = string
94+
}
95+

Deploy-CBS-Prerequisites-Only/main.tf

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
terraform {
2+
required_providers {
3+
azurerm = {
4+
source = "hashicorp/azurerm"
5+
version = "~> 2.70.0"
6+
}
7+
random = {
8+
source = "hashicorp/random"
9+
version = "~> 3.1.0"
10+
}
11+
}
12+
required_version = ">= 0.13"
13+
}
14+
15+
/* If Authintication via Service Principles would be used:
16+
1. Uncomment the required params from main.tf and variables.tf
17+
2. Add your service principle in terraform.tfvars */
18+
19+
provider "azurerm" {
20+
features {}
21+
# client_id = var.azure_client_id
22+
# client_secret = var.azure_client_secret
23+
# tenant_id = var.azure_tenant_id
24+
# subscription_id = var.azure_subscription_id
25+
}
26+
27+
resource "azurerm_resource_group" "azure_rg" {
28+
name = format("%s%s", var.resource_group_name, var.resource_group_location)
29+
location = var.resource_group_location
30+
tags = var.tags
31+
}
32+
33+
module "CBS_vNET" {
34+
source = "../Modules/CBS-VNet"
35+
resource_group_name = azurerm_resource_group.azure_rg.name
36+
resource_group_location = var.resource_group_location
37+
tags = var.tags
38+
}
39+
40+
module "CBS-NAT-GW" {
41+
source = "../Modules/CBS-NAT-GW"
42+
resource_group_name = azurerm_resource_group.azure_rg.name
43+
resource_group_location = var.resource_group_location
44+
cbs_system_subnet_id = module.CBS_vNET.azure_subnet_id.cbs_subnet_sys
45+
tags = var.tags
46+
}
47+
48+
module "VM-JUMPBOX" {
49+
source = "../Modules/VM-JUMPBOX"
50+
resource_group_name = azurerm_resource_group.azure_rg.name
51+
resource_group_location = var.resource_group_location
52+
tags = var.tags
53+
cbs_vnet_name = module.CBS_vNET.cbs_vnet_name
54+
cbs_subnet_vms_address = var.cbs_subnet_vms_address
55+
azure_vm_size = var.azure_vm_size
56+
azure_vm_username = var.azure_vm_username
57+
azure_vm_password = var.azure_vm_password
58+
}
59+
60+
61+
62+

0 commit comments

Comments
 (0)