-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f48986d
commit 38a957c
Showing
16 changed files
with
1,010 additions
and
2 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,86 @@ | ||
locals { | ||
# agent_gw_count = var.enable_dam ? var.agent_gw_count : 0 | ||
# gateway_group_name = "temporaryGatewayGroup" | ||
# create_agent_gw_cluster = local.agent_gw_count >= 2 ? 1 : 0 | ||
} | ||
|
||
# TODO sivan - fix all relative modules paths | ||
module "mx" { | ||
source = "../../../../modules/azurerm/mx" | ||
count = var.enable_dam ? 1 : 0 | ||
|
||
friendly_name = join("-", [local.deployment_name_salted, "mx"]) | ||
resource_group = local.resource_group | ||
dam_version = var.dam_version | ||
subnet_id = module.network[0].vnet_subnets[0] | ||
# license = var.dam_license | ||
ssh_key = { | ||
ssh_public_key = tls_private_key.ssh_key.public_key_openssh | ||
ssh_private_key_file_path = local_sensitive_file.ssh_key.filename | ||
} | ||
# secure_password = local.password | ||
# mx_password = local.password | ||
allowed_web_console_and_api_cidrs = var.web_console_cidr | ||
allowed_agent_gw_cidrs = module.network[0].vnet_address_space | ||
allowed_ssh_cidrs = local.workstation_cidr | ||
allowed_hub_cidrs = module.network[0].vnet_address_space | ||
|
||
# hub_details = var.enable_sonar ? { | ||
# address = coalesce(module.hub_main[0].public_dns, module.hub_main[0].private_dns) | ||
# access_token = module.hub_main[0].access_tokens["archiver"].token | ||
# port = 8443 | ||
# } : null | ||
attach_persistent_public_ip = true | ||
# large_scale_mode = var.large_scale_mode.mx | ||
|
||
# create_server_group = length(var.simulation_db_types_for_agent) > 0 | ||
tags = local.tags | ||
# TODO sivan - remove and test | ||
# send_usage_statistics = false | ||
depends_on = [ | ||
module.network | ||
] | ||
} | ||
|
||
#module "agent_gw" { | ||
# source = "../../../../modules/aws/agent-gw" | ||
# count = local.agent_gw_count | ||
# | ||
# friendly_name = join("-", [local.deployment_name_salted, "agent", "gw", count.index]) | ||
# dam_version = var.dam_version | ||
# ebs = var.agent_gw_ebs_details | ||
# subnet_id = local.agent_gw_subnet_id | ||
# key_pair = module.key_pair.key_pair.key_pair_name | ||
# secure_password = local.password | ||
# mx_password = local.password | ||
# allowed_agent_cidrs = [data.aws_subnet.agent_gw.cidr_block] | ||
# allowed_mx_cidrs = [data.aws_subnet.mx.cidr_block] | ||
# allowed_ssh_cidrs = [data.aws_subnet.mx.cidr_block] | ||
# allowed_gw_clusters_cidrs = [data.aws_subnet.agent_gw.cidr_block] | ||
# management_server_host_for_registration = module.mx[0].private_ip | ||
# management_server_host_for_api_access = module.mx[0].public_ip | ||
# large_scale_mode = var.large_scale_mode.agent_gw | ||
# gateway_group_name = local.gateway_group_name | ||
# tags = local.tags | ||
# depends_on = [ | ||
# module.vpc | ||
# ] | ||
#} | ||
# | ||
#module "agent_gw_cluster_setup" { | ||
# source = "../../../../modules/null/agent-gw-cluster-setup" | ||
# count = local.create_agent_gw_cluster | ||
# | ||
# cluster_name = join("-", [local.deployment_name_salted, "agent", "gw", "cluster"]) | ||
# gateway_group_name = local.gateway_group_name | ||
# mx_details = { | ||
# address = module.mx[0].public_ip | ||
# port = 8083 | ||
# user = module.mx[0].web_console_user | ||
# password = local.password | ||
# } | ||
# depends_on = [ | ||
# module.agent_gw, | ||
# module.mx | ||
# ] | ||
#} |
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
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
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,2 @@ | ||
# DSF DAM Node | ||
[![GitHub tag](https://img.shields.io/github/v/tag/imperva/dsfkit.svg)](https://github.com/imperva/dsfkit/tags) |
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,15 @@ | ||
locals { | ||
# vm image | ||
version_parts = split(".", var.dam_version) | ||
dam_major_version = element(local.version_parts, 0) | ||
dam_azure_image_version = join(".", [element(local.version_parts, 0), element(local.version_parts, 1), element(local.version_parts, 3)]) | ||
is_lts_version = false # TODO sivan - lts? | ||
|
||
default_vm_image = { | ||
publisher = "imperva" | ||
offer = join("", ["imperva-dam-v", local.dam_major_version, local.is_lts_version? "-lts" : ""]) | ||
sku = join("-", ["securesphere-imperva-dam", local.dam_major_version]) | ||
version = local.dam_azure_image_version | ||
} | ||
vm_image = var.vm_image != null ? var.vm_image : local.default_vm_image | ||
} |
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,123 @@ | ||
locals { | ||
public_ip = azurerm_linux_virtual_machine.dsf_base_instance.public_ip_address | ||
private_ip = azurerm_linux_virtual_machine.dsf_base_instance.private_ip_address | ||
|
||
# root volume details | ||
root_volume_size = 160 | ||
root_volume_type = "Standard_LRS" | ||
root_volume_cache = "ReadWrite" | ||
|
||
security_group_id = length(var.security_group_ids) == 0 ? azurerm_network_security_group.dsf_base_sg.id : var.security_group_ids[0] | ||
|
||
mapper = { | ||
# TODO sivan - decide instance types | ||
instance_type = { | ||
AV2500 = "Standard_E4s_v5", | ||
AV6500 = "Standard_E4s_v5", | ||
AVM150 = "Standard_E4s_v5" | ||
} | ||
product_role = { | ||
mx = "server", | ||
agent-gw = "gateway" | ||
} | ||
} | ||
} | ||
|
||
|
||
# TODO sivan - storage? | ||
|
||
resource "azurerm_public_ip" "vm_public_ip" { | ||
count = var.attach_persistent_public_ip ? 1 : 0 | ||
name = join("-", [var.name, "public", "ip"]) | ||
location = var.resource_group.location | ||
resource_group_name = var.resource_group.name | ||
sku = "Standard" | ||
allocation_method = "Static" | ||
tags = var.tags | ||
} | ||
|
||
data "azurerm_public_ip" "vm_public_ip" { | ||
count = var.attach_persistent_public_ip ? 1 : 0 | ||
name = join("-", [var.name, "public", "ip"]) | ||
resource_group_name = var.resource_group.name | ||
depends_on = [ | ||
azurerm_linux_virtual_machine.dsf_base_instance | ||
] | ||
} | ||
|
||
resource "azurerm_linux_virtual_machine" "dsf_base_instance" { | ||
name = var.name | ||
resource_group_name = var.resource_group.name | ||
location = var.resource_group.location | ||
size = local.mapper.instance_type[var.dam_model] | ||
admin_username = var.vm_user | ||
|
||
# custom_data = base64encode(local.userdata) | ||
|
||
network_interface_ids = [ | ||
azurerm_network_interface.nic.id, | ||
] | ||
|
||
admin_ssh_key { | ||
username = var.vm_user | ||
public_key = var.public_ssh_key | ||
} | ||
|
||
os_disk { | ||
disk_size_gb = local.root_volume_size | ||
caching = local.root_volume_cache | ||
storage_account_type = local.root_volume_type | ||
} | ||
|
||
source_image_reference { | ||
publisher = local.vm_image.publisher | ||
offer = local.vm_image.offer | ||
sku = local.vm_image.sku | ||
version = local.vm_image.version | ||
} | ||
|
||
plan { | ||
publisher = local.vm_image.publisher | ||
product = local.vm_image.offer | ||
name = local.vm_image.sku | ||
} | ||
|
||
# TODO sivan - ask Eytan | ||
identity { | ||
type = "UserAssigned" | ||
identity_ids = [azurerm_user_assigned_identity.dsf_base.id] | ||
} | ||
tags = merge(var.tags, { Name = var.name }) | ||
|
||
# Ignore changes to the custom_data attribute (Don't replace on userdata change) | ||
lifecycle { | ||
ignore_changes = [ | ||
custom_data | ||
] | ||
} | ||
} | ||
|
||
resource "azurerm_user_assigned_identity" "dsf_base" { | ||
name = var.name | ||
resource_group_name = var.resource_group.name | ||
location = var.resource_group.location | ||
} | ||
|
||
resource "azurerm_network_interface" "nic" { | ||
name = join("-", [var.name, "nic"]) | ||
location = var.resource_group.location | ||
resource_group_name = var.resource_group.name | ||
|
||
ip_configuration { | ||
name = join("-", [var.name, "nic"]) | ||
subnet_id = var.subnet_id | ||
private_ip_address_allocation = "Dynamic" | ||
public_ip_address_id = try(azurerm_public_ip.vm_public_ip[0].id, null) | ||
} | ||
tags = var.tags | ||
} | ||
|
||
resource "azurerm_network_interface_security_group_association" "nic_ip_association" { | ||
network_interface_id = azurerm_network_interface.nic.id | ||
network_security_group_id = local.security_group_id | ||
} |
Oops, something went wrong.