Skip to content

Commit f57fb00

Browse files
authored
Merge pull request #1 from terraform-do-modules/0.15
upgrade in 0.15
2 parents ed07810 + a20484a commit f57fb00

File tree

8 files changed

+89
-49
lines changed

8 files changed

+89
-49
lines changed

.github/workflows/readme.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,37 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: 'Checkout'
13-
uses: actions/checkout@master
13+
uses: actions/checkout@v2.3.4
1414

15-
- name: Set up Python 3.7.
15+
- name: 'Set up Python 3.7'
1616
uses: actions/setup-python@v2
1717
with:
1818
python-version: '3.x'
1919

2020
- name: 'create readme'
21-
uses: 'clouddrove/github-actions@v4.0'
21+
uses: 'clouddrove/github-actions@v9.0'
2222
with:
2323
actions_subcommand: 'readme'
24-
github_token: '${{ secrets.GITHUB}}'
24+
github_token: '${{ secrets.GITHUB }}'
2525
env:
26-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
26+
GITHUB_TOKEN: ${{ secrets.CLOUDDROVE_GITHUB_TOKEN }}
2727

2828

29-
- name: pre-commit check errors
29+
- name: 'pre-commit check errors'
3030
uses: pre-commit/action@v2.0.0
3131
continue-on-error: true
3232

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

3737
- name: 'push readme'
38-
uses: 'clouddrove/github-actions@v4.0'
38+
uses: 'clouddrove/github-actions@v9.0'
3939
continue-on-error: true
4040
with:
4141
actions_subcommand: 'push'
4242
env:
43-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4444

4545
- name: 'Slack Notification'
4646
uses: clouddrove/action-slack@v2
@@ -51,4 +51,4 @@ jobs:
5151
env:
5252
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
5353
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
54-
if: always()
54+
if: always()

.github/workflows/terraform.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ jobs:
1313
uses: actions/checkout@master
1414

1515
- name: 'Terraform Format'
16-
uses: 'clouddrove/github-actions@v4.0'
16+
uses: 'clouddrove/github-actions@v9.0.1'
1717
with:
1818
actions_subcommand: 'fmt'
1919

2020
- name: 'Terraform init'
21-
uses: 'clouddrove/github-actions@v4.0'
21+
uses: 'clouddrove/github-actions@v9.0.1'
2222
with:
2323
actions_subcommand: 'init'
2424
tf_actions_working_dir: ./_example
2525

2626
- name: 'Terraform validate'
27-
uses: 'clouddrove/github-actions@v4.0'
27+
uses: 'clouddrove/github-actions@v9.0.1'
2828
with:
2929
actions_subcommand: 'validate'
3030
tf_actions_working_dir: ./_example

.github/workflows/terratest.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: 'Terratest GitHub Actions'
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
types: [labeled]
7+
8+
jobs:
9+
terraform:
10+
name: 'Terraform'
11+
runs-on: ubuntu-latest
12+
steps:
13+
14+
- name: 'Checkout'
15+
uses: actions/checkout@master
16+
17+
- name: Install doctl
18+
uses: digitalocean/action-doctl@v2
19+
with:
20+
token: ${{ secrets.DO_TOKEN }}
21+
22+
- name: 'Terratest'
23+
if: ${{ github.event.label.name == 'terratest' }}
24+
uses: 'clouddrove/github-actions@v9.0.1'
25+
with:
26+
actions_subcommand: 'terratest'
27+
tf_actions_working_dir: '_test'
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
DO_TOKEN: ${{ secrets.DO_TOKEN }}
31+
32+
33+
- name: 'Slack Notification'
34+
uses: clouddrove/action-slack@v2
35+
with:
36+
status: ${{ job.status }}
37+
fields: repo,author
38+
author_name: 'CloudDrove'
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
41+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
42+
if: always()

.pre-commit-config.yaml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
repos:
2-
- repo: git://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.43.0
2+
3+
- repo: https://github.com/gruntwork-io/pre-commit
4+
rev: v0.1.12 # Get the latest from: https://github.com/gruntwork-io/pre-commit/releases
45
hooks:
5-
- id: terraform_fmt
6+
- id: terraform-fmt
7+
- id: shellcheck
8+
- id: tflint
69

7-
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v3.2.0
10+
- repo: git://github.com/pre-commit/pre-commit-hooks
11+
rev: v4.0.1 # Use the ref you want to point at
912
hooks:
13+
- id: end-of-file-fixer
14+
- id: trailing-whitespace
15+
- id: mixed-line-ending
16+
- id: check-byte-order-marker
17+
- id: check-executables-have-shebangs
1018
- id: check-merge-conflict
19+
- id: debug-statements
1120
- id: check-yaml
1221
- id: check-added-large-files
13-
- id: trailing-whitespace

