Skip to content

Commit 8236305

Browse files
Wesley HofflerWesley Hoffler
authored andcommitted
rework to use public resources and modules
1 parent 71fb8b5 commit 8236305

File tree

4 files changed

+37
-45
lines changed

4 files changed

+37
-45
lines changed

examples/multizone-rule/main.tf

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,26 @@ module "resource_group" {
1919
##############################################################################
2020
# VPC
2121
##############################################################################
22-
23-
module "acl_profile" {
24-
source = "git::https://github.ibm.com/GoldenEye/acl-profile-ocp.git?ref=1.1.2"
22+
resource "ibm_is_vpc" "example_vpc" {
23+
name = "${var.prefix}-vpc"
24+
resource_group = module.resource_group.resource_group_id
25+
tags = var.resource_tags
2526
}
2627

27-
locals {
28-
acl_rules_map = {
29-
private = concat(
30-
module.acl_profile.base_acl,
31-
module.acl_profile.https_acl,
32-
module.acl_profile.deny_all_acl
33-
)
34-
}
28+
resource "ibm_is_public_gateway" "testacc_gateway" {
29+
name = "${var.prefix}-pgateway"
30+
vpc = ibm_is_vpc.example_vpc.id
31+
zone = "${var.region}-1"
32+
resource_group = module.resource_group.resource_group_id
3533
}
3634

37-
module "vpc" {
38-
source = "git::https://github.ibm.com/GoldenEye/vpc-module.git?ref=3.1.1"
39-
unique_name = var.prefix
40-
ibm_region = var.region
41-
resource_group_id = module.resource_group.resource_group_id
42-
use_mgmt_subnet = true
43-
acl_rules_map = local.acl_rules_map
44-
virtual_private_endpoints = {}
45-
vpc_tags = var.resource_tags
35+
resource "ibm_is_subnet" "testacc_subnet" {
36+
name = "${var.prefix}-subnet"
37+
vpc = ibm_is_vpc.example_vpc.id
38+
zone = "${var.region}-1"
39+
public_gateway = ibm_is_public_gateway.testacc_gateway.id
40+
total_ipv4_address_count = 256
41+
resource_group = module.resource_group.resource_group_id
4642
}
4743

4844
##############################################################################
@@ -56,7 +52,7 @@ locals {
5652
zone_description = "cbr-zone1-terraform"
5753
addresses = [{
5854
type = "vpc", # to bind a specific vpc to the zone
59-
value = module.vpc.vpc_crn
55+
value = resource.ibm_is_vpc.example_vpc.crn,
6056
}]
6157
},
6258
{

examples/multizone-rule/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ variable "ibmcloud_api_key" {
77
variable "prefix" {
88
type = string
99
description = "Prefix to append to all resources created by this example"
10-
default = "terraform-multizone"
10+
default = "test-terraform-multizone"
1111
}
1212

1313
variable "region" {

examples/zone/main.tf

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,26 @@ module "resource_group" {
1919
##############################################################################
2020
# VPC
2121
##############################################################################
22-
23-
module "acl_profile" {
24-
source = "git::https://github.ibm.com/GoldenEye/acl-profile-ocp.git?ref=1.1.2"
22+
resource "ibm_is_vpc" "example_vpc" {
23+
name = "${var.prefix}-vpc"
24+
resource_group = module.resource_group.resource_group_id
25+
tags = var.resource_tags
2526
}
2627

27-
locals {
28-
acl_rules_map = {
29-
private = concat(
30-
module.acl_profile.base_acl,
31-
module.acl_profile.https_acl,
32-
module.acl_profile.deny_all_acl
33-
)
34-
}
28+
resource "ibm_is_public_gateway" "testacc_gateway" {
29+
name = "${var.prefix}-pgateway"
30+
vpc = ibm_is_vpc.example_vpc.id
31+
zone = "${var.region}-1"
32+
resource_group = module.resource_group.resource_group_id
3533
}
3634

37-
module "vpc" {
38-
source = "git::https://github.ibm.com/GoldenEye/vpc-module.git?ref=3.1.1"
39-
unique_name = var.prefix
40-
ibm_region = var.region
41-
resource_group_id = module.resource_group.resource_group_id
42-
use_mgmt_subnet = true
43-
acl_rules_map = local.acl_rules_map
44-
virtual_private_endpoints = {}
45-
vpc_tags = var.resource_tags
35+
resource "ibm_is_subnet" "testacc_subnet" {
36+
name = "${var.prefix}-subnet"
37+
vpc = ibm_is_vpc.example_vpc.id
38+
zone = "${var.region}-1"
39+
public_gateway = ibm_is_public_gateway.testacc_gateway.id
40+
total_ipv4_address_count = 256
41+
resource_group = module.resource_group.resource_group_id
4642
}
4743

4844
##############################################################################
@@ -52,7 +48,7 @@ module "vpc" {
5248
locals {
5349
zone_address_details = [{
5450
type = "vpc", # to bind a specific vpc to the zone
55-
value = module.vpc.vpc_crn,
51+
value = resource.ibm_is_vpc.example_vpc.crn,
5652
}, {
5753
type = "serviceRef" # to bind a service reference type should be 'serviceRef'
5854
ref = {

examples/zone/outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# Outputs
33
##############################################################################
44

5-
output "crn" {
6-
value = module.vpc.vpc_id
5+
output "vpc_id" {
6+
value = resource.ibm_is_vpc.example_vpc.id
77
description = "VPC id"
88
}
99

0 commit comments

Comments
 (0)