Skip to content

Commit

Permalink
Merge pull request #7 from confusdcodr/test_output
Browse files Browse the repository at this point in the history
Update testing harness
  • Loading branch information
confusdcodr authored Oct 3, 2019
2 parents 71d9805 + 20d8cb2 commit 5de6bd3
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.0.1
current_version = 1.0.2
commit = True
message = Bumps version to {new_version}
tag = False
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

### 1.0.2

**Released**: 2019.10.03

**Commit Delta**: [Change from 1.0.1 release](https://github.com/plus3it/terraform-aws-tardigrade-iam-account/compare/1.0.1...1.0.2)

**Summary**:

* Update testing harness to have a more user-friendly output

### 1.0.1

**Released**: 2019.09.23
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ Terraform module to manage AWS account password policy
| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| account\_alias | Name of the IAM account alias | string | `""` | no |
| allow\_users\_to\_change\_password | Whether to allow users to change their own password | string | `"true"` | no |
| create\_iam\_account | Controls whether to configure the IAM account settings | string | `"true"` | no |
| hard\_expiry | Whether users are prevented from setting a new password after their password has expired (i.e. require administrator reset) | string | `"false"` | no |
| allow\_users\_to\_change\_password | Whether to allow users to change their own password | bool | `"true"` | no |
| create\_iam\_account | Controls whether to configure the IAM account settings | bool | `"true"` | no |
| hard\_expiry | Whether users are prevented from setting a new password after their password has expired (i.e. require administrator reset) | bool | `"false"` | no |
| max\_password\_age | The number of days that an user password is valid | string | `"90"` | no |
| minimum\_password\_length | Minimum length to require for user passwords | string | `"14"` | no |
| password\_reuse\_prevention | The number of previous passwords that users are prevented from reusing | string | `"24"` | no |
| require\_lowercase\_characters | Whether to require lowercase characters for user passwords | string | `"true"` | no |
| require\_numbers | Whether to require numbers for user passwords | string | `"true"` | no |
| require\_symbols | Whether to require symbols for user passwords | string | `"true"` | no |
| require\_uppercase\_characters | Whether to require uppercase characters for user passwords | string | `"true"` | no |
| require\_lowercase\_characters | Whether to require lowercase characters for user passwords | bool | `"true"` | no |
| require\_numbers | Whether to require numbers for user passwords | bool | `"true"` | no |
| require\_symbols | Whether to require symbols for user passwords | bool | `"true"` | no |
| require\_uppercase\_characters | Whether to require uppercase characters for user passwords | bool | `"true"` | no |

30 changes: 14 additions & 16 deletions tests/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,24 @@ func TestModule(t *testing.T) {
for _, f := range files {
// look for directories with test cases in it
if f.IsDir() && f.Name() != "vendor" {
investigateDirectory(t, f)
t.Run(f.Name(), func(t *testing.T) {
// check if a prereq directory exists
prereqDir := f.Name() + "/prereq/"
if _, err := os.Stat(prereqDir); err == nil {
prereqOptions := createTerraformOptions(prereqDir)
defer terraform.Destroy(t, prereqOptions)
terraform.InitAndApply(t, prereqOptions)
}

// run terraform code for test case
terraformOptions := createTerraformOptions(f.Name())
defer terraform.Destroy(t, terraformOptions)
terraform.InitAndApply(t, terraformOptions)
})
}
}
}

func investigateDirectory(t *testing.T, directory os.FileInfo) {
// check if a prereq directory exists
prereqDir := directory.Name() + "/prereq/"
if _, err := os.Stat(prereqDir); err == nil {
prereqOptions := createTerraformOptions(prereqDir)
defer terraform.Destroy(t, prereqOptions)
terraform.InitAndApply(t, prereqOptions)
}

// run terraform code for test case
terraformOptions := createTerraformOptions(directory.Name())
defer terraform.Destroy(t, terraformOptions)
terraform.InitAndApply(t, terraformOptions)
}

func createTerraformOptions(directory string) *terraform.Options {
terraformOptions := &terraform.Options{
TerraformDir: directory,
Expand Down
25 changes: 13 additions & 12 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
variable "create_iam_account" {
description = "Controls whether to configure the IAM account settings"
type = bool
default = true
}

Expand All @@ -11,14 +12,14 @@ variable "account_alias" {

variable "allow_users_to_change_password" {
description = "Whether to allow users to change their own password"
type = string
default = "true"
type = bool
default = true
}

variable "hard_expiry" {
description = "Whether users are prevented from setting a new password after their password has expired (i.e. require administrator reset)"
type = string
default = "false"
type = bool
default = false
}

variable "minimum_password_length" {
Expand All @@ -41,25 +42,25 @@ variable "password_reuse_prevention" {

variable "require_lowercase_characters" {
description = "Whether to require lowercase characters for user passwords"
type = string
default = "true"
type = bool
default = true
}

variable "require_uppercase_characters" {
description = "Whether to require uppercase characters for user passwords"
type = string
default = "true"
type = bool
default = true
}

variable "require_numbers" {
description = "Whether to require numbers for user passwords"
type = string
default = "true"
type = bool
default = true
}

variable "require_symbols" {
description = "Whether to require symbols for user passwords"
type = string
default = "true"
type = bool
default = true
}

0 comments on commit 5de6bd3

Please sign in to comment.