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

Ask for cluster ID instead of name in agents DA #233

Merged
merged 12 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
67 changes: 28 additions & 39 deletions ibm_catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -377,51 +377,40 @@
"key": "namespace"
},
{
"key": "cluster_name"
"key": "cluster_id",
"custom_config": {
"type": "cluster_var",
"grouping": "deployment",
"original_grouping": "deployment"
}
},
{
"key": "cluster_resource_group_id",
"custom_config": {
"type": "resource_group",
"grouping": "deployment",
"original_grouping": "deployment",
"config_constraints": {
"identifier": "rg_id"
}
}
},
{
"key": "access_key"
},
{
"key": "region",
"options": [
{
"displayname": "Dallas (us-south)",
"value": "us-south"
},
{
"displayname": "Frankfurt (eu-de)",
"value": "eu-de"
},
{
"displayname": "London (eu-gb)",
"value": "eu-gb"
},
{
"displayname": "Osaka (jp-osa)",
"value": "jp-osa"
},
{
"displayname": "Sao Paulo (br-sao)",
"value": "br-sao"
},
{
"displayname": "Sydney (au-syd)",
"value": "au-syd"
},
{
"displayname": "Tokyo (jp-tok)",
"value": "jp-tok"
},
{
"displayname": "Toronto (ca-tor)",
"value": "ca-tor"
},
{
"displayname": "Washington (us-east)",
"value": "us-east"
}
]
"type": "string",
"custom_config": {
"type": "region",
"grouping": "deployment",
"original_grouping": "deployment",
"config_constraints": {
"showKinds": [
"region"
]
}
}
},
{
"key": "endpoint_type",
Expand Down
4 changes: 1 addition & 3 deletions solutions/agents/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module "scc_wp_agent" {
source = "terraform-ibm-modules/scc-workload-protection-agent/ibm"
version = "1.3.17"
access_key = var.access_key
cluster_name = var.cluster_name
cluster_name = var.is_vpc_cluster ? data.ibm_container_vpc_cluster.cluster[0].name : data.ibm_container_cluster.cluster[0].name
region = var.region
endpoint_type = var.endpoint_type
name = var.name
Expand Down Expand Up @@ -41,6 +41,4 @@ module "scc_wp_agent" {
cluster_scanner_imagesbomextractor_requests_memory = var.cluster_scanner_imagesbomextractor_requests_memory
cluster_scanner_imagesbomextractor_limits_cpu = var.cluster_scanner_imagesbomextractor_limits_cpu
cluster_scanner_imagesbomextractor_limits_memory = var.cluster_scanner_imagesbomextractor_limits_memory


}
16 changes: 9 additions & 7 deletions solutions/agents/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ provider "ibm" {
}

provider "kubernetes" {
host = data.ibm_container_cluster_config.cluster_config.host
token = data.ibm_container_cluster_config.cluster_config.token
host = data.ibm_container_cluster_config.cluster_config.host
token = data.ibm_container_cluster_config.cluster_config.token
cluster_ca_certificate = data.ibm_container_cluster_config.cluster_config.ca_certificate
}

provider "helm" {
Expand All @@ -22,20 +23,21 @@ provider "helm" {

data "ibm_container_vpc_cluster" "cluster" {
count = var.is_vpc_cluster ? 1 : 0
name = var.cluster_name
name = var.cluster_id
wait_till = var.wait_till
wait_till_timeout = var.wait_till_timeout
}

data "ibm_container_cluster" "cluster" {
count = var.is_vpc_cluster ? 0 : 1
name = var.cluster_name
name = var.cluster_id
wait_till = var.wait_till
wait_till_timeout = var.wait_till_timeout
}

data "ibm_container_cluster_config" "cluster_config" {
cluster_name_id = var.is_vpc_cluster ? data.ibm_container_vpc_cluster.cluster[0].name : data.ibm_container_cluster.cluster[0].name
config_dir = "${path.module}/kubeconfig"
endpoint_type = var.cluster_endpoint_type
cluster_name_id = var.is_vpc_cluster ? data.ibm_container_vpc_cluster.cluster[0].id : data.ibm_container_cluster.cluster[0].id
config_dir = "${path.module}/kubeconfig"
endpoint_type = var.cluster_endpoint_type
resource_group_id = var.cluster_resource_group_id
}
9 changes: 7 additions & 2 deletions solutions/agents/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@ variable "namespace" {
default = "ibm-scc-wp"
}

variable "cluster_name" {
variable "cluster_id" {
type = string
description = "The cluster name to add the Workload Protection agent to."
description = "The cluster ID to add the Workload Protection agent to."
}

variable "cluster_resource_group_id" {
type = string
description = "The resource group ID of the cluster."
}

variable "access_key" {
Expand Down