Debian Codegraph @

heat_tempest_plugin/tests/scenario/templates/test_server_cfn_init.yaml

raw
1 HeatTemplateFormatVersion: '2012-12-12'
2 Description: |
3 Template which uses a wait condition to confirm that a minimal
4 cfn-init and cfn-signal has worked
5 Parameters:
6 key_name:
7 Type: String
8 flavor:
9 Type: String
10 image:
11 Type: String
12 subnet:
13 Type: String
14 timeout:
15 Type: Number
16 SignalExtraArgs:
17 Type: String
18 Default: ""
19 Resources:
20 CfnUser:
21 Type: AWS::IAM::User
22 SmokeSecurityGroup:
23 Type: AWS::EC2::SecurityGroup
24 Properties:
25 GroupDescription: Enable only ping and SSH access
26 SecurityGroupIngress:
27 - {CidrIp: 0.0.0.0/0, FromPort: '-1', IpProtocol: icmp, ToPort: '-1'}
28 - {CidrIp: 0.0.0.0/0, FromPort: '22', IpProtocol: tcp, ToPort: '22'}
29 SmokeKeys:
30 Type: AWS::IAM::AccessKey
31 Properties:
32 UserName: {Ref: CfnUser}
33
34 ElasticIp:
35 Type: AWS::EC2::EIP
36 Properties:
37 Domain: vpc
38
39 SmokeServerElasticIp:
40 Type: AWS::EC2::EIPAssociation
41 Properties:
42 EIP: {Ref: ElasticIp}
43 InstanceId: {Ref: SmokeServer}
44
45 SmokeServer:
46 Type: AWS::EC2::Instance
47 Metadata:
48 AWS::CloudFormation::Init:
49 config:
50 files:
51 /tmp/smoke-status:
52 content: smoke test complete
53 /etc/cfn/cfn-credentials:
54 content:
55 Fn::Replace:
56 - SmokeKeys: {Ref: SmokeKeys}
57 SecretAccessKey:
58 'Fn::GetAtt': [SmokeKeys, SecretAccessKey]
59 - |
60 AWSAccessKeyId=SmokeKeys
61 AWSSecretKey=SecretAccessKey
62 mode: '000400'
63 owner: root
64 group: root
65 Properties:
66 ImageId: {Ref: image}
67 InstanceType: {Ref: flavor}
68 KeyName: {Ref: key_name}
69 SubnetId: {Ref: subnet}
70 SecurityGroups:
71 - {Ref: SmokeSecurityGroup}
72 UserData:
73 Fn::Replace:
74 - WaitHandle: {Ref: WaitHandle}
75 SignalExtraArgs: {Ref: SignalExtraArgs}
76 - |
77 #!/bin/bash -v
78 /usr/bin/cfn-init
79 /usr/bin/cfn-signal SignalExtraArgs -e 0 --data "`cat /tmp/smoke-status`" \
80 --id smoke_status "WaitHandle"
81 WaitHandle:
82 Type: AWS::CloudFormation::WaitConditionHandle
83 WaitCondition:
84 Type: AWS::CloudFormation::WaitCondition
85 DependsOn: SmokeServer
86 Properties:
87 Handle: {Ref: WaitHandle}
88 Timeout: {Ref: timeout}
89 Outputs:
90 WaitConditionStatus:
91 Description: Contents of /tmp/smoke-status on SmokeServer
92 Value:
93 Fn::GetAtt: [WaitCondition, Data]
94 ElasticIp_Id:
95 Description: Elastic ip allocation id
96 Value:
97 Fn::GetAtt: [ElasticIp, AllocationId]
98 SmokeServerElasticIp:
99 Description: Elastic ip address of server
100 Value:
101 Ref: ElasticIp