Skip to content

Commit f0479e8

Browse files
authored
Merge branch 'main' into deprecate_refs
2 parents 6e10a7a + 74cfa73 commit f0479e8

32 files changed

+546
-156
lines changed

.catalog-onboard-pipeline.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
apiVersion: v1
33
offerings:
4-
- name: deploy-arch-ibm-vpc
4+
- name: deploy-arch-ibm-slz-vpc
55
kind: solution
6-
catalog_id: f64499c8-eb50-4985-bf91-29f9e605a433
7-
offering_id: 2af61763-f8ef-4527-a815-b92166f29bc8
6+
catalog_id: 7df1e4ca-d54c-4fd0-82ce-3d13247308cd
7+
offering_id: 9fc0fa64-27af-4fed-9dce-47b3640ba739
88
variations:
99
- name: fully-configurable
10-
mark_ready: true
10+
mark_ready: false
1111
install_type: fullstack
1212
scc:
1313
instance_id: 1c7d5f78-9262-44c3-b779-b28fe4d88c37

.secrets.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "go.sum|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2024-08-29T15:52:09Z",
6+
"generated_at": "2024-08-29T15:52:08Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
This module creates the following IBM Cloud® Virtual Private Cloud (VPC) network components:
1010

11-
- VPC: Creates a VPC in a resource group and supports classic access. The VPC and components are specified in the [main.tf](main.tf) file.
11+
- VPC: Creates a VPC in a resource group. The VPC and components are specified in the [main.tf](main.tf) file.
1212
- Public gateways: Optionally create public gateways in the VPC in each of the three zones of the VPC's region.
1313
- Subnets: Create one to three zones in the [subnet.tf](subnet.tf) file.
1414
- Network ACLs: Create network ACLs with multiple rules. By default, VPC network ACLs can have no more than 25 rules.
@@ -44,6 +44,7 @@ Expected network connectivity downtime of typically around 20 seconds.
4444
* [workload-vpc](./modules/workload-vpc)
4545
* [Examples](./examples)
4646
* [Basic Example](./examples/basic)
47+
* [Custom Security Group Example](./examples/custom_security_group)
4748
* [Default Example](./examples/default)
4849
* [Existing VPC and subnets Example](./examples/existing_vpc)
4950
* [Hub and Spoke VPC Example](./examples/hub-spoke-delegated-resolver)
@@ -72,7 +73,6 @@ module vpc {
7273
prefix = "my-test"
7374
tags = ["tag1", "tag2"]
7475
vpc_name = "my-vpc"
75-
classic_access = true
7676
network_acls = [
7777
{
7878
name = "acl1"
@@ -276,14 +276,14 @@ To attach access management tags to resources in this module, you need the follo
276276
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | The resource group ID where the VPC to be created | `string` | n/a | yes |
277277
| <a name="input_routes"></a> [routes](#input\_routes) | OPTIONAL - Allows you to specify the next hop for packets based on their destination address | <pre>list(<br/> object({<br/> name = string<br/> route_direct_link_ingress = optional(bool)<br/> route_transit_gateway_ingress = optional(bool)<br/> route_vpc_zone_ingress = optional(bool)<br/> routes = optional(<br/> list(<br/> object({<br/> action = optional(string)<br/> zone = number<br/> destination = string<br/> next_hop = string<br/> })<br/> ))<br/> })<br/> )</pre> | `[]` | no |
278278
| <a name="input_routing_table_name"></a> [routing\_table\_name](#input\_routing\_table\_name) | The name to give the provisioned routing tables. If not set, the module generates a name based on the `prefix` and `name` variables. | `string` | `null` | no |
279-
| <a name="input_security_group_rules"></a> [security\_group\_rules](#input\_security\_group\_rules) | A list of security group rules to be added to the default vpc security group (default empty) | <pre>list(<br/> object({<br/> name = string<br/> direction = string<br/> remote = optional(string)<br/> tcp = optional(<br/> object({<br/> port_max = optional(number)<br/> port_min = optional(number)<br/> })<br/> )<br/> udp = optional(<br/> object({<br/> port_max = optional(number)<br/> port_min = optional(number)<br/> })<br/> )<br/> icmp = optional(<br/> object({<br/> type = optional(number)<br/> code = optional(number)<br/> })<br/> )<br/> })<br/> )</pre> | `[]` | no |
279+
| <a name="input_security_group_rules"></a> [security\_group\_rules](#input\_security\_group\_rules) | A list of security group rules to be added to the default vpc security group (default empty) | <pre>list(<br/> object({<br/> name = string<br/> direction = string<br/> remote = optional(string)<br/> local = optional(string)<br/> ip_version = optional(string)<br/> tcp = optional(<br/> object({<br/> port_max = optional(number)<br/> port_min = optional(number)<br/> })<br/> )<br/> udp = optional(<br/> object({<br/> port_max = optional(number)<br/> port_min = optional(number)<br/> })<br/> )<br/> icmp = optional(<br/> object({<br/> type = optional(number)<br/> code = optional(number)<br/> })<br/> )<br/> })<br/> )</pre> | `[]` | no |
280280
| <a name="input_skip_custom_resolver_hub_creation"></a> [skip\_custom\_resolver\_hub\_creation](#input\_skip\_custom\_resolver\_hub\_creation) | Indicates whether to skip the configuration of a custom resolver in the hub VPC. Only relevant if enable\_hub is set to true. | `bool` | `false` | no |
281281
| <a name="input_skip_spoke_auth_policy"></a> [skip\_spoke\_auth\_policy](#input\_skip\_spoke\_auth\_policy) | Set to true to skip the creation of an authorization policy between the DNS resolution spoke and hub, only enable this if a policy already exists between these two VPCs. See https://cloud.ibm.com/docs/vpc?topic=vpc-vpe-dns-sharing-s2s-auth&interface=ui for more details. | `bool` | `false` | no |
282-
| <a name="input_subnets"></a> [subnets](#input\_subnets) | List of subnets for the vpc. For each item in each array, a subnet will be created. Items can be either CIDR blocks or total ipv4 addresses. Public gateways will be enabled only in zones where a gateway has been created | <pre>object({<br/> zone-1 = list(object({<br/> name = string<br/> cidr = string<br/> public_gateway = optional(bool)<br/> acl_name = string<br/> no_addr_prefix = optional(bool, false) # do not automatically add address prefix for subnet, overrides other conditions if set to true<br/> subnet_tags = optional(list(string), [])<br/> }))<br/> zone-2 = optional(list(object({<br/> name = string<br/> cidr = string<br/> public_gateway = optional(bool)<br/> acl_name = string<br/> no_addr_prefix = optional(bool, false) # do not automatically add address prefix for subnet, overrides other conditions if set to true<br/> subnet_tags = optional(list(string), [])<br/> })))<br/> zone-3 = optional(list(object({<br/> name = string<br/> cidr = string<br/> public_gateway = optional(bool)<br/> acl_name = string<br/> no_addr_prefix = optional(bool, false) # do not automatically add address prefix for subnet, overrides other conditions if set to true<br/> subnet_tags = optional(list(string), [])<br/> })))<br/> })</pre> | <pre>{<br/> "zone-1": [<br/> {<br/> "acl_name": "vpc-acl",<br/> "cidr": "10.10.10.0/24",<br/> "name": "subnet-a",<br/> "no_addr_prefix": false,<br/> "public_gateway": true<br/> }<br/> ],<br/> "zone-2": [<br/> {<br/> "acl_name": "vpc-acl",<br/> "cidr": "10.20.10.0/24",<br/> "name": "subnet-b",<br/> "no_addr_prefix": false,<br/> "public_gateway": true<br/> }<br/> ],<br/> "zone-3": [<br/> {<br/> "acl_name": "vpc-acl",<br/> "cidr": "10.30.10.0/24",<br/> "name": "subnet-c",<br/> "no_addr_prefix": false,<br/> "public_gateway": false<br/> }<br/> ]<br/>}</pre> | no |
282+
| <a name="input_subnets"></a> [subnets](#input\_subnets) | List of subnets for the vpc. For each item in each array, a subnet will be created. Items can be either CIDR blocks or total ipv4 addresses. Public gateways will be enabled only in zones where a gateway has been created | <pre>object({<br/> zone-1 = list(object({<br/> name = string<br/> cidr = string<br/> public_gateway = optional(bool)<br/> acl_name = string<br/> no_addr_prefix = optional(bool, false) # do not automatically add address prefix for subnet, overrides other conditions if set to true<br/> subnet_tags = optional(list(string), [])<br/> }))<br/> zone-2 = optional(list(object({<br/> name = string<br/> cidr = string<br/> public_gateway = optional(bool)<br/> acl_name = string<br/> no_addr_prefix = optional(bool, false) # do not automatically add address prefix for subnet, overrides other conditions if set to true<br/> subnet_tags = optional(list(string), [])<br/> })))<br/> zone-3 = optional(list(object({<br/> name = string<br/> cidr = string<br/> public_gateway = optional(bool)<br/> acl_name = string<br/> no_addr_prefix = optional(bool, false) # do not automatically add address prefix for subnet, overrides other conditions if set to true<br/> subnet_tags = optional(list(string), [])<br/> })))<br/> })</pre> | <pre>{<br/> "zone-1": [<br/> {<br/> "acl_name": "vpc-acl",<br/> "cidr": "10.10.10.0/24",<br/> "name": "subnet-a",<br/> "no_addr_prefix": false,<br/> "public_gateway": true<br/> }<br/> ],<br/> "zone-2": [<br/> {<br/> "acl_name": "vpc-acl",<br/> "cidr": "10.20.10.0/24",<br/> "name": "subnet-b",<br/> "no_addr_prefix": false,<br/> "public_gateway": true<br/> }<br/> ],<br/> "zone-3": [<br/> {<br/> "acl_name": "vpc-acl",<br/> "cidr": "10.30.10.0/24",<br/> "name": "subnet-c",<br/> "no_addr_prefix": false,<br/> "public_gateway": true<br/> }<br/> ]<br/>}</pre> | no |
283283
| <a name="input_tags"></a> [tags](#input\_tags) | List of Tags for the resource created | `list(string)` | `null` | no |
284284
| <a name="input_update_delegated_resolver"></a> [update\_delegated\_resolver](#input\_update\_delegated\_resolver) | If set to true, and if the vpc is configured to be a spoke for DNS resolution (enable\_hub\_vpc\_crn or enable\_hub\_vpc\_id set), then the spoke VPC resolver will be updated to a delegated resolver. | `bool` | `false` | no |
285285
| <a name="input_use_existing_dns_instance"></a> [use\_existing\_dns\_instance](#input\_use\_existing\_dns\_instance) | Whether to use an existing dns instance. If true, existing\_dns\_instance\_id must be set. | `bool` | `false` | no |
286-
| <a name="input_use_public_gateways"></a> [use\_public\_gateways](#input\_use\_public\_gateways) | Create a public gateway in any of the three zones with `true`. | <pre>object({<br/> zone-1 = optional(bool)<br/> zone-2 = optional(bool)<br/> zone-3 = optional(bool)<br/> })</pre> | <pre>{<br/> "zone-1": true,<br/> "zone-2": false,<br/> "zone-3": false<br/>}</pre> | no |
286+
| <a name="input_use_public_gateways"></a> [use\_public\_gateways](#input\_use\_public\_gateways) | Create a public gateway in any of the three zones with `true`. | <pre>object({<br/> zone-1 = optional(bool)<br/> zone-2 = optional(bool)<br/> zone-3 = optional(bool)<br/> })</pre> | <pre>{<br/> "zone-1": true,<br/> "zone-2": true,<br/> "zone-3": true<br/>}</pre> | no |
287287
| <a name="input_vpc_flow_logs_name"></a> [vpc\_flow\_logs\_name](#input\_vpc\_flow\_logs\_name) | The name to give the provisioned VPC flow logs. If not set, the module generates a name based on the `prefix` and `name` variables. | `string` | `null` | no |
288288
| <a name="input_vpn_gateways"></a> [vpn\_gateways](#input\_vpn\_gateways) | List of VPN gateways to create. | <pre>list(<br/> object({<br/> name = string<br/> subnet_name = string # Do not include prefix, use same name as in `var.subnets`<br/> mode = optional(string)<br/> resource_group = optional(string)<br/> access_tags = optional(list(string), [])<br/> })<br/> )</pre> | `[]` | no |
289289

default_security_group.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ locals {
1111
}
1212

1313
resource "ibm_is_security_group_rule" "default_vpc_rule" {
14-
for_each = local.security_group_rule_object
15-
group = var.create_vpc == true ? ibm_is_vpc.vpc[0].default_security_group : data.ibm_is_vpc.vpc.default_security_group
16-
direction = each.value.direction
17-
remote = each.value.remote
14+
for_each = local.security_group_rule_object
15+
group = var.create_vpc == true ? ibm_is_vpc.vpc[0].default_security_group : data.ibm_is_vpc.vpc.default_security_group
16+
direction = each.value.direction
17+
remote = each.value.remote
18+
local = each.value.local
19+
ip_version = each.value.ip_version
1820

1921
dynamic "tcp" {
2022
for_each = each.value.tcp == null ? [] : [each.value]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Custom Security Group Example
2+
3+
A simple example to provision a Secure Landing Zone (SLZ) Virtual Private Cloud (VPC) with Security Group Rules set.
4+
5+
The following resources are provisioned by this example:
6+
7+
* A new resource group, if an existing one is not passed in.
8+
* An IBM Virtual Private Cloud (VPC) with custom security group rules.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
##############################################################################
3+
# Resource Group
4+
##############################################################################
5+
6+
module "resource_group" {
7+
source = "terraform-ibm-modules/resource-group/ibm"
8+
version = "1.3.0"
9+
# if an existing resource group is not set (null) create a new one using prefix
10+
resource_group_name = var.resource_group == null ? "${var.prefix}-resource-group" : null
11+
existing_resource_group_name = var.resource_group
12+
}
13+
14+
##############################################################################
15+
# Create new VPC
16+
# (if var.vpc_id is null, create a new VPC)
17+
##############################################################################
18+
19+
module "vpc" {
20+
source = "../.."
21+
resource_group_id = module.resource_group.resource_group_id
22+
region = var.region
23+
prefix = var.prefix
24+
name = "sg-vpc"
25+
tags = var.resource_tags
26+
security_group_rules = [{
27+
name = "allow-all-inbound-sg"
28+
direction = "inbound"
29+
remote = "0.0.0.0/0" # source of the traffic. 0.0.0.0/0 traffic from all across the internet.
30+
local = "0.0.0.0/0" # A CIDR block of 0.0.0.0/0 allows traffic to all local IP addresses (or from all local IP addresses, for outbound rules).
31+
ip_version = "ipv4"
32+
}]
33+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
##############################################################################
2+
# Outputs
3+
##############################################################################
4+
5+
output "vpc_id" {
6+
value = module.vpc.vpc_id
7+
description = "VPC id"
8+
}
9+
10+
output "vpc_crn" {
11+
value = module.vpc.vpc_crn
12+
description = "VPC crn"
13+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
provider "ibm" {
2+
ibmcloud_api_key = var.ibmcloud_api_key
3+
region = var.region
4+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
variable "ibmcloud_api_key" {
2+
description = "APIkey that's associated with the account to provision resources to"
3+
type = string
4+
sensitive = true
5+
}
6+
7+
variable "region" {
8+
description = "The region to which to deploy the VPC"
9+
type = string
10+
}
11+
12+
variable "prefix" {
13+
description = "The prefix that you would like to append to your resources"
14+
type = string
15+
}
16+
17+
variable "resource_group" {
18+
type = string
19+
description = "An existing resource group name to use for this example, if unset a new resource group will be created"
20+
default = null
21+
}
22+
23+
variable "resource_tags" {
24+
description = "List of Tags for the resource created"
25+
type = list(string)
26+
default = null
27+
}

0 commit comments

Comments
 (0)