Skip to content

Commit

Permalink
Merge pull request #7 from clouddrove/CD-209
Browse files Browse the repository at this point in the history
upgrade terraform version to 0.13.0 and add pipelines
  • Loading branch information
Sohan Yadav committed Oct 26, 2020
2 parents 639c272 + 5979ed5 commit 18fabe3
Show file tree
Hide file tree
Showing 11 changed files with 189 additions and 33 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/readme.yml
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/github-actions@v4.0'
with:
actions_subcommand: 'readme'
github_token: '${{ secrets.GITHUB}}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}


- name: pre-commit check errors
uses: pre-commit/action@v2.0.0
continue-on-error: true

- name: pre-commit fix erros
uses: pre-commit/action@v2.0.0
continue-on-error: true

- name: 'push readme'
uses: 'clouddrove/github-actions@v4.0'
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'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
if: always()
90 changes: 90 additions & 0 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: 'Terraform GitHub Actions'
on:
pull_request:
branches:
- master

jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@master

- 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 Format'
uses: 'clouddrove/github-actions@v4.0'
with:
actions_subcommand: 'fmt'

- name: 'Terraform init bucket-basic'
uses: 'clouddrove/github-actions@v4.0'
with:
actions_subcommand: 'init'
tf_actions_working_dir: ./_example/bucket-basic

- name: 'Terraform validate bucket-basic'
uses: 'clouddrove/github-actions@v4.0'
with:
actions_subcommand: 'validate'
tf_actions_working_dir: ./_example/bucket-basic

- name: 'Terraform plan bucket-basic'
uses: 'clouddrove/github-actions@v4.0'
with:
actions_subcommand: 'plan'
tf_actions_working_dir: ./_example/bucket-basic

- name: 'Terraform init domain-cdn'
uses: 'clouddrove/github-actions@v4.0'
with:
actions_subcommand: 'init'
tf_actions_working_dir: ./_example/domain-cdn

- name: 'Terraform validate domain-cdn'
uses: 'clouddrove/github-actions@v4.0'
with:
actions_subcommand: 'validate'
tf_actions_working_dir: ./_example/domain-cdn

- name: 'Terraform plan domain-cdn'
uses: 'clouddrove/github-actions@v4.0'
with:
actions_subcommand: 'plan'
tf_actions_working_dir: ./_example/domain-cdn

- name: 'Terraform init bucket-secure'
uses: 'clouddrove/github-actions@v4.0'
with:
actions_subcommand: 'init'
tf_actions_working_dir: ./_example/bucket-secure

- name: 'Terraform validate bucket-secure'
uses: 'clouddrove/github-actions@v4.0'
with:
actions_subcommand: 'validate'
tf_actions_working_dir: ./_example/bucket-secure

- name: 'Terraform plan bucket-secure'
uses: 'clouddrove/github-actions@v4.0'
with:
actions_subcommand: 'plan'
tf_actions_working_dir: ./_example/bucket-secure

- name: 'Slack Notification'
uses: clouddrove/action-slack@v2
with:
status: ${{ job.status }}
fields: repo,author
author_name: 'CloudDrove'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
if: always()
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.12.0
rev: v1.43.0
hooks:
- id: terraform_fmt

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.0.0
rev: v3.2.0
hooks:
- id: check-merge-conflict
- id: trailing-whitespace
- id: check-yaml
- id: check-added-large-files
- id: check-added-large-files
- id: trailing-whitespace
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Cloud Drove
Copyright (c) 2020 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
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Terraform AWS Cloudfront CDN
</h1>

<p align="center" style="font-size: 1.2rem;">
<p align="center" style="font-size: 1.2rem;">
Terraform module provisions CloudFront CDN resource on AWS.
</p>

Expand Down Expand Up @@ -35,7 +35,7 @@
<hr>


We eat, drink, sleep and most importantly love **DevOps**. We are working towards strategies for standardizing architecture while ensuring security for the infrastructure. We are strong believer of the philosophy <b>Bigger problems are always solved by breaking them into smaller manageable problems</b>. Resonating with microservices architecture, it is considered best-practice to run database, cluster, storage in smaller <b>connected yet manageable pieces</b> within the infrastructure.
We eat, drink, sleep and most importantly love **DevOps**. We are working towards strategies for standardizing architecture while ensuring security for the infrastructure. We are strong believer of the philosophy <b>Bigger problems are always solved by breaking them into smaller manageable problems</b>. Resonating with microservices architecture, it is considered best-practice to run database, cluster, storage in smaller <b>connected yet manageable pieces</b> within the infrastructure.

