This repository has been archived by the owner on Aug 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
bluedata_infra_main.tf
60 lines (52 loc) · 1.95 KB
/
bluedata_infra_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
provider "azurerm" {
features {}
subscription_id = var.subscription_id
client_id = var.client_id
client_secret = var.client_secret
tenant_id = var.tenant_id
}
data "template_file" "cli_logging_config_template" {
template = file("etc/hpecp_cli_logging.conf")
vars = {
hpecp_cli_log_file = "${abspath(path.module)}/generated/hpecp_cli.log"
}
}
resource "local_file" "cli_logging_config_file" {
filename = "${path.module}/generated/hpecp_cli_logging.conf"
content = data.template_file.cli_logging_config_template.rendered
}
resource "local_file" "ca-cert" {
filename = "${path.module}/generated/ca-cert.pem"
content = var.ca_cert
}
resource "local_file" "ca-key" {
filename = "${path.module}/generated/ca-key.pem"
content = var.ca_key
}
# Create a resource group
resource "azurerm_resource_group" "resourcegroup" {
name = "${var.project_id}-rg"
location = var.region
}
# Create a virtual network within the resource group
resource "azurerm_virtual_network" "network" {
name = "${var.project_id}-network"
location = azurerm_resource_group.resourcegroup.location
resource_group_name = azurerm_resource_group.resourcegroup.name
address_space = [var.vpc_cidr_block]
}
# Create the subnet
resource "azurerm_subnet" "internal" {
name = "${var.project_id}-internal"
resource_group_name = azurerm_resource_group.resourcegroup.name
virtual_network_name = azurerm_virtual_network.network.name
address_prefixes = [var.subnet_cidr_block]
}
# Storage account for all resources
resource "azurerm_storage_account" "storageaccount" {
name = "${replace(lower(var.project_id), "/[^a-z]/", "")}storage"
resource_group_name = azurerm_resource_group.resourcegroup.name
location = azurerm_resource_group.resourcegroup.location
account_replication_type = "LRS"
account_tier = "Standard"
}