Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/openvidu/cloudformation-patcher
A simple tool to create Cloudformation patches
https://github.com/openvidu/cloudformation-patcher
Last synced: about 1 month ago
JSON representation
A simple tool to create Cloudformation patches
- Host: GitHub
- URL: https://github.com/openvidu/cloudformation-patcher
- Owner: OpenVidu
- License: apache-2.0
- Created: 2022-03-15T16:03:43.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-03-15T16:16:47.000Z (almost 3 years ago)
- Last Synced: 2024-02-24T19:57:10.761Z (10 months ago)
- Language: Shell
- Size: 7.81 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cloudformation patcher
This tool allows to generate Cloudformations based on:
- A **Cloudformation file**
- A YAML formatted file which describes changes applied to the original Cloudformation.
# How the parser works and how to execute it?Let's suppose a basic Cloudformation file
- **`cf-example.yaml`**
```yaml
AWSTemplateFormatVersion: 2010-09-09
Description: Example
Resources:
ConfidentialBucket:
Type: AWS::S3::Bucket
Properties:
AccessControl: PublicRead
NotUsefulBucket:
Type: AWS::S3::Bucket
Properties:
AccessControl: PublicRead
```We want to:
- Make `Confidential` bucket a private Bucket
- Remove `NotUsefulBucket`
- Create a `NewBucket`Instead of manually editing the file, let's create a patch file with a special YAML format like this:
- **`patch-example.yaml`**
```yaml
Patches:
# ================
# Change 'Confidential' bucket to private
# ================
- AddOrUpdate:
Location: .Resources.ConfidentialBucket.Properties.AccessControl
Content: Private
# ================
# Create new bucket: 'NewBucket'
# ================
- AddOrUpdate:
Location: .Resources.ConfidentialBucket.NewBucket
Content:
Type: AWS::S3::Bucket
Properties:
AccessControl: PublicRead
# ================
# Remove 'NotUsefulBucket'
# ================
- Remove:
Location: .Resources.ConfidentialBucket.NotUsefulBucket
```First you need the docker image build on your system (You need Docker installed):
To generate the final Cloudformation file, we just need to execute:
```
docker run --rm -it -v "${PWD}":/workdir \
openvidu/cloudformation-patcher \
--original example/cf-example.yaml \
--patch example/patch-example.yaml \
--output example/output.yaml
```And this will generate at `example/output.yml` the final Cloudformation with all the changes:
```yaml
AWSTemplateFormatVersion: 2010-09-09
Description: Example
Resources:
ConfidentialBucket:
Type: AWS::S3::Bucket
Properties:
AccessControl: Private
NewBucket:
Type: AWS::S3::Bucket
Properties:
AccessControl: PublicRead
```# Modify and build the tool.
To modify the docker image of the tool, you just need to modify the script at `docker/cloudformation-patcher` and build the image with:
```
./create_image.sh
```Or just build the image with:
```
docker build . -t openvidu/cloudformation-patcher
```