Skip to content

Commit

Permalink
Merge pull request #9 from clouddrove/0.15
Browse files Browse the repository at this point in the history
fix terratest
  • Loading branch information
Om Sharma committed Jul 6, 2021
2 parents 6a4b316 + d4d8309 commit a69e5c0
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 31 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ 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'
Expand All @@ -26,11 +26,11 @@ jobs:
GITHUB_TOKEN: ${{ secrets.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

Expand Down
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.45.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.4.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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<p align="center"> <img src="https://user-images.githubusercontent.com/50652676/62349836-882fef80-b51e-11e9-99e3-7b974309c7e3.png" width="100" height="100"></p>




<h1 align="center">
Terraform AWS EFS
</h1>
Expand Down
6 changes: 6 additions & 0 deletions _example/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,9 @@ output "efs_network_interface_ids" {
value = module.efs.network_interface_ids
description = "List of mount target network interface IDs"
}

output "tags" {
value = module.efs.tags
description = "The tags of the ecs cluster"

}
2 changes: 1 addition & 1 deletion _example/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ variable "region" {

variable "repository" {
type = string
default = "https://registry.terraform.io/modules/clouddrove/subnet/aws/0.14.0"
default = "https://github.com/clouddrove/terraform-aws-efs"
description = "Terraform current module repo"

validation {
Expand Down
22 changes: 10 additions & 12 deletions _test/efs_test.go
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
// Managed By : CloudDrove
// Description : This Terratest is used to test the Terraform EFS module.
// Description : This Terratest is used to test the Terraform EFS modules.
// Copyright @ CloudDrove. All Right Reserved.

package test

import (
"testing"
//"strings"
"github.com/stretchr/testify/assert"
"github.com/gruntwork-io/terratest/modules/terraform"
"github.com/stretchr/testify/assert"
)

func TestEFS(t *testing.T) {
func Test(t *testing.T) {
t.Parallel()

terraformOptions := &terraform.Options{
// Source path of Terraform directory.
TerraformDir: "../_example",
Upgrade: true,
}

// This will run `terraform init` and `terraform apply` and fail the test if there are any errors
// This will run 'terraform init' and 'terraform application' and will fail the test if any errors occur
terraform.InitAndApply(t, terraformOptions)

// At the end of the test, run `terraform destroy` to clean up any resources that were created
// To clean up any resources that have been created, run 'terraform destroy' towards the end of the test
defer terraform.Destroy(t, terraformOptions)

// Run `terraform output` to get the value of an output variable
keyArn := terraform.Output(t, terraformOptions, "efs_arn")
// To get the value of an output variable, run 'terraform output'
Tags := terraform.OutputMap(t, terraformOptions, "tags")

// Check that we get back the outputs that we expect
assert.Equal(t, "efs-test", Tags["Name"])

// Verify we're getting back the outputs we expect
assert.Contains(t, keyArn, "arn:aws:elasticfilesystem")
}
8 changes: 0 additions & 8 deletions _test/go.mod

This file was deleted.

6 changes: 6 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ output "network_interface_ids" {
value = [coalescelist(aws_efs_mount_target.default.*.network_interface_id, [""])]
description = "List of mount target network interface IDs"
}

output "tags" {
value = module.label.tags
description = "The tags of the ecs cluster"

}

0 comments on commit a69e5c0

Please sign in to comment.