Skip to content

Commit

Permalink
Merge pull request #11 from clouddrove/0.14
Browse files Browse the repository at this point in the history
Upgrade module with Terraform 0.14
  • Loading branch information
Sohan Yadav authored Jan 20, 2021
2 parents 1424e09 + a221564 commit 43c6b87
Show file tree
Hide file tree
Showing 19 changed files with 166 additions and 157 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@master
uses: actions/checkout@v2.3.4

- 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'
uses: 'clouddrove/github-actions@v6.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
Expand All @@ -35,7 +34,7 @@ jobs:
continue-on-error: true

- name: 'push readme'
uses: 'clouddrove/github-actions@v4.0'
uses: 'clouddrove/github-actions@v6.0'
continue-on-error: true
with:
actions_subcommand: 'push'
Expand Down
44 changes: 21 additions & 23 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,48 @@ on:
- master

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

- name: Configure AWS Credentials
- name: 'Terraform Format'
uses: 'clouddrove/github-actions@v6.0'
with:
actions_subcommand: 'fmt'

Basic:
name: 'Init,Validate,PLan of Basic example'
needs: fmt
runs-on: ubuntu-latest
steps:

- name: 'Checkout'
uses: actions/checkout@v2.3.4

- 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'
uses: 'clouddrove/github-actions@v4.0'
uses: 'clouddrove/github-actions@v6.0'
with:
actions_subcommand: 'init'
tf_actions_working_dir: ./_example/basic

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

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

- 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()
10 changes: 5 additions & 5 deletions .github/workflows/terratest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ on:
types: [labeled]

jobs:
terraform:
name: 'Terraform'
Terratest:
name: 'Terratest for basic'
runs-on: ubuntu-latest
steps:

- name: 'Checkout'
uses: actions/checkout@master
uses: actions/checkout@v2.3.4

- name: Configure AWS Credentials
uses: clouddrove/configure-aws-credentials@v1
Expand All @@ -23,7 +23,7 @@ jobs:

- name: 'Terratest'
if: ${{ github.event.label.name == 'terratest' }}
uses: 'clouddrove/github-actions@v4.0'
uses: 'clouddrove/github-actions@v6.0'
with:
actions_subcommand: 'terratest'
tf_actions_working_dir: '_test/basic'
Expand All @@ -39,4 +39,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
if: always()
if: always()
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
.terraform
.idea
*.iml
go.sum
go.sum
*.terraform.lock.hcl
19 changes: 13 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.43.0

- 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: terraform-fmt
- id: shellcheck

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0 # 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
- 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) 2020 Cloud Drove
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
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export GENIE_PATH ?= $(shell 'pwd')/../../../genie

include $(GENIE_PATH)/Makefile
include $(GENIE_PATH)/Makefile
19 changes: 9 additions & 10 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ github_repo: clouddrove/terraform-aws-api-gateway
# Badges to display
badges:
- name: "Terraform"
image: "https://img.shields.io/badge/Terraform-v0.13-green"
image: "https://img.shields.io/badge/Terraform-v0.14-green"
url: "https://www.terraform.io"
- name: "Licence"
image: "https://img.shields.io/badge/License-MIT-blue.svg"
Expand All @@ -40,12 +40,11 @@ usage: |-
```hcl
module "api-gateway" {
source = "clouddrove/api-gateway/aws"
version = "0.13.0"
name = "api-gateway"
application = "clouddrove"
environment = "test"
label_order = ["environment", "name", "application"]
enabled = true
version = "0.14.0"
name = "api-gateway"
environment = "test"
label_order = ["name", "environment"]
enabled = true
# Api Gateway Resource
path_parts = ["mytestresource", "mytestresource1"]
Expand Down Expand Up @@ -99,11 +98,11 @@ usage: |-
```hcl
module "api-gateway" {
source = "clouddrove/api-gateway/aws"
version = "0.13.0"
version = "0.14.0"
name = "api-gateway"
application = "clouddrove"
environment = "test"
label_order = ["environment", "name", "application"]
label_order = ["name", "environment"]
enabled = true
# Api Gateway Resource
Expand Down
11 changes: 6 additions & 5 deletions _example/basic/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ provider "aws" {
}

module "api-gateway" {
source = "../../"
name = "api-gateway"
application = "clouddrove"
source = "../../"
name = "api-gateway"

repository = "https://registry.terraform.io/modules/clouddrove/api-gateway/aws/0.14.0"
environment = "test"
label_order = ["environment", "name", "application"]
label_order = ["name", "environment"]
enabled = true

# Api Gateway Resource
Expand Down Expand Up @@ -56,4 +57,4 @@ EOF
# Api Gateway Stage
stage_enabled = true
stage_names = ["qa"]
}
}
2 changes: 1 addition & 1 deletion _example/basic/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
output "arn" {
value = module.api-gateway.*.execution_arn
description = "The Execution ARN of the REST API."
}
}
5 changes: 2 additions & 3 deletions _example/complete/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ module "api-gateway" {
source = "../../"

name = "api-gateway"
application = "clouddrove"
environment = "test"
label_order = ["environment", "name", "application"]
label_order = ["name", "environment"]
enabled = true

# Api Gateway Resource
Expand Down Expand Up @@ -84,4 +83,4 @@ EOF
# Api Gateway Api Key
key_count = 2
key_names = ["test", "test1"]
}
}
2 changes: 1 addition & 1 deletion _example/complete/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
output "arn" {
value = module.api-gateway.*.execution_arn
description = "The Execution ARN of the REST API."
}
}
2 changes: 1 addition & 1 deletion _test/basic/api_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ func Test(t *testing.T) {

// Verify we're getting back the outputs we expect
assert.Contains(t, Arn, "arn:aws:execute-api")
}
}
8 changes: 0 additions & 8 deletions _test/basic/go.mod

This file was deleted.

2 changes: 1 addition & 1 deletion _test/complete/api_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ func Test(t *testing.T) {

// Verify we're getting back the outputs we expect
assert.Contains(t, Arn, "arn:aws:execute-api")
}
}
5 changes: 3 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
# 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.13.0"
source = "git::https://github.com/clouddrove/terraform-labels.git?ref=tags/0.14.0"

name = var.name
application = var.application
repository = var.repository
environment = var.environment
managedby = var.managedby
attributes = var.attributes
label_order = var.label_order
}

Expand Down
4 changes: 2 additions & 2 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Module : Api Gateway
# Description : Terraform module to create Api Gateway resource on AWS.
# Description : Terraform Api Gateway module outputs.
output "id" {
value = join("", aws_api_gateway_rest_api.default.*.id)
description = "The ID of the REST API."
Expand All @@ -13,4 +13,4 @@ output "execution_arn" {
output "tags" {
value = module.labels.tags
description = "A mapping of tags to assign to the resource."
}
}
Loading

0 comments on commit 43c6b87

Please sign in to comment.