Skip to content

Commit

Permalink
Merge pull request #6 from clouddrove/CD-209
Browse files Browse the repository at this point in the history
Upgrade Terraform version to 0.13
  • Loading branch information
Nikita Dugar authored Oct 20, 2020
2 parents 2bda692 + 7c36ab3 commit c6e53d7
Show file tree
Hide file tree
Showing 9 changed files with 146 additions and 30 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/[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'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
if: always()
41 changes: 23 additions & 18 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,54 @@
name: 'Terraform GitHub Actions'
on:
- pull_request
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@v2.0
uses: 'clouddrove/github-actions@v4.0'
with:
actions_subcommand: 'fmt'

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

- name: Configure AWS Credentials
uses: clouddrove/configure-aws-credentials@v1
- name: 'Terraform validate'
uses: 'clouddrove/[email protected]'
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
actions_subcommand: 'validate'
tf_actions_working_dir: ./_example

- name: 'Terratest'
uses: clouddrove/github-actions@v2.0
- name: 'Terraform plan'
uses: 'clouddrove/github-actions@v4.0'
with:
actions_subcommand: 'terratest'
tf_actions_working_dir: ./_test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
actions_subcommand: 'plan'
tf_actions_working_dir: ./_example

- name: 'Slack Notification'
uses: clouddrove/action-slack@v2
with:
status: ${{ job.status }}
fields: repo,author
author_name: 'Clouddrove'
author_name: 'CloudDrove'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
if: always()
42 changes: 42 additions & 0 deletions .github/workflows/terratest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 'Terratest GitHub Actions'
on:
pull_request:
branches:
- master
types: [labeled]

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: 'Terratest'
if: ${{ github.event.label.name == 'terratest' }}
uses: 'clouddrove/[email protected]'
with:
actions_subcommand: 'terratest'
tf_actions_working_dir: '_test'
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()
6 changes: 3 additions & 3 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: 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
12 changes: 7 additions & 5 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

# Name of this project
name : Terraform AWS IAM Role
name: Terraform AWS IAM Role

# License of this project
license: "MIT"
Expand All @@ -16,7 +16,7 @@ github_repo: clouddrove/terraform-aws-iam-role
# Badges to display
badges:
- name: "Terraform"
image: "https://img.shields.io/badge/Terraform-v0.12-green"
image: "https://img.shields.io/badge/Terraform-v0.13-green"
url: "https://www.terraform.io"
- name: "Licence"
image: "https://img.shields.io/badge/License-MIT-blue.svg"
Expand All @@ -32,12 +32,14 @@ include:
- "terraform.md"

# How to use this project
usage : |-
# yamllint disable rule:line-length
usage: |-
### Simple example
Here is an example of how you can use this module in your inventory structure:
```hcl
module "iam-role" {
source = "git::https://github.com/clouddrove/terraform-aws-iam-role.git?ref=tags/0.12.3"
source = "clouddrove/iam-role/aws"
version = "0.13.0"
name = "iam-role"
application = "clouddrove"
Expand Down Expand Up @@ -72,4 +74,4 @@ usage : |-
resources = ["*"]
}
}
```
```
8 changes: 8 additions & 0 deletions _test/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module github.com/clouddrove/terraform-aws-iam-role

go 1.13

require (
github.com/gruntwork-io/terratest v0.30.7
github.com/stretchr/testify v1.6.1
)
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# 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"

enabled = var.enabled
name = var.name
Expand Down Expand Up @@ -43,7 +43,7 @@ resource "aws_iam_role_policy" "default" {
# Description : Terraform module to create IAm role policy resource on AWS to attach with Iam Role.
resource "aws_iam_role_policy_attachment" "default" {
count = var.enabled && var.policy_enabled && var.policy_arn != "" ? 1 : 0
role = aws_iam_role.default.*.id[0]
role = aws_iam_role.default.*.id[0]

policy_arn = var.policy_arn
}
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 c6e53d7

Please sign in to comment.