Skip to content
Merged
2 changes: 1 addition & 1 deletion .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "go.sum|^.secrets.baseline$",
"lines": null
},
"generated_at": "2023-12-19T10:03:18Z",
"generated_at": "2024-08-29T15:52:09Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ This module creates the following IBM Cloud® Virtual Private Cloud (VPC) net
* [Hub and Spoke VPC with manual DNS resolver Example](./examples/hub-spoke-manual-resolver)
* [Landing Zone example](./examples/landing_zone)
* [No Prefix Example](./examples/no-prefix)
* [Specific Zone Only Example](./examples/specific-zone-only)
* [Contributing](#contributing)
<!-- END OVERVIEW HOOK -->

Expand Down
8 changes: 8 additions & 0 deletions examples/specific-zone-only/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Specific Zone Only Example

A simple example to provision a Secure Landing Zone (SLZ) Virtual Private Cloud (VPC) in a specific zone other than Zone 1. Also, shows how to use public gateways with a specific zone. In this example Zone 2 is used.

The following resources are provisioned by this example:

* A new resource group, if an existing one is not passed in.
* An IBM Virtual Private Cloud (VPC) with a publicly exposed subnet.
40 changes: 40 additions & 0 deletions examples/specific-zone-only/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
##############################################################################
# Resource Group
##############################################################################

module "resource_group" {
source = "terraform-ibm-modules/resource-group/ibm"
version = "1.1.5"
# if an existing resource group is not set (null) create a new one using prefix
resource_group_name = var.resource_group == null ? "${var.prefix}-resource-group" : null
existing_resource_group_name = var.resource_group
}

#############################################################################
# Provision VPC
#############################################################################

module "slz_vpc" {
source = "../../"
resource_group_id = module.resource_group.resource_group_id
region = var.region
name = var.name
prefix = var.prefix
tags = var.resource_tags
subnets = {
zone-1 = []
zone-2 = [
{
name = "subnet-a"
cidr = "10.10.10.0/24"
public_gateway = true
acl_name = "vpc-acl"
}
]
}
use_public_gateways = {
zone-1 = false
zone-2 = true
zone-3 = false
}
}
13 changes: 13 additions & 0 deletions examples/specific-zone-only/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
##############################################################################
# Outputs
##############################################################################

output "vpc_id" {
value = module.slz_vpc.vpc_id
description = "VPC id"
}

output "vpc_crn" {
value = module.slz_vpc.vpc_crn
description = "VPC crn"
}
4 changes: 4 additions & 0 deletions examples/specific-zone-only/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
provider "ibm" {
ibmcloud_api_key = var.ibmcloud_api_key
region = var.region
}
35 changes: 35 additions & 0 deletions examples/specific-zone-only/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
variable "ibmcloud_api_key" {
description = "APIkey that's associated with the account to provision resources to"
type = string
sensitive = true
}

variable "region" {
description = "The region to which to deploy the VPC"
type = string
default = "us-south"
}

variable "prefix" {
description = "The prefix that you would like to append to your resources"
type = string
default = "basic-slz-vpc"
}

variable "name" {
description = "The name of the vpc"
type = string
default = "vpc"
}

variable "resource_group" {
type = string
description = "An existing resource group name to use for this example, if unset a new resource group will be created"
default = null
}

variable "resource_tags" {
description = "List of Tags for the resource created"
type = list(string)
default = null
}
10 changes: 10 additions & 0 deletions examples/specific-zone-only/version.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
terraform {
required_version = ">= 1.3.0, <1.7.0"
required_providers {
# Pin to the lowest provider version of the range defined in the main module's version.tf to ensure lowest version still works
ibm = {
source = "IBM-Cloud/ibm"
version = "1.59.0"
}
}
}