forked from uyuni-project/sumaform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf.aws.example
99 lines (77 loc) · 2.25 KB
/
main.tf.aws.example
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
locals {
region = ...
availability_zone = ...
key_file = ...
key_name = ...
}
provider "aws" {
region = local.region
access_key = ...
secret_key = ...
}
module "base" {
source = "./modules/base"
cc_username = ...
cc_password = ...
name_prefix = ... // if you use name_prefix, make sure to update the server_configuration for clients/minions below
provider_settings = {
availability_zone = local.availability_zone
region = local.region
ssh_allowed_ips = [...]
key_name = local.key_name
key_file = local.key_file
}
}
#================= Configuration with Mirror ================
# uncomment the following lines if you want to reuse an data disk snapshot
//data "aws_ebs_snapshot" "data_disk_snapshot" {
// most_recent = true
//
// filter {
// name = "tag:Name"
// values = ["mirror-data-volume-snapshot"]
// }
//}
module "mirror" {
source = "./modules/mirror"
base_configuration = module.base.configuration
volume_provider_settings = {
# uncomment the following line if you want to reuse an data disk snapshot
// volume_snapshot_id = data.aws_ebs_snapshot.data_disk_snapshot.id
}
}
locals{
base_configuration = merge(module.base.configuration,
{
mirror = length(module.mirror.configuration["hostnames"]) > 0 ? module.mirror.configuration["hostnames"][0] : null
})
}
// ================= END MIRROR =================
module "server" {
source = "./modules/server"
base_configuration = local.base_configuration
name = "server"
image = "opensuse154o"
product_version = "uyuni-release"
provider_settings = { }
}
module "minion" {
source = "./modules/minion"
base_configuration = local.base_configuration
name = "minion"
image = "opensuse154o"
server_configuration = module.server.configuration
product_version = "uyuni-release"
}
output "key_file" {
value = local.key_file
}
output "bastion_public_name" {
value = lookup(module.base.configuration, "bastion_host", null)
}
output "aws_server_private_name" {
value = module.server.configuration.hostname
}
output "aws_minion_private_names" {
value = module.minion.configuration.hostnames
}