Skip to content

Commit

Permalink
Fix release workflow (#61)
Browse files Browse the repository at this point in the history
* Fix release.yml

* Update main.tf

* Update examples_complete_test.go

* Update examples_complete_test.go
  • Loading branch information
goruha authored Jul 11, 2024
1 parent 2c6b476 commit e5696c6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ on:
types:
- published

permissions: {}
permissions:
contents: write
pull-requests: write
id-token: write

jobs:
terraform-module:
Expand Down
6 changes: 1 addition & 5 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,4 @@ module "notify_slack" {
slack_webhook_url = var.slack_webhook_url
slack_channel = var.slack_channel
slack_username = var.slack_username
# Add MD5 hash of a timestamp attribute to avoid conflict for concurrent test runs, e.g.:
# `Error: creating CloudWatch Logs Log Group (/aws/lambda/eg-test-sns-default):
# ResourceAlreadyExistsException: The specified log group already exists.`
attributes = [md5(timestamp())]
}
}
11 changes: 10 additions & 1 deletion test/src/examples_complete_test.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
package test

import (
"strings"

"github.com/gruntwork-io/terratest/modules/random"
"github.com/gruntwork-io/terratest/modules/terraform"
"testing"
)

// Test the Terraform module in examples/complete using Terratest.
func TestExamplesComplete(t *testing.T) {
t.Parallel()


randID := strings.ToLower(random.UniqueId())
attributes := []string{randID}

terraformOptions := &terraform.Options{
// The path to where our Terraform code is located
TerraformDir: "../../examples/complete",
Upgrade: true,
// Variables to pass to our Terraform code using -var-file options
VarFiles: []string{"fixtures.us-east-2.tfvars"},
Vars: map[string]interface{}{
"attributes": attributes,
},
}

// At the end of the test, run `terraform destroy` to clean up any resources that were created
Expand Down

0 comments on commit e5696c6

Please sign in to comment.