-
Notifications
You must be signed in to change notification settings - Fork 336
/
Copy pathconditions.yaml
59 lines (50 loc) · 1.17 KB
/
conditions.yaml
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
AWSTemplateFormatVersion: "2010-09-09"
Description: "Create EC2 instance"
Parameters:
Environment:
Type: String
AllowedValues:
- dev
- prod
- qa
Mappings:
EnvMap: #logical id/name
dev:
instanceType: "t2.large"
name: "dev"
qa:
instanceType: "t2.medium"
name: "qa"
prod:
instanceType: "t2.xlarge"
name: "prod"
Conditions:
CreateProdResources: !Equals [ !Ref Environment, prod ]
Resources:
Instance: #logical id/name
Type: AWS::EC2::Instance
Properties:
InstanceType: !FindInMap [EnvMap, !Ref Environment, instanceType]
ImageId: ami-0dba2cb6798deb6d8
Tags:
- Key: "Name"
Value: !FindInMap [EnvMap, !Ref Environment, name]
MountPoint:
Type: AWS::EC2::VolumeAttachment
Condition: CreateProdResources
Properties:
InstanceId:
!Ref Instance
VolumeId:
!Ref NewVolume
Device: /dev/sdh
NewVolume:
Type: AWS::EC2::Volume
Condition: CreateProdResources
Properties:
Size: 100
AvailabilityZone:
!GetAtt Instance.AvailabilityZone
Outputs:
InstanceName:
Value: !Ref Instance