Skip to content

Commit

Permalink
chore: adopt best practises for VPE gateway examples (#544)
Browse files Browse the repository at this point in the history
  • Loading branch information
shemau authored Jun 26, 2024
1 parent 280b071 commit 5171ca5
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 16 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ An IBM Provider [issue](https://github.com/IBM-Cloud/terraform-provider-ibm/issu
## Overview
* [terraform-ibm-vpe-gateway](#terraform-ibm-vpe-gateway)
* [Examples](./examples)
* [End-to-end example](./examples/default)
* [Every multi-tenant VPE](./examples/every-mt-vpe)
* [Advanced dedicated service VPE gateway](./examples/advanced)
* [Basic multi-tenant VPE gateway](./examples/basic)
* [Contributing](#contributing)
<!-- END OVERVIEW HOOK -->

Expand Down
2 changes: 1 addition & 1 deletion cra-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# More info about this file at https://github.com/terraform-ibm-modules/common-pipeline-assets/blob/main/.github/workflows/terraform-test-pipeline.md#cra-config-yaml
version: "v1"
CRA_TARGETS:
- CRA_TARGET: "examples/default" # Target directory for CRA scan. If not provided, the CRA Scan will not be run.
- CRA_TARGET: "examples/advanced" # Target directory for CRA scan. If not provided, the CRA Scan will not be run.
CRA_IGNORE_RULES_FILE: "cra-tf-validate-ignore-rules.json" # CRA Ignore file to use. If not provided, it checks the repo root directory for `cra-tf-validate-ignore-rules.json`
PROFILE_ID: "0e6e7b5a-817d-4344-ab6f-e5d7a9c49520" # SCC profile ID (currently set to the FSCloud 1.4.0 profile).
CRA_ENVIRONMENT_VARIABLES:
Expand Down
5 changes: 3 additions & 2 deletions examples/default/README.md → examples/advanced/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# End-to-end example
# Advanced dedicated service VPE gateway

This example creates the following infrastructure:
- A resource group, if one is not passed in.
- A VPC, if one is not passed in.
- The VPC is created with three subnets across the three availability zones of the region that is passed as input.
- A security group in the VPC.
- The security group is created with a single inbound rule that allows traffic from resources that are attached to the default VPC security group. This rule is added as an example.
- Two virtual private endpoint (VPE) gateways. By default, one VPE to COS and another VPE to Key Protect are created. You can change the defaults by using the `service_endpoints` input.
- Two virtual private endpoint (VPE) gateways are created. One to COS and the other VPE to Key Protect.
- Each of the two virtual private endpoint gateways are attached to the three VPC subnets.
- The new security group is attached to the two VPE gateways.
- A dedicated postgresql instance with a VPE gateway from the VPC
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ terraform {
ibm = {
source = "IBM-Cloud/ibm"
# pin above lowest vesion, required for postgresql and IAM auth policy
version = "1.62.0"
version = ">=1.61.0"
}
time = {
source = "hashicorp/time"
Expand Down
7 changes: 7 additions & 0 deletions examples/basic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Basic multi-tenant VPE gateway

This example creates the following infrastructure:
- A resource group, if one is not passed in.
- A VPC
- The VPC is created with three subnets across the three availability zones of the region that is passed as input.
- A virtual private endpoint (VPE) gateways for every multitenant service supported
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ terraform {
required_providers {
ibm = {
source = "IBM-Cloud/ibm"
# pin above lowest vesion, required for postgresql and IAM auth policy
version = ">=1.61.0"
# pin to lowest vesion, required for IAM auth policy
version = "1.61.0"
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions examples/every-mt-vpe/README.md

This file was deleted.

10 changes: 5 additions & 5 deletions tests/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

// Use existing resource group
const resourceGroup = "geretain-test-resources"
const defaultExampleTerraformDir = "examples/default"
const advancedExampleTerraformDir = "examples/advanced"

const region = "us-south"

Expand Down Expand Up @@ -72,10 +72,10 @@ func ValidateOutputMapOfSlicesContent(inputMap map[string]interface{}) ([]string
return failedKeys, err
}

func TestRunDefaultExample(t *testing.T) {
func TestRunAdvancedExample(t *testing.T) {
t.Parallel()

options := setupOptions(t, "vpe-default", defaultExampleTerraformDir)
options := setupOptions(t, "vpe-adv", advancedExampleTerraformDir)
options.SkipTestTearDown = true
output, err := options.RunTestConsistency()
assert.Nil(t, err, "This should not have errored")
Expand All @@ -102,7 +102,7 @@ func TestRunDefaultExample(t *testing.T) {
func TestRunUpgradeExample(t *testing.T) {
t.Parallel()

options := setupOptions(t, "vpe-upgrade", defaultExampleTerraformDir)
options := setupOptions(t, "vpe-upgrade", advancedExampleTerraformDir)
output, err := options.RunTestUpgrade()
if !options.UpgradeTestSkipped {
assert.Nil(t, err, "This should not have errored")
Expand All @@ -113,7 +113,7 @@ func TestRunUpgradeExample(t *testing.T) {
func TestRunEveryMultiTenantExample(t *testing.T) {
t.Parallel()

options := setupOptions(t, "vpe-allmt", "examples/every-mt-vpe")
options := setupOptions(t, "vpe-allmt", "examples/basic")
output, err := options.RunTestConsistency()
assert.Nil(t, err, "This should not have errored")
assert.NotNil(t, output, "Expected some output")
Expand Down

0 comments on commit 5171ca5

Please sign in to comment.