Skip to content

Commit

Permalink
Merge pull request #1 from terraform-do-modules/0.15
Browse files Browse the repository at this point in the history
upgrade in 0.15
  • Loading branch information
anmolnagpal authored Aug 6, 2021
2 parents ed07810 + a20484a commit f57fb00
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 49 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,37 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@master
uses: actions/checkout@v2.3.4

- name: Set up Python 3.7.
- 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@v9.0'
with:
actions_subcommand: 'readme'
github_token: '${{ secrets.GITHUB}}'
github_token: '${{ secrets.GITHUB }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
GITHUB_TOKEN: ${{ secrets.CLOUDDROVE_GITHUB_TOKEN }}


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

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

- name: 'push readme'
uses: 'clouddrove/github-actions@v4.0'
uses: 'clouddrove/github-actions@v9.0'
continue-on-error: true
with:
actions_subcommand: 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: 'Slack Notification'
uses: clouddrove/action-slack@v2
Expand All @@ -51,4 +51,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
if: always()
if: always()
6 changes: 3 additions & 3 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ jobs:
uses: actions/checkout@master

- name: 'Terraform Format'
uses: 'clouddrove/github-actions@v4.0'
uses: 'clouddrove/github-actions@v9.0.1'
with:
actions_subcommand: 'fmt'

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

- name: 'Terraform validate'
uses: 'clouddrove/github-actions@v4.0'
uses: 'clouddrove/github-actions@v9.0.1'
with:
actions_subcommand: 'validate'
tf_actions_working_dir: ./_example
Expand Down
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: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DO_TOKEN }}

- name: 'Terratest'
if: ${{ github.event.label.name == 'terratest' }}
uses: 'clouddrove/github-actions@v9.0.1'
with:
actions_subcommand: 'terratest'
tf_actions_working_dir: '_test'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DO_TOKEN: ${{ secrets.DO_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()
20 changes: 14 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
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
- id: tflint

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
- 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
- id: trailing-whitespace
7 changes: 3 additions & 4 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ github_repo: clouddrove/terraform-digitalocean-firewall
# Badges to display
badges:
- name: "Terraform"
image: "https://img.shields.io/badge/Terraform-v0.13-green"
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"
Expand All @@ -37,11 +37,10 @@ usage : |-
```hcl
module "firewall" {
source = "clouddrove/firewall/digitalocean"
version = "0.13.0"
version = "0.15.0"
name = "firewall"
application = "clouddrove"
environment = "test"
label_order = ["environment", "application", "name"]
label_order = ["environment", "name"]
enable_firewall = true
allowed_ip = ["0.0.0.0/0"]
allowed_ports = [22, 80]
Expand Down
23 changes: 11 additions & 12 deletions _example/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@ provider "digitalocean" {
}

module "vpc" {
source = "clouddrove/vpc/digitalocean"
version = "0.13.0"
source = "git::https://github.com/terraform-do-modules/terraform-digitalocean-vpc.git?ref=0.15"
#version = "0.15.0"
name = "vpc"
application = "clouddrove"
environment = "test"
label_order = ["environment", "application", "name"]
label_order = ["environment", "name"]
enable_vpc = true
region = "bangalore-1"
ip_range = "10.0.0.0/16"

}


module "ssh_key" {
source = "clouddrove/ssh-key/digitalocean"
version = "0.13.0"
source = "git::https://github.com/terraform-do-modules/terraform-digitalocean-ssh-key.git?ref=0.15"
#version = "0.15.0"
key_path = "~/.ssh/id_rsa.pub"
key_name = "devops"
enable_ssh_key = true
}


module "droplet" {
source = "clouddrove/droplet/digitalocean"
version = "0.13.0"
source = "git::https://github.com/terraform-do-modules/terraform-digitalocean-droplet.git?ref=0.15"
#version = "0.15.0"
name = "droplet"
application = "clouddrove"
environment = "test"
label_order = ["environment", "application", "name"]
label_order = ["environment", "name"]
droplet_count = 2
region = "bangalore-1"
ssh_keys = [module.ssh_key.fingerprint]
Expand All @@ -49,9 +49,8 @@ module "droplet" {
module "firewall" {
source = "./../"
name = "firewall"
application = "clouddrove"
environment = "test"
label_order = ["environment", "application", "name"]
label_order = ["environment", "name"]
enable_firewall = true
allowed_ip = ["0.0.0.0/0"]
allowed_ports = [22, 80]
Expand Down
7 changes: 2 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
# tags for resources. You can use terraform-labels to implement a strict
# naming convention.
module "labels" {
source = "clouddrove/labels/digitalocean"
version = "0.13.0"
source = "git::https://github.com/terraform-do-modules/terraform-digitalocean-labels.git?ref=0.15"
#version = "0.15.0"
name = var.name
application = var.application
environment = var.environment
label_order = var.label_order
}
Expand Down Expand Up @@ -52,9 +51,7 @@ resource "digitalocean_firewall" "default" {

tags = [
module.labels.name,
module.labels.application,
module.labels.environment,
module.labels.createdby,
module.labels.managedby
]
}
13 changes: 4 additions & 9 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ variable "name" {
description = "Name (e.g. `app` or `cluster`)."
}

variable "application" {
type = string
default = ""
description = "Application (e.g. `cd` or `clouddrove`)."
}

variable "environment" {
type = string
Expand All @@ -19,7 +14,7 @@ variable "environment" {
}

variable "label_order" {
type = list
type = list(any)
default = []
description = "Label order, e.g. `name`,`application`."
}
Expand All @@ -37,13 +32,13 @@ variable "enable_firewall" {
}

variable "allowed_ip" {
type = list
type = list(any)
default = []
description = "List of allowed ip."
}

variable "allowed_ports" {
type = list
type = list(any)
default = []
description = "List of allowed ingress ports."
}
Expand All @@ -55,7 +50,7 @@ variable "protocol" {
}

variable "droplet_ids" {
type = list
type = list(any)
default = []
description = "The ID of the VPC that the instance security group belongs to."
}

0 comments on commit f57fb00

Please sign in to comment.