This module is basically combination of [Terraform open source](https://www.terraform.io/) and includes automatation tests and examples. It also helps to create and improve your infrastructure with minimalistic code instead of maintaining the whole infrastructure code yourself.

Expand All @@ -46,7 +46,7 @@ We have [*fifty plus terraform modules*][terraform_modules]. A few of them are c

## Prerequisites

This module has a few dependencies:
This module has a few dependencies:

- [Terraform 0.12](https://learn.hashicorp.com/terraform/getting-started/install.html)
- [Go](https://golang.org/doc/install)
Expand Down Expand Up @@ -202,7 +202,7 @@ Here are some examples of how you can use this module in your inventory structur


## Testing
In this module testing is performed with [terratest](https://github.com/gruntwork-io/terratest) and it creates a small piece of infrastructure, matches the output like ARN, ID and Tags name etc and destroy infrastructure in your AWS account. This testing is written in GO, so you need a [GO environment](https://golang.org/doc/install) in your system.
In this module testing is performed with [terratest](https://github.com/gruntwork-io/terratest) and it creates a small piece of infrastructure, matches the output like ARN, ID and Tags name etc and destroy infrastructure in your AWS account. This testing is written in GO, so you need a [GO environment](https://golang.org/doc/install) in your system.

You need to run the following command in the testing folder:
```hcl
Expand All @@ -211,7 +211,7 @@ You need to run the following command in the testing folder:



## Feedback
## Feedback
If you come accross a bug or have any feedback, please log it in our [issue tracker](https://github.com/clouddrove/terraform-aws-cloudfront-cdn/issues), or feel free to drop us an email at [hello@clouddrove.com](mailto:hello@clouddrove.com).

If you have found it worth your time, go ahead and give us a ★ on [our GitHub](https://github.com/clouddrove/terraform-aws-cloudfront-cdn)!
Expand Down
9 changes: 6 additions & 3 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ usage : |-
### CDN With Basic Bucket
```hcl
module "cdn" {
source = "git::https://github.com/clouddrove/terraform-aws-cloudfront-cdn.git?ref=tags/0.12.1"
source = "clouddrove/cloudfront-cdn/aws"
version = "0.13.0"
name = "basic-cdn"
application = "clouddrove"
environment = "test"
Expand All @@ -58,7 +59,8 @@ usage : |-
### CDN With Secure Bucket
```hcl
module "cdn" {
source = "git::https://github.com/clouddrove/terraform-aws-cloudfront-cdn.git?ref=tags/0.12.1"
source = "clouddrove/cloudfront-cdn/aws"
version = "0.13.0"
name = "secure-cdn"
application = "clouddrove"
environment = "test"
Expand All @@ -77,7 +79,8 @@ usage : |-
### CDN With Domain
```hcl
module "cdn" {
source = "git::https://github.com/clouddrove/terraform-aws-cloudfront-cdn.git?ref=tags/0.12.1"
source = "clouddrove/cloudfront-cdn/aws"
version = "0.13.0"
name = "domain-cdn"
application = "clouddrove"
environment = "test"
Expand Down
21 changes: 11 additions & 10 deletions _example/bucket-basic/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ provider "aws" {
}

module "s3_bucket" {
source = "git::https://github.com/clouddrove/terraform-aws-s3.git?ref=tags/0.12.2"
source = "clouddrove/s3/aws"
version = "0.13.0"

name = "basic-bucket-cdn"
region = "us-east-1"
application = "clouddrove"
environment = "test"
label_order = ["environment", "name", "application"]

versioning = true
acl = "private"
bucket_enabled = true
versioning = true
acl = "private"
bucket_enabled = true
bucket_policy = true
aws_iam_policy_document = data.aws_iam_policy_document.s3_policy.json
}
Expand All @@ -33,16 +33,17 @@ data "aws_iam_policy_document" "s3_policy" {
}

module "acm" {
source = "git::https://github.com/clouddrove/terraform-aws-acm.git?ref=tags/0.12.0"

source = "clouddrove/acm/aws"
version = "0.13.0"
name = "certificate"
application = "clouddrove"
environment = "test"
label_order = ["environment", "name", "application"]

domain_name = "clouddrove.com"
validation_method = "EMAIL"
validate_certificate = true
domain_name = "clouddrove.com"
validation_method = "EMAIL"
validate_certificate = true
enable_aws_certificate = true
}

module "cdn" {
Expand Down
9 changes: 5 additions & 4 deletions _example/bucket-secure/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ provider "aws" {
}

module "s3_bucket" {
source = "git::https://github.com/clouddrove/terraform-aws-s3.git?ref=tags/0.12.2"

source = "clouddrove/s3/aws"
version = "0.13.0"
name = "secure-bucket-cdn"
region = "us-east-1"
application = "clouddrove"
environment = "test"
label_order = ["environment", "name", "application"]
Expand All @@ -17,7 +16,8 @@ module "s3_bucket" {
}

module "acm" {
source = "git::https://github.com/clouddrove/terraform-aws-acm.git?ref=tags/0.12.0"
source = "clouddrove/acm/aws"
version = "0.13.0"

name = "certificate"
application = "clouddrove"
Expand All @@ -27,6 +27,7 @@ module "acm" {
domain_name = "clouddrove.com"
validation_method = "EMAIL"
validate_certificate = false

}

module "cdn" {
Expand Down
10 changes: 6 additions & 4 deletions _example/domain-cdn/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ provider "aws" {
}

module "acm" {
source = "git::https://github.com/clouddrove/terraform-aws-acm.git?ref=tags/0.12.0"
source = "clouddrove/acm/aws"
version = "0.13.0"

name = "certificate"
application = "clouddrove"
environment = "test"
label_order = ["environment", "name", "application"]

domain_name = "clouddrove.com"
validation_method = "EMAIL"
validate_certificate = true
domain_name = "clouddrove.com"
validation_method = "EMAIL"
validate_certificate = true
enable_aws_certificate = true
}

module "cdn" {
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# tags for resources. You can use terraform-labels to implement a strict
# naming convention.
module "labels" {
source = "git::https://github.com/clouddrove/terraform-labels.git?ref=tags/0.12.0"
source = "git::https://github.com/clouddrove/terraform-labels.git?ref=tags/0.13.0"

name = var.name
application = var.application
Expand Down
7 changes: 6 additions & 1 deletion versions.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Terraform version
terraform {
required_version = ">= 0.12"
required_version = ">= 0.12.0, < 0.14.0"
required_providers {
aws = {
source = "hashicorp/aws"
}
}
}

0 comments on commit 18fabe3

Please sign in to comment.