Skip to content

Commit 7b7af92

Browse files
authored
feat: onboard "Existing VPC" VSI extension deployable architecture to IBM catalog (#610)
1 parent 8425eb3 commit 7b7af92

File tree

13 files changed

+1521
-1255
lines changed

13 files changed

+1521
-1255
lines changed

.catalog-onboard-pipeline.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@ offerings:
1010
mark_ready: false
1111
install_type: fullstack
1212
pre_validation: "tests/scripts/pre-validation-generate-ssh-key.sh ssh_key patterns/vsi-quickstart"
13-
destroy_resources_on_failure: true
14-
destroy_workspace_on_failure: false
1513
- name: standard
1614
mark_ready: false
1715
install_type: fullstack
1816
pre_validation: "tests/scripts/pre-validation-generate-ssh-key.sh ssh_public_key patterns/vsi"
19-
destroy_resources_on_failure: true
20-
destroy_workspace_on_failure: false
17+
scc:
18+
instance_id: 1c7d5f78-9262-44c3-b779-b28fe4d88c37
19+
region: us-south
20+
- name: existing-vpc
21+
mark_ready: false
22+
install_type: extension
23+
pre_validation: "tests/scripts/pre-validation-deploy-slz-vpc.sh"
24+
post_validation: "tests/scripts/post-validation-destroy-slz-vpc.sh"
2125
scc:
2226
instance_id: 1c7d5f78-9262-44c3-b779-b28fe4d88c37
2327
region: us-south
@@ -29,8 +33,6 @@ offerings:
2933
- name: standard
3034
mark_ready: false
3135
install_type: fullstack
32-
destroy_resources_on_failure: true
33-
destroy_workspace_on_failure: false
3436
scc:
3537
instance_id: 1c7d5f78-9262-44c3-b779-b28fe4d88c37
3638
region: us-south
@@ -42,8 +44,6 @@ offerings:
4244
- name: standard
4345
mark_ready: false
4446
install_type: fullstack
45-
destroy_resources_on_failure: true
46-
destroy_workspace_on_failure: false
4747
scc:
4848
instance_id: 1c7d5f78-9262-44c3-b779-b28fe4d88c37
4949
region: us-south

ibm_catalog.json

Lines changed: 1338 additions & 1244 deletions
Large diffs are not rendered by default.

patterns/vsi-extension/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Add a VSI to a landing zone VPC
22

3-
This architecture creates virtual server instances (VSI) for VPC in some or all of the subnets of any existing landing zone VPC deployable architecture.
3+
This architecture creates virtual server instances (VSI) in some or all of the subnets of one VPC of an existing landing zone deployable architecture. To create VSIs in multiple VPCs, deploy the extension once for each VPC.
44

55
## Before you begin
66

77
- You must have either the [VPC landing zone](https://cloud.ibm.com/catalog/architecture/deploy-arch-ibm-slz-vpc-9fc0fa64-27af-4fed-9dce-47b3640ba739-global) or [Red Hat OpenShift Container Platform on VPC landing zone](https://cloud.ibm.com/catalog/architecture/deploy-arch-ibm-slz-ocp-95fccffc-ae3b-42df-b6d9-80be5914d852-global) deployable architecture deployed.
8-
- The block storage to KMS auth policy must exist. This policy would have been created by one of the above deployable architectures if the `add_kms_block_storage_s2s` variable was set to `true`, which is default value.
9-
- You need the VPC ID, subnet names, and boot volume encryption key from your existing landing zone VPC deployable architecture. For information about finding these values, see [Adding a VSI to your VPC landing zone deployable architecture](https://cloud.ibm.com/docs/secure-infrastructure-vpc?topic=secure-infrastructure-vpc-ext-with-vsi).
8+
- You need an authorization policy that grants access between block storage and the KMS. The policy exists if you set the `add_kms_block_storage_s2s` input variable to `true` (the default value) in your existing landing zone deployable architecture.
9+
- You need the VPC ID, subnet names, and boot volume encryption key from your existing landing zone deployable architecture. For information about finding these values, see [Adding a VSI to your VPC landing zone deployable architecture](https://cloud.ibm.com/docs/secure-infrastructure-vpc?topic=secure-infrastructure-vpc-ext-with-vsi).
1010

1111
![Architecture diagram for adding a VSI to your VPC landing zone deployable architecture](https://raw.githubusercontent.com/terraform-ibm-modules/terraform-ibm-landing-zone/main/reference-architectures/vsi-extension.drawio.svg)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"ibmcloud_api_key": $VALIDATION_APIKEY,
3+
"resource_tags": $TAGS
4+
}

patterns/vsi-extension/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ variable "existing_ssh_key_name" {
3030
variable "ssh_public_key" {
3131
description = "A public SSH key that does not exist in the region where you want to deploy the VSI. The key must be an RSA key with a key size of either 2048 bits or 4096 bits (recommended). [Learn more](https://cloud.ibm.com/docs/vpc?topic=vpc-ssh-keys). To use an existing key, specify a value in the `existing_ssh_key_name` input instead."
3232
type = string
33+
default = null
3334

3435
validation {
3536
error_message = "The public SSH key must be a valid SSH RSA public key."

tests/resources/slz-vpc/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The terraform code in this directory is used by the existing VPC VSI DA extension for catalog validation.

tests/resources/slz-vpc/main.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
##############################################################################
2+
# SLZ VPC
3+
##############################################################################
4+
5+
module "landing_zone" {
6+
source = "../../../patterns/vpc/module"
7+
region = var.region
8+
prefix = var.prefix
9+
tags = var.resource_tags
10+
enable_transit_gateway = false
11+
add_atracker_route = false
12+
}

tests/resources/slz-vpc/outputs.tf

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
##############################################################################
2+
# Outputs
3+
##############################################################################
4+
5+
output "prefix" {
6+
value = var.prefix
7+
description = "Prefix"
8+
}
9+
10+
output "management_vpc_id" {
11+
value = lookup(
12+
[for vpc in module.landing_zone.vpc_data : vpc if vpc.vpc_name == "${var.prefix}-management-vpc"][0],
13+
"vpc_id",
14+
"")
15+
description = "Management VPC ID"
16+
}
17+
18+
output "workload_vpc_id" {
19+
value = lookup(
20+
[for vpc in module.landing_zone.vpc_data : vpc if vpc.vpc_name == "${var.prefix}-workload-vpc"][0],
21+
"vpc_id",
22+
"")
23+
description = "Workload VPC ID"
24+
}
25+
26+
# Parse the VSI KMS Key CRN
27+
locals {
28+
vsi_key_map = lookup(module.landing_zone.key_map, "${var.prefix}-vsi-volume-key", "")
29+
vsi_key_crn = lookup(local.vsi_key_map, "crn", "")
30+
}
31+
32+
output "vsi_kms_key_crn" {
33+
value = local.vsi_key_crn
34+
description = "VSI KMS Key CRN"
35+
}
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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
variable "ibmcloud_api_key" {
2+
type = string
3+
description = "The IBM Cloud API Key"
4+
sensitive = true
5+
}
6+
7+
variable "region" {
8+
type = string
9+
description = "Region to provision all resources created by this example"
10+
default = "us-south"
11+
}
12+
13+
variable "prefix" {
14+
type = string
15+
description = "Prefix to append to all resources created by this example"
16+
default = "slz-vpc"
17+
}
18+
19+
variable "resource_tags" {
20+
type = list(string)
21+
description = "Optional list of tags to be added to created resources"
22+
default = []
23+
}

0 commit comments

Comments
 (0)