Skip to content
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

feat: initial commit for DA #915

Merged
merged 56 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
d13a7c9
feat: initial commit
Feb 14, 2025
17888e3
Merge branch 'main' into vpc-da-12217
Feb 14, 2025
0635ef8
update defalt value of resource group
Feb 17, 2025
af8271a
update code
Feb 17, 2025
c718316
Merge branch 'main' into vpc-da-12217
maheshwarishikha Feb 17, 2025
41eaba0
update code
Feb 27, 2025
6386636
Merge branch 'main' into vpc-da-12217
maheshwarishikha Feb 27, 2025
faf01ac
add validations
Feb 27, 2025
cc592f7
create public_gateway object and added validation
Mar 4, 2025
a00fc30
Merge branch 'main' into vpc-da-12217
maheshwarishikha Mar 4, 2025
c083207
added vpn gateway feature
Mar 6, 2025
a93760f
Merge branch 'main' into vpc-da-12217
maheshwarishikha Mar 10, 2025
e5cc87a
update outputs
Mar 10, 2025
b5072de
Merge branch 'main' into vpc-da-12217
maheshwarishikha Mar 10, 2025
3ffb859
updated code, variables and outputs
Mar 12, 2025
fa3e9db
update default ACLs and add VPE gateway support
Mar 13, 2025
35d41f8
add outputs
Mar 13, 2025
ab40395
update code and default values
Mar 13, 2025
42519bc
add tests
Mar 17, 2025
fedcc94
Merge branch 'main' into vpc-da-12217
maheshwarishikha Mar 17, 2025
bdf5d2f
add rules for cos bucket
Mar 17, 2025
eac159b
update code
Mar 17, 2025
ca57c89
added ibm_catalog.json and reference architecture diagram for VPC DA.…
Khuzaima05 Mar 17, 2025
b58a2d4
add private path output
Aashiq-J Mar 18, 2025
d3a99a0
update ibm_catalog
Mar 18, 2025
eb53ebd
update code and SKIP UPGRADE TEST
Mar 18, 2025
3fec4e0
update code to support prefix as empty string and address review comm…
Mar 19, 2025
00cb776
add subnet_tags and schematics test
Mar 19, 2025
13aca54
update vpn_gateway code
Mar 19, 2025
3998e0c
DA_doc (#933)
aatreyee2506 Mar 19, 2025
20a1de4
Merge branch 'main' into vpc-da-12217
maheshwarishikha Mar 20, 2025
d5fcd0d
add DA-docs
Mar 20, 2025
4e3b12e
update filename
Mar 20, 2025
d19bef0
update reference architecture
Mar 21, 2025
638c6e0
update vpn gateway inputs and name of vpc
Mar 21, 2025
cde65bb
update code
Mar 21, 2025
2fab799
DA readme
Mar 21, 2025
a0d11a2
fix readme
Mar 22, 2025
76120b6
updated rf arch
Mar 24, 2025
1603610
update boolean variables
Mar 24, 2025
a34cd1e
Merge branch 'main' into vpc-da-12217
maheshwarishikha Mar 24, 2025
ef0498a
catalog changes
Mar 24, 2025
f3dae55
updated catalog
Mar 24, 2025
7ccf773
update default values for cos bucket
Mar 24, 2025
de7dd43
catalog varaible sequence changes
Mar 24, 2025
8a15807
updated tags variable
Mar 24, 2025
b281752
updated boolean variables in catalog
Mar 24, 2025
7577fea
cross-account kms key support
Mar 25, 2025
324a819
updated tags
Mar 25, 2025
577a223
resolve catalog review comments
Mar 25, 2025
3742a09
resolve review comments
Mar 25, 2025
3bde6be
updated long description
Mar 25, 2025
0de49c3
Merge branch 'main' into vpc-da-12217
maheshwarishikha Mar 26, 2025
cb581ba
Update .releaserc
ocofaigh Mar 26, 2025
23c9d30
Update .catalog-onboard-pipeline.yaml
ocofaigh Mar 26, 2025
521e61f
Update ibm_catalog.json
ocofaigh Mar 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions solutions/simple/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# IBM VPC deployable architecture

This deployable architecture supports provisioning the following resources:

- A new resource group if one is not passed in.
- A VPC.


![vpc-deployable-architecture](../../reference-architecture/vpc-quickstart-da.svg)

:exclamation: **Important:** This solution is not intended to be called by other modules because it contains a provider configuration and is not compatible with the `for_each`, `count`, and `depends_on` arguments. For more information, see [Providers Within Modules](https://developer.hashicorp.com/terraform/language/modules/develop/providers).
6 changes: 6 additions & 0 deletions solutions/simple/catalogValidationValues.json.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"ibmcloud_api_key": $VALIDATION_APIKEY,
"region": "us-south",
"resource_tags": $TAGS,
"resource_group_name": $PREFIX
}
128 changes: 128 additions & 0 deletions solutions/simple/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
locals {
prefix = var.prefix != null ? (var.prefix != "" ? var.prefix : null) : null
}

##############################################################################
# Resource Group
##############################################################################

module "resource_group" {
source = "terraform-ibm-modules/resource-group/ibm"
version = "1.1.6"
resource_group_name = var.use_existing_resource_group == false ? try("${local.prefix}-${var.resource_group_name}", var.resource_group_name) : null
existing_resource_group_name = var.use_existing_resource_group == true ? var.resource_group_name : null
}

#############################################################################
# COS Bucket for VPC flow logs
#############################################################################

# parse COS details from the existing COS instance CRN
module "existing_cos_crn_parser" {
count = var.existing_cos_instance_crn != null ? 1 : 0
source = "terraform-ibm-modules/common-utilities/ibm//modules/crn-parser"
version = "1.1.0"
crn = var.existing_cos_instance_crn
}

locals {
bucket_name = try("${local.prefix}-${var.cos_bucket_name}", var.cos_bucket_name)

bucket_config = [{
access_tags = var.access_tags
bucket_name = local.bucket_name
kms_encryption_enabled = var.kms_encryption_enabled_bucket
kms_guid = var.kms_encryption_enabled_bucket ? module.existing_kms_crn_parser[0].service_instance : null
kms_key_crn = var.kms_encryption_enabled_bucket ? var.existing_kms_instance_crn : null
skip_iam_authorization_policy = var.skip_cos_kms_auth_policy
management_endpoint_type = var.management_endpoint_type_for_bucket
storage_class = var.cos_bucket_class
resource_instance_id = var.existing_cos_instance_crn
region_location = var.region
force_delete = true
}]
}

module "cos_buckets" {
count = var.enable_vpc_flow_logs ? 1 : 0
source = "terraform-ibm-modules/cos/ibm//modules/buckets"
version = "8.19.2"
bucket_configs = local.bucket_config
}

#######################################################################################################################
# KMS Key
#######################################################################################################################

# parse KMS details from the existing KMS instance CRN
module "existing_kms_crn_parser" {
count = var.kms_encryption_enabled_bucket && var.existing_kms_instance_crn != null ? 1 : 0
source = "terraform-ibm-modules/common-utilities/ibm//modules/crn-parser"
version = "1.1.0"
crn = var.existing_kms_instance_crn
}

locals {
# fetch KMS region from existing_kms_instance_crn if KMS resources are required
kms_region = var.kms_encryption_enabled_bucket && var.existing_kms_instance_crn != null ? module.existing_kms_crn_parser[0].region : null

kms_key_ring_name = try("${var.prefix}-${var.kms_key_ring_name}", var.kms_key_ring_name)
kms_key_name = try("${var.prefix}-${var.kms_key_name}", var.kms_key_name)
}

module "kms" {
count = (var.enable_vpc_flow_logs && var.kms_encryption_enabled_bucket && var.existing_kms_instance_crn != null) ? 1 : 0 # no need to create any KMS resources if not passing an existing KMS CRN
source = "terraform-ibm-modules/kms-all-inclusive/ibm"
version = "4.19.5"
create_key_protect_instance = false
region = local.kms_region
existing_kms_instance_crn = var.existing_kms_instance_crn
key_ring_endpoint_type = var.kms_endpoint_type
key_endpoint_type = var.kms_endpoint_type
keys = [
{
key_ring_name = local.kms_key_ring_name
existing_key_ring = false
force_delete_key_ring = true
keys = [
{
key_name = local.kms_key_name
standard_key = false
rotation_interval_month = 3
dual_auth_delete_enabled = false
force_delete = true
}
]
}
]
}

#############################################################################
# VPC
#############################################################################

locals {
# //TO DO
# to create use_public_gateways object
}

module "vpc" {
source = "../../"
resource_group_id = module.resource_group.resource_group_id
region = var.region
create_vpc = true
name = var.vpc_name
prefix = local.prefix
tags = var.resource_tags
access_tags = var.access_tags
subnets = var.subnets
default_network_acl_name = var.default_network_acl_name
default_security_group_name = var.default_security_group_name
default_routing_table_name = var.default_routing_table_name
network_acls = var.network_acls
# use_public_gateways = local.public_gateway_object
enable_vpc_flow_logs = var.enable_vpc_flow_logs
create_authorization_policy_vpc_to_cos = var.create_authorization_policy_vpc_to_cos
existing_cos_instance_guid = var.enable_vpc_flow_logs ? module.existing_cos_crn_parser[0].service_instance : null
existing_storage_bucket_name = var.enable_vpc_flow_logs ? module.cos_buckets[0].buckets[0].bucket_name : null
}
36 changes: 36 additions & 0 deletions solutions/simple/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
##############################################################################
# VPC
##############################################################################

output "vpc_name" {
description = "Name of VPC created"
value = module.vpc.vpc_name
}

output "vpc_id" {
description = "ID of VPC created"
value = module.vpc.vpc_id
}

output "vpc_crn" {
description = "CRN of VPC created"
value = module.vpc.vpc_crn
}

##############################################################################
# Public Gateways
##############################################################################

output "public_gateways" {
description = "Map of public gateways by zone"
value = module.vpc.public_gateways
}

##############################################################################
# VPC flow logs
##############################################################################

output "vpc_flow_logs" {
description = "Details of VPC flow logs collector"
value = module.vpc.vpc_flow_logs
}
9 changes: 9 additions & 0 deletions solutions/simple/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
########################################################################################################################
# Provider config
########################################################################################################################

provider "ibm" {
ibmcloud_api_key = var.ibmcloud_api_key
region = var.region
visibility = var.provider_visibility
}
Loading