Skip to content

Commit

Permalink
Merge pull request #4 from geekcell/feat/tests
Browse files Browse the repository at this point in the history
feat: add tests
  • Loading branch information
janvt committed May 16, 2023
2 parents 5d80f52 + 1870749 commit 6494fdf
Show file tree
Hide file tree
Showing 8 changed files with 1,236 additions and 2 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Test

on:
pull_request:
workflow_dispatch:
push:
branches: [ main ]

permissions:
id-token: write
contents: read

concurrency:
group: ${{ github.repository }}
cancel-in-progress: false

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

#############################
# Configure AWS credentials #
#############################
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::${{ vars.AWS_TESTING_ACCOUNT_ID }}:role/${{ vars.AWS_TESTING_ROLE }}
aws-region: ${{ vars.AWS_TESTING_REGION }}
mask-aws-account-id: false

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'

- name: Run Tests
working-directory: test
run: go test -v -timeout 30m
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,23 @@ preconfigured solution for high availability and scalability.
# Examples
### Basic Example
```hcl
module "vpc" {
source = "registry.terraform.io/terraform-aws-modules/vpc/aws"
version = "~> 3.19"
name = "main"
cidr = "10.100.0.0/16"
azs = ["eu-central-1a", "eu-central-1b"]
public_subnets = ["10.100.10.0/24", "10.100.11.0/24"]
}
module "basic-example" {
source = "../../"
name = "my-lb"
subnets = ["subnet-123", "subnet-456", "subnet-789"]
subnets = module.vpc.public_subnets
enable_security_group_default_http_https_rule = true
}
```
<!-- END_TF_DOCS -->
14 changes: 13 additions & 1 deletion examples/basic-example/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
module "vpc" {
source = "registry.terraform.io/terraform-aws-modules/vpc/aws"
version = "~> 3.19"

name = "main"
cidr = "10.100.0.0/16"
azs = ["eu-central-1a", "eu-central-1b"]
public_subnets = ["10.100.10.0/24", "10.100.11.0/24"]
}

module "basic-example" {
source = "../../"

name = "my-lb"
subnets = ["subnet-123", "subnet-456", "subnet-789"]
subnets = module.vpc.public_subnets

enable_security_group_default_http_https_rule = true
}
14 changes: 14 additions & 0 deletions examples/basic-example/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
output "arn" {
description = "ARN of the Application Load Balancer"
value = module.basic-example.arn
}

output "arn_suffix" {
description = "The ARN suffix for use with CloudWatch Metrics."
value = module.basic-example.arn_suffix
}

output "dns_name" {
description = "The DNS name of the load balancer."
value = module.basic-example.dns_name
}
67 changes: 67 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
module github.com/geekcell/terraform-aws-application-load-balancer

go 1.19

require (
github.com/aws/aws-sdk-go v1.44.122
github.com/gruntwork-io/terratest v0.41.19
github.com/stretchr/testify v1.8.2
)

require (
cloud.google.com/go v0.105.0 // indirect
cloud.google.com/go/compute v1.12.1 // indirect
cloud.google.com/go/compute/metadata v0.2.1 // indirect
cloud.google.com/go/iam v0.7.0 // indirect
cloud.google.com/go/storage v1.27.0 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-errors/errors v1.0.2-0.20180813162953-d98b870cc4e0 // indirect
github.com/go-sql-driver/mysql v1.4.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/gruntwork-io/go-commons v0.8.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-getter v1.7.1 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/hcl/v2 v2.9.1 // indirect
github.com/hashicorp/terraform-json v0.13.0 // indirect
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/klauspost/compress v1.15.11 // indirect
github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pquerna/otp v1.2.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/tmccombs/hcl2json v0.3.3 // indirect
github.com/ulikunitz/xz v0.5.10 // indirect
github.com/urfave/cli v1.22.2 // indirect
github.com/zclconf/go-cty v1.9.1 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/oauth2 v0.1.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.103.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20221201164419-0e50fba7f41c // indirect
google.golang.org/grpc v1.51.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 6494fdf

Please sign in to comment.