From 2470653d34532c7ae8612fbd95a47380df50c9e9 Mon Sep 17 00:00:00 2001 From: confusdcodr Date: Thu, 3 Oct 2019 12:02:20 -0400 Subject: [PATCH 1/2] Update test harness --- CHANGELOG.md | 10 ++++++++++ README.md | 14 +++++++------- tests/module_test.go | 30 ++++++++++++++---------------- variables.tf | 25 +++++++++++++------------ 4 files changed, 44 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f67782d..ff1be26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index f3d5a09..e022b79 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/tests/module_test.go b/tests/module_test.go index 61254e3..f5ad2ef 100644 --- a/tests/module_test.go +++ b/tests/module_test.go @@ -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, diff --git a/variables.tf b/variables.tf index 299dfd1..c59aaee 100644 --- a/variables.tf +++ b/variables.tf @@ -1,5 +1,6 @@ variable "create_iam_account" { description = "Controls whether to configure the IAM account settings" + type = bool default = true } @@ -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" { @@ -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 } From 20d8cb298f2a0314332ff7a4586043f1a6823757 Mon Sep 17 00:00:00 2001 From: confusdcodr Date: Thu, 3 Oct 2019 12:02:24 -0400 Subject: [PATCH 2/2] Bumps version to 1.0.2 --- .bumpversion.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index f1e4ea7..e318d2f 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -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