-
Notifications
You must be signed in to change notification settings - Fork 17
feat: added new example #839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
af3f8f1
feat: added new example
kierramarie 7ecc91b
Merge branch 'main' into ks-ex-update
kierramarie 40903e6
Merge branch 'main' into ks-ex-update
kierramarie 0288f2a
Merge branch 'main' into ks-ex-update
kierramarie 91fbdff
test: add new test'
kierramarie 3d41a0a
fix: merge with main
kierramarie 5fb0910
docs: readme update
kierramarie 442aff4
Merge branch 'main' into ks-ex-update
kierramarie f720f55
chore: version adjusts
kierramarie a42ba9b
fix: change example acl name
kierramarie 9aa4581
Merge branch 'main' into ks-ex-update
kierramarie 5a7494e
Merge branch 'main' into ks-ex-update
rajatagarwal-ibm 63ae918
Merge branch 'main' into ks-ex-update
rajatagarwal-ibm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. A network ACL is specifically defined to allow all internet traffic. | ||
|
|
||
| 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. |
kierramarie marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| ############################################################################## | ||
| # Resource Group | ||
| ############################################################################## | ||
|
|
||
| module "resource_group" { | ||
| source = "terraform-ibm-modules/resource-group/ibm" | ||
| version = "1.1.6" | ||
| # 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 = "my-acl" | ||
kierramarie marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| ] | ||
| } | ||
| use_public_gateways = { | ||
| zone-1 = false | ||
| zone-2 = true | ||
| zone-3 = false | ||
| } | ||
| network_acls = [{ | ||
| name = "my-acl" | ||
kierramarie marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| add_ibm_cloud_internal_rules = false | ||
| add_vpc_connectivity_rules = false | ||
| prepend_ibm_rules = false | ||
| rules = [{ | ||
| name = "inbound" | ||
| action = "allow" | ||
| source = "0.0.0.0/0" | ||
| destination = "0.0.0.0/0" | ||
| direction = "inbound" | ||
| }, | ||
| { | ||
| name = "outbound" | ||
| action = "allow" | ||
| source = "0.0.0.0/0" | ||
| destination = "0.0.0.0/0" | ||
| direction = "outbound" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
kierramarie marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| ############################################################################## | ||
| # 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" | ||
| } | ||
|
|
||
| output "network_acls" { | ||
| value = module.slz_vpc.network_acls | ||
| description = "VPC network ACLs" | ||
| } | ||
|
|
||
| output "public_gateways" { | ||
| value = module.slz_vpc.public_gateways | ||
| description = "VPC public gateways" | ||
| } | ||
|
|
||
| output "subnet_zone_list" { | ||
| value = module.slz_vpc.subnet_zone_list | ||
| description = "VPC subnet zone list" | ||
| } | ||
|
|
||
| output "subnet_detail_map" { | ||
| value = module.slz_vpc.subnet_detail_map | ||
| description = "VPC subnet detail map" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| terraform { | ||
| required_version = ">= 1.3.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" | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.