forked from aws-cloudformation/cfn-lint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconditions.yaml
103 lines (103 loc) · 2.63 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
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
AWSTemplateFormatVersion: "2010-09-09"
Mappings:
RegionMap:
us-east-1:
AMI: "ami-7f418316"
TestAz: "us-east-1a"
us-west-1:
AMI: "ami-951945d0"
TestAz: "us-west-1a"
us-west-2:
AMI: "ami-16fd7026"
TestAz: "us-west-2a"
eu-west-1:
AMI: "ami-24506250"
TestAz: "eu-west-1a"
sa-east-1:
AMI: "ami-3e3be423"
TestAz: "sa-east-1a"
ap-southeast-1:
AMI: "ami-74dda626"
TestAz: "ap-southeast-1a"
ap-southeast-2:
AMI: "ami-b3990e89"
TestAz: "ap-southeast-2a"
ap-northeast-1:
AMI: "ami-dcfa4edd"
TestAz: "ap-northeast-1a"
Parameters:
EnvType:
Description: Environment type.
Default: test
Type: String
AllowedValues:
- prod
- test
ConstraintDescription: must specify prod or test.
EnableGeoBlocking:
Type: String
Conditions:
CreateProdResources: !Equals [!Ref EnvType, prod]
BadCondition: String
UnusedCondition: !Equals [!Ref EnvType, prod]
TooManyConditions:
Fn::Equals: [!Ref EnvType, prod]
Fn::Not: !Equals [!Ref EnvType, prod]
EnableGeoBlocking: !Equals [!Ref EnableGeoBlocking, "true"]
HasParam:
"Fn::Of":
- !Not [!Equals [!Ref EnvType, ""]]
- !Not [!Equals [!Ref EnableGeoBlocking, ""]]
NullCondition: null
Resources:
EC2Instance:
Type: "AWS::EC2::Instance"
Properties:
ImageId: !FindInMap [RegionMap, !Ref "AWS::Region", AMI]
Tags:
- Key: TestKey
Value: TestValue
- Fn::If:
- isProd
- Key: Environment1
Value: Prod
- Fn::If:
- isDev
- BadKey: Environment2
BadValue: Dev
- !Ref AWS::NoValue
MountPoint:
Type: "AWS::EC2::VolumeAttachment"
Condition: CreateProdResources
Properties:
InstanceId: !Ref EC2Instance
VolumeId: !Ref NewVolume
Device: /dev/sdh
NewVolume:
Type: "AWS::EC2::Volume"
Condition: CreateProdResources
Properties:
Size: 100
AvailabilityZone: !GetAtt EC2Instance.AvailabilityZone
CloudFrontDistribution:
Type: "AWS::CloudFront::Distribution"
Condition: False
Properties:
DistributionConfig:
Enabled: true
Restrictions:
GeoRestriction: !If
- EnableGeoBlocking
- RestrictionType: !If
- EnableGeoBlocking
- - whitelist
- whitelist
BadLocations:
- BE
- LU
- NL
- RestrictionType: none
Outputs:
VolumeId:
Condition: CreateProdResources
Value: !Ref NewVolume