generated from geekcell/terraform-aws-module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
162 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
############### | ||
## Run tests ## | ||
############### | ||
|
||
# | ||
# Documentation: | ||
# https://help.github.com/en/articles/workflow-syntax-for-github-actions | ||
# | ||
|
||
name: Test | ||
on: | ||
pull_request: | ||
push: | ||
branches: [ main ] | ||
|
||
########################## | ||
# Prevent duplicate jobs # | ||
########################## | ||
concurrency: | ||
group: ${{ github.repository }} | ||
cancel-in-progress: false | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
############### | ||
# Run the job # | ||
############### | ||
jobs: | ||
terraform-test: | ||
name: Terraform Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
############################ | ||
# Checkout the source code # | ||
############################ | ||
- 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 | ||
|
||
############# | ||
# Run tests # | ||
############# | ||
- name: Run Tests | ||
timeout-minutes: 30 | ||
run: terraform init && terraform test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
run "setup" { | ||
module { | ||
source = "./tests/network" | ||
} | ||
} | ||
|
||
run "basic_efs" { | ||
variables { | ||
name = "basic-efs-test" | ||
|
||
private_subnets = run.setup.subnet_ids | ||
security_groups = [run.setup.security_group_id] | ||
|
||
throughput_mode = "elastic" | ||
transition_to_ia = "AFTER_7_DAYS" | ||
transition_to_archive = "AFTER_14_DAYS" | ||
|
||
access_points = { | ||
for dir in ["private", "public"] : dir => { | ||
posix_user = { | ||
gid = 1000 | ||
uid = 1000 | ||
} | ||
|
||
root_directory = { | ||
path = "/${dir}" | ||
|
||
creation_info = { | ||
owner_gid = 1000 | ||
owner_uid = 1000 | ||
permissions = "0755" | ||
} | ||
} | ||
} | ||
} | ||
|
||
tags = { | ||
SomeTag = "foo" | ||
AnotherTag = "bar" | ||
} | ||
} | ||
|
||
assert { | ||
condition = length(output.arn) >= 0 | ||
error_message = "Expected EFS to be created." | ||
} | ||
|
||
assert { | ||
condition = length(output.access_point_ids) == 2 | ||
error_message = "Expected EFS to have 2 access points." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
data "aws_availability_zones" "available" {} | ||
|
||
resource "aws_default_vpc" "default" {} | ||
|
||
resource "aws_default_security_group" "default" { | ||
vpc_id = aws_default_vpc.default.id | ||
} | ||
|
||
data "aws_subnet" "default" { | ||
availability_zone = data.aws_availability_zones.available.names[0] | ||
default_for_az = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
output "vpc_id" { | ||
value = aws_default_vpc.default.id | ||
} | ||
|
||
output "security_group_id" { | ||
value = aws_default_security_group.default.id | ||
} | ||
|
||
output "subnet_ids" { | ||
value = [data.aws_subnet.default.id] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
terraform { | ||
required_version = ">= 1.6" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 5.35" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters