-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
133 lines (117 loc) · 4.59 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
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
}
}
}
# Configure the AWS Provider
provider "aws" {
region = var.aws_region
}
resource "tls_private_key" "ise_key_pair" {
algorithm = "RSA"
rsa_bits = 4096
}
resource "aws_key_pair" "ise_key_pair" {
key_name = var.aws_keypair_name
public_key = tls_private_key.ise_key_pair.public_key_openssh
}
resource "local_file" "linuxkey" {
filename="${var.aws_keypair_name}.pem"
content=tls_private_key.ise_key_pair.private_key_pem
file_permission = "0600"
}
module "ise_network" {
source = "./modules/ise_network"
aws_public_access_cidr = var.aws_public_access_cidr
aws_subnet_cidr = var.aws_subnet_cidr
aws_vpc_cidr = var.aws_vpc_cidr
aws_vpc_name = var.aws_vpc_name
aws_subnet_name = var.aws_subnet_name
aws_security_group_name = var.aws_security_group_name
count = var.aws_create_network ? 1 : 0
}
data "aws_subnet" "ise_subnet" {
filter {
name = "tag:Name"
values = [var.aws_subnet_name]
}
count = var.aws_create_network ? 0 : 1
}
# data "aws_security_group" "ise_security_group" {
# name = var.aws_subnet_name
# count = var.aws_create_network ? 0 : 1
# }
module "single_node_deployment" {
source = "./modules/single_node_deployment"
count = var.ise_single_node_deployment
aws_instance_type = var.aws_instance_type
aws_ise_ami = var.aws_ise_ami
ise_base_hostname = var.ise_base_hostname
ise_dns_server = var.ise_dns_server
ise_domain = var.ise_domain
ise_ntp_server = var.ise_ntp_server
ise_password = var.ise_password
ise_timezone = var.ise_timezone
ise_username = var.ise_username
aws_region = var.aws_region
#key_pair_name = aws_key_pair.ise_key_pair.key_name
key_pair_name = var.aws_keypair_name
subnet_id = var.aws_create_network ? module.ise_network[0].subnet_id : data.aws_subnet.ise_subnet[0].id
security_group_id = var.aws_create_network ? module.ise_network[0].security_group_id : var.aws_security_group_id
}
module "small_deployment" {
source = "./modules/small_deployment"
count = var.ise_small_deployment
aws_instance_type = var.aws_instance_type
aws_ise_ami = var.aws_ise_ami
ise_base_hostname = var.ise_base_hostname
ise_dns_server = var.ise_dns_server
ise_domain = var.ise_domain
ise_ntp_server = var.ise_ntp_server
ise_password = var.ise_password
ise_timezone = var.ise_timezone
ise_username = var.ise_username
#key_pair_name = aws_key_pair.ise_key_pair.key_name
key_pair_name = var.aws_keypair_name
subnet_id = var.aws_create_network ? module.ise_network[0].subnet_id : data.aws_subnet.ise_subnet[0].id
security_group_id = var.aws_create_network ? module.ise_network[0].security_group_id : var.aws_security_group_id
}
module "medium_deployment" {
source = "./modules/medium_deployment"
count = var.ise_medium_deployment
aws_instance_type = var.aws_instance_type
aws_ise_ami = var.aws_ise_ami
ise_base_hostname = var.ise_base_hostname
ise_dns_server = var.ise_dns_server
ise_domain = var.ise_domain
ise_ntp_server = var.ise_ntp_server
ise_password = var.ise_password
ise_psn_instances = var.ise_psn_instances
ise_timezone = var.ise_timezone
ise_username = var.ise_username
#key_pair_name = aws_key_pair.ise_key_pair.key_name
key_pair_name = var.aws_keypair_name
subnet_id = var.aws_create_network ? module.ise_network[0].subnet_id : data.aws_subnet.ise_subnet[0].id
security_group_id = var.aws_create_network ? module.ise_network[0].security_group_id : var.aws_security_group_id
}
module "large_deployment" {
source = "./modules/large_deployment"
count = var.ise_large_deployment
aws_instance_type = var.aws_instance_type
aws_ise_ami = var.aws_ise_ami
ise_base_hostname = var.ise_base_hostname
ise_dns_server = var.ise_dns_server
ise_domain = var.ise_domain
ise_ntp_server = var.ise_ntp_server
ise_password = var.ise_password
ise_psn_instances = var.ise_psn_instances
ise_timezone = var.ise_timezone
ise_username = var.ise_username
#key_pair_name = aws_key_pair.ise_key_pair.key_name
key_pair_name = var.aws_keypair_name
subnet_id = var.aws_create_network ? module.ise_network[0].subnet_id : data.aws_subnet.ise_subnet[0].id
security_group_id = var.aws_create_network ? module.ise_network[0].security_group_id : var.aws_security_group_id
}