Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
rickardl authored Jul 15, 2020
2 parents 0a1a4b6 + bae982d commit de3edb7
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 37 deletions.
File renamed without changes.
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: 🐛 Bug Report
about: Is something not working as expected?
labels: bug
---

### Bug report

> What is the problem?
### Steps to reproduce

> Please post the relevant parts of the failing terraform code here (remember to remove sensitive information):
```hcl
module "template" {
name_prefix = "template-basic-example"
}
```

### Terraform version

> Run `terraform version` and post the output here:
```bash
$ terraform version

Terraform v0.12.7
+ provider.aws v2.27.0
```

8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: 🚀 Feature Request
about: I have a suggestion!
---

### Feature request

> How can we improve the module?
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: workflow

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v1
with: { go-version: 1.14 }

- name: Install Terraform
run: |
curl -sL https://releases.hashicorp.com/terraform/0.12.21/terraform_0.12.21_linux_amd64.zip -o terraform.zip
sudo unzip terraform.zip -d /usr/bin && rm -f terraform.zip
- name: Install Taskfile
run: curl -sL https://taskfile.dev/install.sh | sh

- name: Run tests
run: ./bin/task test
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
**/*.tfstate*
crash.log

#InteliJ IDE
# IntelliJ IDE
.idea/

#Mac files
.DS_Store
# Taskfile
.task/
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## VPC

[![Build Status](https://travis-ci.com/telia-oss/terraform-aws-vpc.svg?branch=master)](https://travis-ci.com/telia-oss/terraform-aws-vpc)
[![workflow](https://github.com/telia-oss/terraform-aws-vpc/workflows/workflow/badge.svg)](https://github.com/telia-oss/terraform-aws-vpc/actions)

This is a module which simplifies setting up a new VPC and getting it into a useful state:

Expand Down
28 changes: 21 additions & 7 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
version: '2'

env:
AWS_DEFAULT_REGION: eu-west-1
TERM: screen-256color
GO111MODULE: on
AWS_DEFAULT_REGION: eu-west-1

tasks:
default:
cmds:
- task: test

test:
desc: Run tests.
cmds:
- task: test-go
- task: test-terraform

test-go:
desc: Run tests for all Go code.
silent: true
cmds:
- gofmt -s -l -w .
- go vet -v ./...

test-terraform:
desc: Run tests for all terraform directories.
silent: true
env:
DIRECTORIES:
sh: find . -type f -name '*.tf' -not -path "**/.terraform/*" -exec dirname {} \; | sort -u
sh: find . -type f -name '*.tf' -not -path "**/.terraform/*" -print0 | xargs -0I {} dirname {} | sort -u
cmds:
- |
BOLD=$(tput bold)
Expand All @@ -24,22 +38,22 @@ tasks:
for d in $DIRECTORIES; do
cd $d
echo "${BOLD} $PWD:${NORM}"
echo "${BOLD}$PWD:${NORM}"
if ! terraform fmt -check=true -write=true -list=false -recursive=false; then
echo " ✗ terraform fmt" && exit $?
if ! terraform fmt -check=true -list=false -recursive=false; then
echo " ✗ terraform fmt" && exit 1
else
echo " √ terraform fmt"
fi
if ! terraform init -backend=false -input=false -get=true -get-plugins=true -no-color > /dev/null; then
echo " ✗ terraform init" && exit $?
echo " ✗ terraform init" && exit 1
else
echo " √ terraform init"
fi
if ! terraform validate > /dev/null; then
echo " ✗ terraform validate" && exit $?
echo " ✗ terraform validate" && exit 1
else
echo " √ terraform validate"
fi
Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ resource "aws_subnet" "public" {
var.tags,
{
"Name" = "${var.name_prefix}-public-subnet-${count.index + 1}"
"type" = "public"
"Tier" = "Public"
},
)
}
Expand Down Expand Up @@ -179,7 +179,7 @@ resource "aws_subnet" "private" {
var.tags,
{
"Name" = "${var.name_prefix}-private-subnet-${count.index + 1}"
"type" = "private"
"Tier" = "Private"
},
)
}
Expand Down
18 changes: 14 additions & 4 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ output "vpc_id" {
value = aws_vpc.main.id
}

output "cidr_block" {
description = "The cidr_block of the VPC."
value = aws_vpc.main.cidr_block
}

output "public_subnet_ids" {
description = "The ID of the public subnets."
value = aws_subnet.public[*].id
Expand All @@ -16,6 +21,11 @@ output "private_subnet_ids" {
value = aws_subnet.private[*].id
}

output "main_route_table_id" {
description = "The ID of the main route table."
value = aws_vpc.main.main_route_table_id
}

output "public_subnets_route_table_id" {
description = "The ID of the routing table for the public subnets."
value = concat(aws_route_table.public[*].id, [""])[0]
Expand All @@ -26,9 +36,9 @@ output "private_subnets_route_table_ids" {
value = aws_route_table.private[*].id
}

output "main_route_table_id" {
description = "The ID of the main route table."
value = aws_vpc.main.main_route_table_id
output "nat_gateway_ids" {
description = "The IDs of the NAT Gateways."
value = aws_nat_gateway.private[*].id
}

output "cidr_block" {
Expand All @@ -39,4 +49,4 @@ output "cidr_block" {
output "default_security_group_id" {
description = "The id of the VPC default security group"
value = aws_vpc.main.default_security_group_id
}
}

0 comments on commit de3edb7

Please sign in to comment.