Skip to content

Commit

Permalink
fix: extend the required terraform version to < 1.7 (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
akocbek authored Feb 28, 2024
1 parent f49c9d5 commit bbd304a
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 50 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ module "tg_gateway_connection" {

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0, <1.6.0 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0, <1.7.0 |
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.52.0, < 2.0.0 |

### Modules
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 1.0.0, <1.6.0"
required_version = ">= 1.0.0, <1.7.0"
required_providers {
ibm = {
source = "IBM-Cloud/ibm"
Expand Down
2 changes: 1 addition & 1 deletion examples/crossaccounts/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 1.0.0, <1.6.0"
required_version = ">= 1.0.0, <1.7.0"
required_providers {
ibm = {
source = "IBM-Cloud/ibm"
Expand Down
2 changes: 1 addition & 1 deletion examples/two-vpcs/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 1.0.0, <1.6.0"
required_version = ">= 1.0.0, <1.7.0"
required_providers {
ibm = {
source = "IBM-Cloud/ibm"
Expand Down
2 changes: 1 addition & 1 deletion modules/terraform-ibm-transit-gateway-action/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module "tg_gateway_connection_crossaccounts_approve" {

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0, <1.6.0 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0, <1.7.0 |
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.52.0, < 2.0.0 |

### Modules
Expand Down
2 changes: 1 addition & 1 deletion modules/terraform-ibm-transit-gateway-action/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 1.0.0, <1.6.0"
required_version = ">= 1.0.0, <1.7.0"
required_providers {
# Use "greater than or equal to" range in modules
ibm = {
Expand Down
83 changes: 41 additions & 42 deletions tests/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/cloudinfo"
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/common"
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testhelper"
Expand Down Expand Up @@ -82,47 +81,47 @@ func setupOptions2VpcsExample(t *testing.T, prefix string) *testhelper.TestOptio
return options
}

func setupOptionsCrossaccountsExample(t *testing.T, prefix string) *testhelper.TestOptions {
const TwoVpcsExampleTerraformDir = "examples/crossaccounts"

// loading and setting apikeys to perform the test
// from TF_VAR_ibmcloud_api_key and TF_VAR_ibmcloud_api_key_ext env variables
// to TF_VAR_ibmcloud_api_key_account_a and TF_VAR_ibmcloud_api_key_account_b env variables
ibmCloudApiKeyAEnvVarName := "TF_VAR_ibmcloud_api_key"
ibmCloudApiKeyA := ""
valA, presentA := os.LookupEnv(ibmCloudApiKeyAEnvVarName)
require.True(t, presentA)
ibmCloudApiKeyA = valA
ibmCloudApiKeyBEnvVarName := "TF_VAR_ibmcloud_api_key_ext"
ibmCloudApiKeyB := ""
valB, presentB := os.LookupEnv(ibmCloudApiKeyBEnvVarName)
require.True(t, presentB)
ibmCloudApiKeyB = valB
os.Setenv("TF_VAR_ibmcloud_api_key_account_a", ibmCloudApiKeyA)
os.Setenv("TF_VAR_ibmcloud_api_key_account_b", ibmCloudApiKeyB)

options := testhelper.TestOptionsDefault(&testhelper.TestOptions{
Testing: t,
Prefix: prefix,
TerraformDir: TwoVpcsExampleTerraformDir,
ResourceGroup: resourceGroup,
})
const ibmcloudApiKeyVar = "TF_VAR_ibmcloud_api_key"

options.TerraformVars = map[string]interface{}{
"transit_gateway_name": fmt.Sprintf("%s-%s", options.Prefix, "crosstg"),
// using the same region of the target account
"region_account_a": permanentResources["gestaging_vpc_region"],
"region_account_b": permanentResources["gestaging_vpc_region"],
"prefix_account_a": fmt.Sprintf("%s-%s", options.Prefix, "a"),
// using existing vpc crn
"existing_vpc_crn_account_b": permanentResources["gestaging_vpc_crn"],
"resource_group_account_a": options.ResourceGroup,
"resource_group_account_b": permanentResources["gestaging_rg"],
}

return options
}
// func setupOptionsCrossaccountsExample(t *testing.T, prefix string) *testhelper.TestOptions {
// const TwoVpcsExampleTerraformDir = "examples/crossaccounts"

// // loading and setting apikeys to perform the test
// // from TF_VAR_ibmcloud_api_key and TF_VAR_ibmcloud_api_key_ext env variables
// // to TF_VAR_ibmcloud_api_key_account_a and TF_VAR_ibmcloud_api_key_account_b env variables
// ibmCloudApiKeyAEnvVarName := "TF_VAR_ibmcloud_api_key"
// ibmCloudApiKeyA := ""
// valA, presentA := os.LookupEnv(ibmCloudApiKeyAEnvVarName)
// require.True(t, presentA)
// ibmCloudApiKeyA = valA
// ibmCloudApiKeyBEnvVarName := "TF_VAR_ibmcloud_api_key_ext"
// ibmCloudApiKeyB := ""
// valB, presentB := os.LookupEnv(ibmCloudApiKeyBEnvVarName)
// require.True(t, presentB)
// ibmCloudApiKeyB = valB
// os.Setenv("TF_VAR_ibmcloud_api_key_account_a", ibmCloudApiKeyA)
// os.Setenv("TF_VAR_ibmcloud_api_key_account_b", ibmCloudApiKeyB)

// options := testhelper.TestOptionsDefault(&testhelper.TestOptions{
// Testing: t,
// Prefix: prefix,
// TerraformDir: TwoVpcsExampleTerraformDir,
// ResourceGroup: resourceGroup,
// })
// const ibmcloudApiKeyVar = "TF_VAR_ibmcloud_api_key"

// options.TerraformVars = map[string]interface{}{
// "transit_gateway_name": fmt.Sprintf("%s-%s", options.Prefix, "crosstg"),
// // using the same region of the target account
// "region_account_a": permanentResources["gestaging_vpc_region"],
// "region_account_b": permanentResources["gestaging_vpc_region"],
// "prefix_account_a": fmt.Sprintf("%s-%s", options.Prefix, "a"),
// // using existing vpc crn
// "existing_vpc_crn_account_b": permanentResources["gestaging_vpc_crn"],
// "resource_group_account_a": options.ResourceGroup,
// "resource_group_account_b": permanentResources["gestaging_rg"],
// }

// return options
// }

func TestRunBasicExample(t *testing.T) {
t.Parallel()
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 1.0.0, <1.6.0"
required_version = ">= 1.0.0, <1.7.0"
required_providers {
# Use "greater than or equal to" range in modules
ibm = {
Expand Down

0 comments on commit bbd304a

Please sign in to comment.