This repository has been archived by the owner on Jan 20, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmultiple_deployment_groups.tf
89 lines (71 loc) · 2.58 KB
/
multiple_deployment_groups.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
terraform {
required_version = ">= 0.12"
}
provider "aws" {
version = "~> 2.7"
region = "us-east-1"
}
data "aws_ami" "amz_linux_2" {
most_recent = true
owners = ["137112412989"]
filter {
name = "name"
values = ["amzn2-ami-hvm-2.0.*-ebs"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
filter {
name = "root-device-type"
values = ["ebs"]
}
}
module "vpc" {
source = "[email protected]:rackspace-infrastructure-automation/aws-terraform-vpc_basenetwork//?ref=v0.12.0"
name = "Test1VPC"
}
module "security_groups" {
source = "[email protected]:rackspace-infrastructure-automation/aws-terraform-security_group//?ref=v0.12.0"
environment = "Production"
name = "Test-SG"
vpc_id = module.vpc.vpc_id
}
module "asg_prod" {
source = "[email protected]:rackspace-infrastructure-automation/aws-terraform-ec2_asg//?ref=v0.12.0"
ec2_os = "amazon"
image_id = data.aws_ami.amz_linux_2.image_id
install_codedeploy_agent = true
instance_type = "t2.micro"
name = "CodeDeployExampleProd"
security_groups = [module.security_groups.private_web_security_group_id]
scaling_max = 2
scaling_min = 1
subnets = [element(module.vpc.public_subnets, 0), element(module.vpc.public_subnets, 1)]
}
module "asg_test" {
source = "[email protected]:rackspace-infrastructure-automation/aws-terraform-ec2_asg//?ref=v0.12.0"
ec2_os = "amazon"
image_id = data.aws_ami.amz_linux_2.image_id
install_codedeploy_agent = true
instance_type = "t2.micro"
name = "CodeDeployExampleTest"
security_groups = [module.security_groups.private_web_security_group_id]
scaling_max = 2
scaling_min = 1
subnets = [element(module.vpc.public_subnets, 0), element(module.vpc.public_subnets, 1)]
}
module "codedeploy_prod" {
source = "[email protected]:rackspace-infrastructure-automation/aws-terraform-codedeploy//?ref=v0.12.0"
application_name = "MyCodeDeployApp"
autoscaling_groups = [module.asg_prod.asg_name_list]
environment = "Prod"
}
module "codedeploy_test" {
source = "[email protected]:rackspace-infrastructure-automation/aws-terraform-codedeploy//?ref=v0.12.0"
application_name = module.codedeploy_prod.application_name
autoscaling_groups = [module.asg_test.asg_name_list]
create_application = false
deployment_config_name = "CodeDeployDefault.AllAtOnce"
environment = "Test"
}