-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from clouddrove/0.15
add github-action,pre-coomit,readme.yml
- Loading branch information
Showing
20 changed files
with
512 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: 'Create README.md file' | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
readme-create: | ||
name: 'readme-create' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 'Checkout' | ||
uses: actions/checkout@master | ||
|
||
- name: Set up Python 3.7. | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: 'create readme' | ||
uses: 'clouddrove/[email protected]' | ||
with: | ||
actions_subcommand: 'readme' | ||
github_token: '${{ secrets.GITHUB}}' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} | ||
|
||
|
||
- name: pre-commit check errors | ||
uses: pre-commit/[email protected] | ||
continue-on-error: true | ||
|
||
- name: pre-commit fix erros | ||
uses: pre-commit/[email protected] | ||
continue-on-error: true | ||
|
||
- name: 'push readme' | ||
uses: 'clouddrove/[email protected]' | ||
continue-on-error: true | ||
with: | ||
actions_subcommand: 'push' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} | ||
|
||
- name: 'Slack Notification' | ||
uses: clouddrove/action-slack@v2 | ||
with: | ||
status: ${{ job.status }} | ||
fields: repo,author | ||
author_name: 'CloudDrove Inc.' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required | ||
if: always() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
name: 'Terraform GitHub Actions' | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
fmt: | ||
name: 'terraform fmt' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 'Checkout' | ||
uses: actions/[email protected] | ||
|
||
- name: 'Terraform Format' | ||
uses: 'clouddrove/[email protected]' | ||
with: | ||
actions_subcommand: 'fmt' | ||
- name: 'Terraform Format' | ||
uses: 'clouddrove/[email protected]' | ||
with: | ||
actions_subcommand: 'fmt' | ||
|
||
event_bus_archive: | ||
name: 'event_bus_archive' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 'Checkout' | ||
uses: actions/[email protected] | ||
|
||
- name: 'Configure AWS Credentials' | ||
uses: clouddrove/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.TEST_AWS_ACCESS_KEY }} | ||
aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }} | ||
aws-region: us-east-2 | ||
|
||
- name: 'Terraform init' | ||
uses: 'clouddrove/[email protected]' | ||
with: | ||
actions_subcommand: 'init' | ||
tf_actions_working_dir: ./_example/event_bus_archive | ||
|
||
- name: 'Terraform validate for event_bus_archive' | ||
uses: 'clouddrove/[email protected]' | ||
with: | ||
actions_subcommand: 'validate' | ||
tf_actions_working_dir: ./_example/event_bus_archive | ||
|
||
- name: 'Terraform plan for event_bus_archive' | ||
uses: 'clouddrove/[email protected]' | ||
with: | ||
actions_subcommand: 'plan' | ||
tf_actions_working_dir: ./_example/event_bus_archive | ||
|
||
event_rule_target: | ||
name: 'secure_example' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 'Checkout' | ||
uses: actions/[email protected] | ||
|
||
- name: 'Configure AWS Credentials' | ||
uses: clouddrove/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.TEST_AWS_ACCESS_KEY }} | ||
aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }} | ||
aws-region: us-east-2 | ||
|
||
- name: 'Terraform init' | ||
uses: 'clouddrove/[email protected]' | ||
with: | ||
actions_subcommand: 'init' | ||
tf_actions_working_dir: ./_example/event_rule_target | ||
|
||
- name: 'Terraform validate for event_rule_target' | ||
uses: 'clouddrove/[email protected]' | ||
with: | ||
actions_subcommand: 'validate' | ||
tf_actions_working_dir: ./_example/event_rule_target | ||
|
||
- name: 'Terraform plan for event_rule_target' | ||
uses: 'clouddrove/[email protected]' | ||
with: | ||
actions_subcommand: 'plan' | ||
tf_actions_working_dir: ./_example/event_rule_target | ||
|
||
pre-commit: | ||
name: 'Pre-Commit' | ||
needs: | ||
- fmt | ||
- event_bus_archive | ||
- event_rule_target | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 'Checkout' | ||
uses: actions/[email protected] | ||
|
||
- name: 'Install Tflint' | ||
run: | | ||
curl https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash | ||
- name: 'Pre-Commit 🔎' | ||
uses: pre-commit/[email protected] | ||
continue-on-error: true | ||
|
||
- name: 'Slack Notification' | ||
uses: clouddrove/action-slack@v2 | ||
with: | ||
status: ${{ job.status }} | ||
fields: repo,author | ||
author_name: 'CloudDrove Inc.' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required | ||
if: always() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: 'Terratest GitHub Actions' | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
types: [labeled] | ||
|
||
jobs: | ||
terraform: | ||
name: 'Terraform' | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: 'Checkout' | ||
uses: actions/[email protected] | ||
|
||
- name: Configure AWS Credentials | ||
uses: clouddrove/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.TEST_AWS_ACCESS_KEY }} | ||
aws-secret-access-key: ${{ secrets.TEST_AWS_ACCESS_SECRET_KEY }} | ||
aws-region: us-east-2 | ||
|
||
- name: 'Terratest for event_bus_archive' | ||
if: ${{ github.event.label.name == 'terratest' }} | ||
uses: 'clouddrove/[email protected]' | ||
with: | ||
actions_subcommand: 'terratest' | ||
tf_actions_working_dir: '_test/event_bus_archive' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: 'Terratest for event_rule_target' | ||
if: ${{ github.event.label.name == 'terratest' }} | ||
uses: 'clouddrove/[email protected]' | ||
with: | ||
actions_subcommand: 'terratest' | ||
tf_actions_working_dir: '_test/event_rule_target' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: 'Slack Notification' | ||
uses: clouddrove/action-slack@v2 | ||
with: | ||
status: ${{ job.status }} | ||
fields: repo,author | ||
author_name: 'CloudDrove Inc.' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required | ||
if: always() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
repos: | ||
|
||
- repo: https://github.com/gruntwork-io/pre-commit | ||
rev: v0.1.12 # Get the latest from: https://github.com/gruntwork-io/pre-commit/releases | ||
hooks: | ||
- id: terraform-fmt | ||
- id: shellcheck | ||
- id: tflint | ||
|
||
- repo: git://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.0.1 # Use the ref you want to point at | ||
hooks: | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- id: mixed-line-ending | ||
- id: check-byte-order-marker | ||
- id: check-executables-have-shebangs | ||
- id: check-merge-conflict | ||
- id: debug-statements | ||
- id: check-yaml | ||
- id: check-added-large-files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Cloud Drove | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export GENIE_PATH ?= $(shell 'pwd')/../../../genie | ||
include $(GENIE_PATH)/Makefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
--- | ||
# | ||
# This is the canonical configuration for the `README.md` | ||
# Run `make readme` to rebuild the `README.md` | ||
# | ||
|
||
|
||
# Name of this project | ||
name: Terraform AWS eventbridge | ||
|
||
# License of this project | ||
license: "MIT" | ||
|
||
# Canonical GitHub repo | ||
github_repo: clouddrove/terraform-aws-eventbridge | ||
|
||
# Badges to display | ||
badges: | ||
- name: "Terraform" | ||
image: "https://img.shields.io/badge/Terraform-v0.15-green" | ||
url: "https://www.terraform.io" | ||
- name: "Licence" | ||
image: "https://img.shields.io/badge/License-MIT-blue.svg" | ||
url: "LICENSE.md" | ||
|
||
# description of this project | ||
# yamllint disable rule:line-length | ||
|
||
description: |- | ||
Terraform module is used to create eventbridge resource on AWS for network connectivity.. | ||
# extra content | ||
include: | ||
- "terraform.md" | ||
|
||
# How to use this project | ||
# yamllint disable rule:line-length | ||
usage: |- | ||
### event_bus_archive | ||
Here is an example of how you can use this module in your inventory structure: | ||
```hcl | ||
module "eventbridge_archive" { | ||
create_bus = true | ||
create_archives = true | ||
name = "bus" | ||
environment = "test" | ||
label_order = ["name", "environment"] | ||
archives = { | ||
"launch-archive-existing-bus" = { | ||
description = "launch-archive", | ||
retention_days = 1 | ||
event_pattern = jsonencode( | ||
{ | ||
"source" : ["aws.autoscaling"], | ||
"detail-type" : ["EC2 Instance Launch Successful"] | ||
} | ||
) | ||
} | ||
} | ||
} | ||
``` | ||
### event_rule_target | ||
```hcl | ||
module "eventbridge" { | ||
name = "subnets" | ||
environment = "test" | ||
label_order = ["name", "environment"] | ||
rules = { | ||
orders = { | ||
description = "Capture all order data" | ||
event_pattern = jsonencode({ "source" : ["myapp.orders"] }) | ||
enabled = true | ||
role_arn = module.iam-role.arn | ||
} | ||
emails = { | ||
description = "Capture all emails data" | ||
event_pattern = jsonencode({ "source" : ["myapp.emails"] }) | ||
enabled = true | ||
} | ||
} | ||
targets = { | ||
orders = [ | ||
{ | ||
name = "send-orders-to-sqs-wth-dead-letter" | ||
arn = aws_sqs_queue.queue.arn | ||
dead_letter_arn = aws_sqs_queue.dlq.arn | ||
}, | ||
{ | ||
name = "send-orders-to-sqs" | ||
arn = aws_sqs_queue.queue.arn | ||
} | ||
] | ||
emails = [ | ||
{ | ||
name = "send-orders-to-kinesis" | ||
dead_letter_arn = aws_sqs_queue.dlq.arn | ||
arn = aws_sqs_queue.dlq.arn | ||
} | ||
] | ||
} | ||
} | ||
``` |
Oops, something went wrong.