kitchen-cloudformation 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +3 -0
- data/LICENSE +12 -0
- data/README.md +146 -0
- data/ca-bundle.crt +3721 -0
- data/kitchen-cloudformation.gemspec +26 -0
- data/lib/kitchen/driver/aws/cf_client.rb +108 -0
- data/lib/kitchen/driver/aws/stack_generator.rb +60 -0
- data/lib/kitchen/driver/cloud_formation.rb +185 -0
- data/lib/kitchen/driver/cloudformation_version.rb +22 -0
- metadata +123 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 82766a03521b8ae66cbd55c8595a99a6e6987251
|
4
|
+
data.tar.gz: 469a2c828e14cf0e2d594b9a9f952640fff54878
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7e03b00da1ade35c0a48a8f20bc837684aba43551549ca24433e13e2530abb5ee5445b47bee1a03d7989fc7b7f041e38ca54b69c3a780b2dd081b5c757f2adbb
|
7
|
+
data.tar.gz: 2dfb3564d3325a4aaff8ce535ebcf17c7b7617ed446ca95f8175ec61e2a7767e47186c74077870d8e6a8eb88fa09b183f12e97dca4fdd4837a260a813ced0c90
|
data/CHANGELOG.md
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
|
2
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
3
|
+
you may not use this file except in compliance with the License.
|
4
|
+
You may obtain a copy of the License at
|
5
|
+
|
6
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
|
8
|
+
Unless required by applicable law or agreed to in writing, software
|
9
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
See the License for the specific language governing permissions and
|
12
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
# kitchen-cloudformation
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/kitchen-cloudformation.png)](http://badge.fury.io/rb/kitchen-cloudformation)
|
4
|
+
[![Build Status](https://travis-ci.org/neillturner/kitchen-cloudformation.png)](https://travis-ci.org/neillturner/kitchen-cloudformation)
|
5
|
+
|
6
|
+
A Test Kitchen Driver for Amazon AWS CloudFormation.
|
7
|
+
|
8
|
+
This driver uses the [aws sdk gem][aws_sdk_gem] to create and delete Amazon AWS CloudFormation stacks to orchestrate your cloud resources for your infrastructure testing, dev or production setup.
|
9
|
+
|
10
|
+
It works best using AWS VPC where the servers have fixed IP addresses or in AWS Clasic using known Elastic IP Addresses.
|
11
|
+
This allow the IP address of each of the servers to be specified as a hostname in the suite definition (see example below).
|
12
|
+
|
13
|
+
So you can deploy and test say a Mongodb High Availability cluster by using cloud formation to create the servers
|
14
|
+
and then converge each of the servers in the cluster and run tests.
|
15
|
+
|
16
|
+
WARNING: This is a pre-release version. I'm sure the code does not handle all error conditions etc.
|
17
|
+
|
18
|
+
## Requirements
|
19
|
+
|
20
|
+
There are **no** external system requirements for this driver. However you
|
21
|
+
will need access to an [AWS][aws_site] account.
|
22
|
+
|
23
|
+
|
24
|
+
## Configuration Options
|
25
|
+
|
26
|
+
key | default value | Notes
|
27
|
+
----|---------------|--------
|
28
|
+
region|ENV["AWS_REGION"] or "us-east-1"|Aws Region
|
29
|
+
shared_credentials_profile| nil|Specify Credentials Using a Profile Name
|
30
|
+
aws_access_key_id|nil|Deprecated see Authenticating with AWS
|
31
|
+
aws_secret_access_key|nil|Deprecated see Authenticating with AWS
|
32
|
+
aws_session_token|nil|Deprecated see Authenticating with AWS
|
33
|
+
ssl_cert_file| ENV["SSL_CERT_FILE"]|SSL Certificate required on Windows platforms
|
34
|
+
stack_name ||Name of the Cloud Formation Stack to create
|
35
|
+
template_file||File containing the CloudFormation template to run
|
36
|
+
template_url||URL of the file containing the CloudFormation template to run
|
37
|
+
parameters|{}|Hash of parameters {key: value} to apply to the templates
|
38
|
+
disable_rollback|false|If the template gets an error don't rollback changes
|
39
|
+
timeout_in_minutes|0|Timeout if the stack is not created in the time
|
40
|
+
|
41
|
+
## Authenticating with AWS
|
42
|
+
|
43
|
+
There are 3 ways you can authenticate against AWS, and we will try them in the
|
44
|
+
following order:
|
45
|
+
|
46
|
+
1. You can specify the access key and access secret (and optionally the session
|
47
|
+
token) through config. See the `aws_access_key_id` and `aws_secret_access_key`
|
48
|
+
config sections below to see how to specify these in your .kitchen.yml or
|
49
|
+
through environment variables. If you would like to specify your session token
|
50
|
+
use the environment variable `AWS_SESSION_TOKEN`.
|
51
|
+
1. The shared credentials ini file at `~/.aws/credentials`. You can specify
|
52
|
+
multiple profiles in this file and select one with the `AWS_PROFILE`
|
53
|
+
environment variable or the `shared_credentials_profile` driver config. Read
|
54
|
+
[this][credentials_docs] for more information.
|
55
|
+
1. From an instance profile when running on EC2. This accesses the local
|
56
|
+
metadata service to discover the local instance's IAM instance profile.
|
57
|
+
|
58
|
+
This precedence order is taken from http://docs.aws.amazon.com/sdkforruby/api/index.html#Configuration
|
59
|
+
|
60
|
+
```
|
61
|
+
In summary it searches the following locations for credentials:
|
62
|
+
|
63
|
+
ENV['AWS_ACCESS_KEY_ID'] and ENV['AWS_SECRET_ACCESS_KEY']
|
64
|
+
The shared credentials ini file at ~/.aws/credentials (more information)
|
65
|
+
From an instance profile when running on EC2
|
66
|
+
|
67
|
+
and it searches the following locations for a region:
|
68
|
+
|
69
|
+
ENV['AWS_REGION']
|
70
|
+
```
|
71
|
+
|
72
|
+
|
73
|
+
The first method attempted that works will be used. IE, if you want to auth
|
74
|
+
using the instance profile, you must not set any of the access key configs
|
75
|
+
or environment variables, and you must not specify a `~/.aws/credentials`
|
76
|
+
file.
|
77
|
+
|
78
|
+
Because the Test Kitchen test should be checked into source control and ran
|
79
|
+
through CI we no longer recommend storing the AWS credentials in the
|
80
|
+
`.kitchen.yml` file. Instead, specify them as environment variables or in the
|
81
|
+
`~/.aws/credentials` file.
|
82
|
+
|
83
|
+
## SSL Certificate File Issues
|
84
|
+
|
85
|
+
On windows you can get errors `SSLv3 read server certificate B: certificate verify failed`
|
86
|
+
as per https://github.com/aws/aws-sdk-core-ruby/issues/93 .
|
87
|
+
|
88
|
+
To overcome this problem set the parameter `ssl_cert_file` or the environment variable `SSL_CERT_FILE`
|
89
|
+
to a a SSL CA bundle.
|
90
|
+
|
91
|
+
A file ca-bundle.crt is supplied inside this gem for this purpose so you can set it to something like:
|
92
|
+
`<RubyHome>/lib/ruby/gems/2.1.0/gems/kitchen-cloudformation-0.0.1/ca-bundle.crt`
|
93
|
+
|
94
|
+
|
95
|
+
## Example
|
96
|
+
|
97
|
+
The following could be used in a `.kitchen.yml` or in a `.kitchen.local.yml`
|
98
|
+
to override default configuration.
|
99
|
+
|
100
|
+
```yaml
|
101
|
+
---
|
102
|
+
driver:
|
103
|
+
name: cloudformation
|
104
|
+
stack_name: mystack
|
105
|
+
template_file: /test/example.template
|
106
|
+
parameters:
|
107
|
+
- base_package: wget
|
108
|
+
|
109
|
+
provisioner:
|
110
|
+
name: chef_zero
|
111
|
+
|
112
|
+
platforms:
|
113
|
+
- name: centos-6.4
|
114
|
+
driver: cloud_formation
|
115
|
+
|
116
|
+
suites:
|
117
|
+
- name: default
|
118
|
+
driver_config:
|
119
|
+
ssh_key: /mykeys/mykey.pem
|
120
|
+
username: root
|
121
|
+
hostname: '10.53.191.70'
|
122
|
+
```
|
123
|
+
|
124
|
+
## <a name="license"></a> License
|
125
|
+
|
126
|
+
Apache 2.0 (see [LICENSE][license])
|
127
|
+
|
128
|
+
|
129
|
+
[author]: https://github.com/neillturner
|
130
|
+
[issues]: https://github.com/neillturner/kitchen-cloudformation/issues
|
131
|
+
[license]: https://github.com/neillturner/kitchen-cloudformation/blob/master/LICENSE
|
132
|
+
[repo]: https://github.com/neillturner/kitchen-cloudformation
|
133
|
+
[driver_usage]: http://docs.kitchen-ci.org/drivers/usage
|
134
|
+
[chef_omnibus_dl]: http://www.getchef.com/chef/install/
|
135
|
+
|
136
|
+
[aws_site]: http://aws.amazon.com/
|
137
|
+
[credentials_docs]: http://blogs.aws.amazon.com/security/post/Tx3D6U6WSFGOK2H/A-New-and-Standardized-Way-to-Manage-Credentials-in-the-AWS-SDKs
|
138
|
+
[aws_sdk_gem]: http://docs.aws.amazon.com/sdkforruby/api/index.html
|
139
|
+
[cloud_formation_docs]: http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/Welcome.html
|
140
|
+
|
141
|
+
## TO DO
|
142
|
+
|
143
|
+
-More testing and error handling.
|
144
|
+
|
145
|
+
-implement all the options of cloud formation.
|
146
|
+
|