-
Notifications
You must be signed in to change notification settings - Fork 11
dsfkit with cm (#472) #473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
cfd9992
154877f
dd4852f
20b5a34
bea073e
99fefbf
592b2f8
c7a2de8
ebb94ed
0aa1257
8eb14ca
61dbe58
ae990e0
a2e8555
134a77d
4428968
af754a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| locals { | ||
| ciphertrust_manager_count = local.enable_ciphertrust ? var.ciphertrust_manager_count : 0 | ||
| ciphertrust_cidr_list = [data.aws_subnet.ciphertrust_manager.cidr_block] | ||
| ciphertrust_manager_web_console_username = "admin" | ||
| } | ||
|
|
||
| module "ciphertrust_manager" { | ||
| source = "../../../../modules/aws/ciphertrust-manager" | ||
| # source = "imperva/dsf-ciphertrust-manager/aws" | ||
| # version = "1.7.17" # latest release tag | ||
| count = local.ciphertrust_manager_count | ||
| ami = var.ciphertrust_manager_ami_id == null ? null : { | ||
| id = var.ciphertrust_manager_ami_id | ||
| name_regex = null | ||
| product_code = null | ||
| owner_account_id = null | ||
| } | ||
| friendly_name = join("-", [local.deployment_name_salted, "ciphertrust", "manager", count.index]) | ||
| ebs = var.ciphertrust_manager_ebs_details | ||
| subnet_id = local.ciphertrust_manager_subnet_id | ||
| attach_persistent_public_ip = true | ||
| key_pair = module.key_pair.key_pair.key_pair_name | ||
| allowed_web_console_and_api_cidrs = var.web_console_cidr | ||
| allowed_ssh_cidrs = concat(local.workstation_cidr, var.allowed_ssh_cidrs) | ||
| allowed_cluster_nodes_cidrs = [data.aws_subnet.ciphertrust_manager.cidr_block] | ||
| allowed_ddc_agents_cidrs = [data.aws_subnet.cte_ddc_agent.cidr_block] | ||
| allowed_all_cidrs = local.workstation_cidr | ||
| tags = local.tags | ||
| depends_on = [ | ||
| module.vpc | ||
| ] | ||
| } | ||
|
|
||
| provider "ciphertrust" { | ||
| address = local.ciphertrust_manager_count > 0 ? "https://${module.ciphertrust_manager[0].public_ip}" : null | ||
| username = local.ciphertrust_manager_web_console_username | ||
| password = local.ciphertrust_manager_password | ||
| // destroy cluster can take almost a minute so give us a bit of a buffer | ||
| rest_api_timeout = 720 | ||
| } | ||
|
|
||
| resource "ciphertrust_trial_license" "trial_license" { | ||
| count = local.ciphertrust_manager_count > 0 ? 1 : 0 | ||
| flag = "activate" | ||
| } | ||
|
|
||
| module "ciphertrust_manager_cluster_setup" { | ||
| source = "../../../../modules/null/ciphertrust-manager-cluster-setup" | ||
| # source = "imperva/dsf-ciphertrust-manager-cluster-setup/aws" | ||
| # version = "1.7.17" # latest release tag | ||
| count = local.ciphertrust_manager_count > 1 ? 1 : 0 | ||
| nodes = [ | ||
| for i in range(length(module.ciphertrust_manager)) : { | ||
| host = module.ciphertrust_manager[i].private_ip | ||
| public_address = coalesce(module.ciphertrust_manager[i].public_ip, module.ciphertrust_manager[i].private_ip) | ||
| } | ||
| ] | ||
| credentials = { | ||
| user = local.ciphertrust_manager_web_console_username | ||
| password = local.ciphertrust_manager_password | ||
| } | ||
| ddc_node_setup = { | ||
| enabled = true | ||
| node_address = coalesce(module.ciphertrust_manager[0].public_ip, module.ciphertrust_manager[0].private_ip) | ||
| } | ||
| depends_on = [ | ||
| module.ciphertrust_manager | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| locals { | ||
| cte_ddc_linux_count = local.ciphertrust_manager_count > 0 ? var.cte_ddc_agents_linux_count : 0 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't "local.ciphertrust_manager_count > 0" be "var.enable_ciphertrtrust ?". can var.enable_ciphertrtrust = enabled and ciphertrust_manager_count == 0?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. basically it can happen if that what the user set, this is why I check the count instead of the flag |
||
| cte_linux_count = local.ciphertrust_manager_count > 0 ? var.cte_agents_linux_count : 0 | ||
| ddc_linux_count = local.ciphertrust_manager_count > 0 ? var.ddc_agents_linux_count : 0 | ||
| cte_ddc_windows_count = local.ciphertrust_manager_count > 0 ? var.cte_ddc_agents_windows_count : 0 | ||
| cte_windows_count = local.ciphertrust_manager_count > 0 ? var.cte_agents_windows_count : 0 | ||
| ddc_windows_count = local.ciphertrust_manager_count > 0 ? var.ddc_agents_windows_count : 0 | ||
|
|
||
| installation_map = { | ||
| "Red Hat" = { | ||
| cte_installation_path = var.cte_agent_linux_installation_file | ||
| ddc_installation_path = var.ddc_agent_linux_installation_file | ||
| }, | ||
| "Windows" = { | ||
| cte_installation_path = var.cte_agent_windows_installation_file | ||
| ddc_installation_path = var.ddc_agent_windows_installation_file | ||
| } | ||
| } | ||
|
|
||
| # Prepare Linux Agent Instances | ||
| linux_cte_ddc_instances = [for i in range(local.cte_ddc_linux_count) : { | ||
| id = "cte-ddc-agent-linux-${i}" | ||
| os_type = "Red Hat" | ||
| install_cte = true | ||
| install_ddc = true | ||
| }] | ||
| linux_cte_only_instances = [for i in range(local.cte_linux_count) : { | ||
| id = "cte-agent-linux-${i}" | ||
| os_type = "Red Hat" | ||
| install_cte = true | ||
| install_ddc = false | ||
| }] | ||
| linux_ddc_only_instances = [for i in range(local.ddc_linux_count) : { | ||
| id = "ddc-agent-linux-${i}" | ||
| os_type = "Red Hat" | ||
| install_cte = false | ||
| install_ddc = true | ||
| }] | ||
| # Prepare Windows Agent Instances | ||
| windows_cte_ddc_instances = [for i in range(local.cte_ddc_windows_count) : { | ||
| id = "cte-ddc-agent-windows-${i}" | ||
| os_type = "Windows" | ||
| install_cte = true | ||
| install_ddc = true | ||
| }] | ||
| windows_cte_only_instances = [for i in range(local.cte_windows_count) : { | ||
| id = "cte-agent-windows-${i}" | ||
| os_type = "Windows" | ||
| install_cte = true | ||
| install_ddc = false | ||
| }] | ||
| windows_ddc_only_instances = [for i in range(local.ddc_windows_count) : { | ||
| id = "ddc-agent-windows-${i}" | ||
| os_type = "Windows" | ||
| install_cte = false | ||
| install_ddc = true | ||
| }] | ||
|
|
||
|
|
||
| # Concatenate all agent lists and convert to a map for for_each | ||
| all_agent_instances_map = { | ||
| for instance in concat( | ||
| local.linux_cte_ddc_instances, | ||
| local.linux_cte_only_instances, | ||
| local.linux_ddc_only_instances, | ||
| local.windows_cte_ddc_instances, | ||
| local.windows_cte_only_instances, | ||
| local.windows_ddc_only_instances | ||
| ) : instance.id => instance | ||
| } | ||
| } | ||
|
|
||
| resource "ciphertrust_cte_registration_token" "reg_token" { | ||
|
sivan-hajbi-imperva marked this conversation as resolved.
|
||
| count = length(local.all_agent_instances_map) > 0 ? 1 : 0 | ||
| lifetime = "24h" | ||
| max_clients = 100 | ||
| name_prefix = "dsf-agent" | ||
| } | ||
|
|
||
| module "cte_ddc_agents" { | ||
| source = "../../../../modules/aws/cte-ddc-agent" | ||
|
sivan-hajbi-imperva marked this conversation as resolved.
|
||
| # source = "imperva/dsf-cte-ddc-agent/aws" | ||
| # version = "1.7.17" # latest release tag | ||
| # count = local.cte_ddc_linux_count | ||
| for_each = local.all_agent_instances_map | ||
| friendly_name = join("-", [local.deployment_name_salted, each.value.id]) | ||
| subnet_id = local.cte_ddc_agent_subnet_id | ||
| ssh_key_pair = { | ||
| ssh_private_key_file_path = module.key_pair.private_key_file_path | ||
| ssh_public_key_name = module.key_pair.key_pair.key_pair_name | ||
| } | ||
| os_type = each.value.os_type | ||
| attach_persistent_public_ip = true | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can add variables later |
||
| use_public_ip = true | ||
| allowed_ssh_cidrs = concat(local.workstation_cidr, var.allowed_ssh_cidrs) | ||
| allowed_rdp_cidrs = each.value.os_type == "Windows" ? concat(local.workstation_cidr, var.allowed_ssh_cidrs) : null | ||
|
sivan-hajbi-imperva marked this conversation as resolved.
|
||
| cipher_trust_manager_address = module.ciphertrust_manager[0].private_ip | ||
| agent_installation = { | ||
| registration_token = ciphertrust_cte_registration_token.reg_token[0].token | ||
| install_cte = each.value.install_cte | ||
| install_ddc = each.value.install_ddc | ||
| cte_agent_installation_file = each.value.install_cte ? local.installation_map[each.value.os_type].cte_installation_path : null | ||
| ddc_agent_installation_file = each.value.install_ddc ? local.installation_map[each.value.os_type].ddc_installation_path : null | ||
| } | ||
| tags = local.tags | ||
| depends_on = [ | ||
| module.vpc, | ||
| module.ciphertrust_manager, | ||
| ciphertrust_trial_license.trial_license, | ||
| module.ciphertrust_manager_cluster_setup | ||
| ] | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.