Skip to content
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
0d9e036
feat: secrets manager integration for ingress
Apr 30, 2025
5a2e79e
addressed review comments
Apr 30, 2025
ffb839d
made nullable=false for enable_secrets_manager var
Apr 30, 2025
9067f54
addressed review comments
May 2, 2025
029eee2
addressed some more review comments
May 2, 2025
0dc54a8
added secret group creation in DA and corrected variable description …
May 5, 2025
2279b23
Merge branch 'main' into sm-integration
vkuma17 May 5, 2025
db9e874
modified test
May 5, 2025
3af3cb6
Merge branch 'sm-integration' of github.com:terraform-ibm-modules/ter…
May 5, 2025
bbd2724
modified tc
May 5, 2025
2f99616
modified common dev assets
May 5, 2025
6298c9a
wait for auth policy
May 5, 2025
2ac8c6f
added auth policy for roks sm integration
May 6, 2025
157483f
addressed review comments
May 6, 2025
bcb82dd
added script to delete secrets
May 10, 2025
a848d74
modified script
May 11, 2025
b4f1739
modified script
May 11, 2025
d15b0c8
modified script
May 11, 2025
37e27a9
Merge branch 'main' into sm-integration
vkuma17 May 12, 2025
d8ede3b
modified script
May 12, 2025
6d7eade
made scripts folder
May 12, 2025
6053a74
Merge branch 'main' into sm-integration
vkuma17 May 12, 2025
cea8223
changed executable permission
May 12, 2025
d42025c
Merge branch 'sm-integration' of github.com:terraform-ibm-modules/ter…
May 12, 2025
705d144
used bash interpreter
May 12, 2025
f8547e6
Merge branch 'main' into sm-integration
vkuma17 May 12, 2025
f1cf12d
added scripts in tarpattern
May 12, 2025
c64bb20
Merge branch 'sm-integration' of github.com:terraform-ibm-modules/ter…
May 12, 2025
4017066
addressed review comments
May 15, 2025
fa34a4a
Merge branch 'main' into sm-integration
vkuma17 May 15, 2025
387799a
precommit issue fix
May 15, 2025
c68d99d
Merge branch 'main' into sm-integration
vkuma17 May 17, 2025
6e4225b
fixed script
May 18, 2025
929f760
Merge branch 'sm-integration' of github.com:terraform-ibm-modules/ter…
May 18, 2025
74b1d8c
Merge branch 'main' into sm-integration
vkuma17 May 18, 2025
d940b90
Merge branch 'main' into sm-integration
vkuma17 May 19, 2025
d90bef7
Update delete_secrets.sh
vkuma17 May 19, 2025
efa8663
Update delete_secrets.sh
vkuma17 May 19, 2025
62edd7b
Update delete_secrets.sh
vkuma17 May 19, 2025
f24674c
addressed review comments
May 19, 2025
95db13b
Merge branch 'main' into sm-integration
ocofaigh May 19, 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
40 changes: 25 additions & 15 deletions README.md

Large diffs are not rendered by default.

27 changes: 25 additions & 2 deletions ibm_catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,21 @@
},
{
"key": "cbr_rules"
},
{
"key": "enable_secrets_manager_integration"
},
{
"key": "existing_secrets_manager_instance_crn"
},
{
"key": "secrets_manager_secret_group_id"
},
{
"key": "secrets_manager_endpoint_type"
},
{
"key": "skip_ocp_secrets_manager_iam_auth_policy"
}
],
"dependencies": [
Expand Down Expand Up @@ -561,14 +576,22 @@
"reference_version": true
},
{
"dependency_input": "resource_group_name",
"version_input": "existing_resource_group_name",
"dependency_input": "secrets_manager_endpoint_type",
"version_input": "secrets_manager_endpoint_type",
"reference_version": true
},
{
"dependency_input": "use_existing_resource_group",
"value": true,
"reference_version": true
},
{
"dependency_output": "secrets_manager_crn",
"version_input": "existing_secrets_manager_instance_crn"
},
{
"version_input": "enable_secrets_manager_integration",
"value": true
}
]
}
Expand Down
37 changes: 37 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -719,3 +719,40 @@ module "cbr_rule" {
}]
operations = var.cbr_rules[count.index].operations == null ? local.default_operations : var.cbr_rules[count.index].operations
}

##############################################################
# Ingress Secrets Manager Integration
##############################################################

module "existing_secrets_manager_instance_parser" {
count = var.enable_secrets_manager_integration ? 1 : 0
source = "terraform-ibm-modules/common-utilities/ibm//modules/crn-parser"
version = "1.1.0"
crn = var.existing_secrets_manager_instance_crn
}

resource "ibm_iam_authorization_policy" "ocp_secrets_manager_iam_auth_policy" {
count = var.enable_secrets_manager_integration && !var.skip_ocp_secrets_manager_iam_auth_policy ? 1 : 0
depends_on = [ibm_container_vpc_cluster.cluster, ibm_container_vpc_cluster.autoscaling_cluster, ibm_container_vpc_worker_pool.pool, ibm_container_vpc_worker_pool.autoscaling_pool]
source_service_name = "containers-kubernetes"
source_resource_instance_id = local.cluster_id
target_service_name = "secrets-manager"
target_resource_instance_id = module.existing_secrets_manager_instance_parser[0].service_instance
roles = ["Manager"]
}

resource "time_sleep" "wait_for_auth_policy" {
count = var.enable_secrets_manager_integration ? 1 : 0
depends_on = [ibm_iam_authorization_policy.ocp_secrets_manager_iam_auth_policy[0]]
create_duration = "30s"
}


resource "ibm_container_ingress_instance" "instance" {
count = var.enable_secrets_manager_integration ? 1 : 0
depends_on = [time_sleep.wait_for_auth_policy]
cluster = var.cluster_name
instance_crn = var.existing_secrets_manager_instance_crn
is_default = true
secret_group_id = var.secrets_manager_secret_group_id
}
13 changes: 9 additions & 4 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
##############################################################################

output "cluster_id" {
description = "ID of cluster created"
description = "ID of the cluster"
value = var.ignore_worker_pool_size_changes ? ibm_container_vpc_cluster.autoscaling_cluster[0].id : ibm_container_vpc_cluster.cluster[0].id
depends_on = [null_resource.confirm_network_healthy]
}

output "cluster_name" {
description = "Name of the created cluster"
description = "Name of the cluster"
value = var.ignore_worker_pool_size_changes ? ibm_container_vpc_cluster.autoscaling_cluster[0].name : ibm_container_vpc_cluster.cluster[0].name
depends_on = [null_resource.confirm_network_healthy]
}

output "cluster_crn" {
description = "CRN for the created cluster"
description = "CRN of the cluster"
value = var.ignore_worker_pool_size_changes ? ibm_container_vpc_cluster.autoscaling_cluster[0].crn : ibm_container_vpc_cluster.cluster[0].crn
depends_on = [null_resource.confirm_network_healthy]
}
Expand All @@ -41,7 +41,7 @@ output "vpc_id" {
}

output "region" {
description = "Region cluster is deployed in"
description = "Region that the cluster is deployed to"
value = var.region
}

Expand Down Expand Up @@ -104,3 +104,8 @@ output "registry_vpe" {
description = "Info about the registry VPE, if it exists. For more info about schema, see https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/is_virtual_endpoint_gateway"
value = local.registry_vpe_id
}

output "secrets_manager_integration_config" {
description = "Information about the Secrets Manager instance that is used to store the Ingress certificates."
value = var.enable_secrets_manager_integration ? ibm_container_ingress_instance.instance[0] : null
}
Loading