README.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ github_repo: clouddrove/terraform-digitalocean-firewall
1616
# Badges to display
1717
badges:
1818
- name: "Terraform"
19-
image: "https://img.shields.io/badge/Terraform-v0.13-green"
19+
image: "https://img.shields.io/badge/Terraform-v0.15-green"
2020
url: "https://www.terraform.io"
2121
- name: "Licence"
2222
image: "https://img.shields.io/badge/License-MIT-blue.svg"
@@ -37,11 +37,10 @@ usage : |-
3737
```hcl
3838
module "firewall" {
3939
source = "clouddrove/firewall/digitalocean"
40-
version = "0.13.0"
40+
version = "0.15.0"
4141
name = "firewall"
42-
application = "clouddrove"
4342
environment = "test"
44-
label_order = ["environment", "application", "name"]
43+
label_order = ["environment", "name"]
4544
enable_firewall = true
4645
allowed_ip = ["0.0.0.0/0"]
4746
allowed_ports = [22, 80]

_example/example.tf

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,33 @@ provider "digitalocean" {
66
}
77

88
module "vpc" {
9-
source = "clouddrove/vpc/digitalocean"
10-
version = "0.13.0"
9+
source = "git::https://github.com/terraform-do-modules/terraform-digitalocean-vpc.git?ref=0.15"
10+
#version = "0.15.0"
1111
name = "vpc"
12-
application = "clouddrove"
1312
environment = "test"
14-
label_order = ["environment", "application", "name"]
13+
label_order = ["environment", "name"]
1514
enable_vpc = true
1615
region = "bangalore-1"
16+
ip_range = "10.0.0.0/16"
17+
1718
}
1819

1920

2021
module "ssh_key" {
21-
source = "clouddrove/ssh-key/digitalocean"
22-
version = "0.13.0"
22+
source = "git::https://github.com/terraform-do-modules/terraform-digitalocean-ssh-key.git?ref=0.15"
23+
#version = "0.15.0"
2324
key_path = "~/.ssh/id_rsa.pub"
2425
key_name = "devops"
2526
enable_ssh_key = true
2627
}
2728

2829

2930
module "droplet" {
30-
source = "clouddrove/droplet/digitalocean"
31-
version = "0.13.0"
31+
source = "git::https://github.com/terraform-do-modules/terraform-digitalocean-droplet.git?ref=0.15"
32+
#version = "0.15.0"
3233
name = "droplet"
33-
application = "clouddrove"
3434
environment = "test"
35-
label_order = ["environment", "application", "name"]
35+
label_order = ["environment", "name"]
3636
droplet_count = 2
3737
region = "bangalore-1"
3838
ssh_keys = [module.ssh_key.fingerprint]
@@ -49,9 +49,8 @@ module "droplet" {
4949
module "firewall" {
5050
source = "./../"
5151
name = "firewall"
52-
application = "clouddrove"
5352
environment = "test"
54-
label_order = ["environment", "application", "name"]
53+
label_order = ["environment", "name"]
5554
enable_firewall = true
5655
allowed_ip = ["0.0.0.0/0"]
5756
allowed_ports = [22, 80]

main.tf

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
# tags for resources. You can use terraform-labels to implement a strict
99
# naming convention.
1010
module "labels" {
11-
source = "clouddrove/labels/digitalocean"
12-
version = "0.13.0"
11+
source = "git::https://github.com/terraform-do-modules/terraform-digitalocean-labels.git?ref=0.15"
12+
#version = "0.15.0"
1313
name = var.name
14-
application = var.application
1514
environment = var.environment
1615
label_order = var.label_order
1716
}
@@ -52,9 +51,7 @@ resource "digitalocean_firewall" "default" {
5251

5352
tags = [
5453
module.labels.name,
55-
module.labels.application,
5654
module.labels.environment,
57-
module.labels.createdby,
5855
module.labels.managedby
5956
]
6057
}

variables.tf

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ variable "name" {
66
description = "Name (e.g. `app` or `cluster`)."
77
}
88

9-
variable "application" {
10-
type = string
11-
default = ""
12-
description = "Application (e.g. `cd` or `clouddrove`)."
13-
}
149

1510
variable "environment" {
1611
type = string
@@ -19,7 +14,7 @@ variable "environment" {
1914
}
2015

2116
variable "label_order" {
22-
type = list
17+
type = list(any)
2318
default = []
2419
description = "Label order, e.g. `name`,`application`."
2520
}
@@ -37,13 +32,13 @@ variable "enable_firewall" {
3732
}
3833

3934
variable "allowed_ip" {
40-
type = list
35+
type = list(any)
4136
default = []
4237
description = "List of allowed ip."
4338
}
4439

4540
variable "allowed_ports" {
46-
type = list
41+
type = list(any)
4742
default = []
4843
description = "List of allowed ingress ports."
4944
}
@@ -55,7 +50,7 @@ variable "protocol" {
5550
}
5651

5752
variable "droplet_ids" {
58-
type = list
53+
type = list(any)
5954
default = []
6055
description = "The ID of the VPC that the instance security group belongs to."
6156
}

0 commit comments

Comments
 (0)