Skip to content

Commit

Permalink
Update Terraform cloudposse/label/null to v0.25.0 (#3)
Browse files Browse the repository at this point in the history
* Update Terraform cloudposse/label/null to v0.25.0

* Get terratest to pass

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: cloudpossebot <11232728+cloudpossebot@users.noreply.github.com>
Co-authored-by: nitrocode <nitrocode@users.noreply.github.com>
  • Loading branch information
4 people authored Nov 19, 2021
1 parent 5b5b33d commit e045c65
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 72 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ Available targets:

| Name | Source | Version |
|------|--------|---------|
| <a name="module_classification_job_label"></a> [classification\_job\_label](#module\_classification\_job\_label) | cloudposse/label/null | 0.24.1 |
| <a name="module_custom_data_identifier_label"></a> [custom\_data\_identifier\_label](#module\_custom\_data\_identifier\_label) | cloudposse/label/null | 0.24.1 |
| <a name="module_member_label"></a> [member\_label](#module\_member\_label) | cloudposse/label/null | 0.24.1 |
| <a name="module_classification_job_label"></a> [classification\_job\_label](#module\_classification\_job\_label) | cloudposse/label/null | 0.25.0 |
| <a name="module_custom_data_identifier_label"></a> [custom\_data\_identifier\_label](#module\_custom\_data\_identifier\_label) | cloudposse/label/null | 0.25.0 |
| <a name="module_member_label"></a> [member\_label](#module\_member\_label) | cloudposse/label/null | 0.25.0 |
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |

## Resources
Expand Down
2 changes: 1 addition & 1 deletion classification_job.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "classification_job_label" {
source = "cloudposse/label/null"
version = "0.24.1"
version = "0.25.0"

for_each = local.classification_jobs

Expand Down
2 changes: 1 addition & 1 deletion custom_data_identifier.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "custom_data_identifier_label" {
source = "cloudposse/label/null"
version = "0.24.1"
version = "0.25.0"

for_each = local.custom_data_identifiers

Expand Down
6 changes: 3 additions & 3 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

| Name | Source | Version |
|------|--------|---------|
| <a name="module_classification_job_label"></a> [classification\_job\_label](#module\_classification\_job\_label) | cloudposse/label/null | 0.24.1 |
| <a name="module_custom_data_identifier_label"></a> [custom\_data\_identifier\_label](#module\_custom\_data\_identifier\_label) | cloudposse/label/null | 0.24.1 |
| <a name="module_member_label"></a> [member\_label](#module\_member\_label) | cloudposse/label/null | 0.24.1 |
| <a name="module_classification_job_label"></a> [classification\_job\_label](#module\_classification\_job\_label) | cloudposse/label/null | 0.25.0 |
| <a name="module_custom_data_identifier_label"></a> [custom\_data\_identifier\_label](#module\_custom\_data\_identifier\_label) | cloudposse/label/null | 0.25.0 |
| <a name="module_member_label"></a> [member\_label](#module\_member\_label) | cloudposse/label/null | 0.25.0 |
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |

## Resources
Expand Down
7 changes: 5 additions & 2 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ provider "aws" {
region = var.region
}

module "example" {
module "macie" {
source = "../.."

example = var.example
providers = {
aws = aws
aws.admin = aws.admin
}

context = module.this.context
}
28 changes: 19 additions & 9 deletions examples/complete/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
output "id" {
description = "ID of the created example"
value = module.example.id
output "account_id" {
description = "The ID of the Macie account."
value = module.macie.account_id
}

output "example" {
description = "Output \"example\" from example module"
value = module.example.example
output "account_service_role_arn" {
description = "The service role ARN of the Macie account."
value = module.macie.account_service_role_arn
}

output "random" {
description = "Output \"random\" from example module"
value = module.example.random
output "org_admin_account_ids" {
description = "List of IDs of the Macie organization admin accounts."
value = module.macie.org_admin_account_ids
}

output "aws_account_to_org_admin_account_ids" {
description = "Map of the AWS account IDs to Macie organization admin account IDs"
value = module.macie.aws_account_to_org_admin_account_ids
}

output "member_accounts" {
description = "List of AWS account IDs the Macie Admin is managing"
value = module.macie.member_accounts
}
4 changes: 2 additions & 2 deletions examples/complete/variables.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
variable "example" {
variable "region" {
type = string
description = "The value which will be passed to the example module"
description = "AWS Region"
}
13 changes: 9 additions & 4 deletions examples/complete/versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
terraform {
required_version = ">= 0.12.26"
required_version = ">= 0.15.0"

required_providers {
local = {
source = "hashicorp/local"
version = ">= 1.2"
# Update these to reflect the actual requirements of your module
aws = {
source = "hashicorp/aws"
version = ">= 2.0"
configuration_aliases = [
aws.admin,
aws
]
}
}
}
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ resource "aws_macie2_organization_admin_account" "default" {

module "member_label" {
source = "cloudposse/label/null"
version = "0.24.1"
version = "0.25.0"

for_each = local.members

Expand Down
46 changes: 0 additions & 46 deletions test/src/examples_complete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"time"

"github.com/gruntwork-io/terratest/modules/terraform"
"github.com/stretchr/testify/assert"
)

// Test the Terraform module in examples/complete using Terratest.
Expand All @@ -18,8 +17,6 @@ func TestExamplesComplete(t *testing.T) {
randID := strconv.Itoa(rand.Intn(100000))
attributes := []string{randID}

exampleInput := "Hello, world!"

terraformOptions := &terraform.Options{
// The path to where our Terraform code is located
TerraformDir: "../../examples/complete",
Expand All @@ -30,54 +27,11 @@ func TestExamplesComplete(t *testing.T) {
// and AWS resources do not interfere with each other
Vars: map[string]interface{}{
"attributes": attributes,
"example": exampleInput,
},
}
// At the end of the test, run `terraform destroy` to clean up any resources that were created
defer terraform.Destroy(t, terraformOptions)

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

// Run `terraform output` to get the value of an output variable
id := terraform.Output(t, terraformOptions, "id")
example := terraform.Output(t, terraformOptions, "example")
random := terraform.Output(t, terraformOptions, "random")

// Verify we're getting back the outputs we expect
// Ensure we get a random number appended
assert.Equal(t, exampleInput+" "+random, example)
// Ensure we get the attribute included in the ID
assert.Equal(t, "eg-ue2-test-example-"+randID, id)

// ************************************************************************
// This steps below are unusual, not generally part of the testing
// but included here as an example of testing this specific module.
// This module has a random number that is supposed to change
// only when the example changes. So we run it again to ensure
// it does not change.

// This will run `terraform apply` a second time and fail the test if there are any errors
terraform.Apply(t, terraformOptions)

id2 := terraform.Output(t, terraformOptions, "id")
example2 := terraform.Output(t, terraformOptions, "example")
random2 := terraform.Output(t, terraformOptions, "random")

assert.Equal(t, id, id2, "Expected `id` to be stable")
assert.Equal(t, example, example2, "Expected `example` to be stable")
assert.Equal(t, random, random2, "Expected `random` to be stable")

// Then we run change the example and run it a third time and
// verify that the random number changed
newExample := "Goodbye"
terraformOptions.Vars["example"] = newExample
terraform.Apply(t, terraformOptions)

example3 := terraform.Output(t, terraformOptions, "example")
random3 := terraform.Output(t, terraformOptions, "random")

assert.NotEqual(t, random, random3, "Expected `random` to change when `example` changed")
assert.Equal(t, newExample+" "+random3, example3, "Expected `example` to use new random number")

}

0 comments on commit e045c65

Please sign in to comment.