Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
Updates inputs and outputs to match other service modules (#24)
Browse files Browse the repository at this point in the history
- Adds label to input
- Adds crn, service, and label to output

Signed-off-by: Sean Sundberg <seansund@us.ibm.com>
  • Loading branch information
seansund committed May 11, 2021
1 parent 9b09de8 commit ebd1f73
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 8 deletions.
7 changes: 4 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
locals {
tmp_dir = "${path.cwd}/.tmp"
name_prefix = var.name_prefix != "" ? var.name_prefix : var.resource_group_name
name = var.name != "" ? var.name : "${replace(local.name_prefix, "/[^a-zA-Z0-9_\\-\\.]/", "")}-sysdig"
name = var.name != "" ? var.name : "${replace(local.name_prefix, "/[^a-zA-Z0-9_\\-\\.]/", "")}-${var.label}"
key_name = "${local.name}-key"
role = "Manager"
service = "sysdig-monitor"
}
resource null_resource print_names {
Expand All @@ -24,7 +25,7 @@ resource ibm_resource_instance sysdig_instance {
count = var.provision ? 1 : 0

name = local.name
service = "sysdig-monitor"
service = local.service
plan = var.plan
location = var.region
resource_group_id = data.ibm_resource_group.tools_resource_group.id
Expand All @@ -41,7 +42,7 @@ data ibm_resource_instance sysdig_instance {
depends_on = [ibm_resource_instance.sysdig_instance]

name = local.name
service = "sysdig-monitor"
service = local.service
resource_group_id = data.ibm_resource_group.tools_resource_group.id
location = var.region
}
Expand Down
33 changes: 28 additions & 5 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,17 +1,40 @@
output "id" {
value = data.ibm_resource_instance.sysdig_instance.id
description = "The id of the provisioned Sysdig instance."
description = "The id of the provisioned instance."
}

output "guid" {
value = data.ibm_resource_instance.sysdig_instance.guid
description = "The id of the provisioned instance."
}

output "name" {
value = local.name
depends_on = [ibm_resource_instance.sysdig_instance]
description = "The name of the provisioned Sysdig instance."
description = "The name of the provisioned instance."
}

output "guid" {
value = data.ibm_resource_instance.sysdig_instance.guid
description = "The id of the provisioned Sysdig instance."
output "crn" {
description = "The id of the provisioned instance"
value = data.ibm_resource_instance.sysdig_instance.id
}

output "location" {
description = "The location of the provisioned instance"
value = var.region
depends_on = [data.ibm_resource_instance.sysdig_instance]
}

output "service" {
description = "The service name of the provisioned instance"
value = local.service
depends_on = [data.ibm_resource_instance.sysdig_instance]
}

output "label" {
description = "The label for the instance"
value = var.label
depends_on = [data.ibm_resource_instance.sysdig_instance]
}

output "key_name" {
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ variable "ibmcloud_api_key" {
type = string
description = "The IBM Cloud api token"
}

variable "label" {
type = string
description = "The label used to build the resource name if not provided."
default = "monitoring"
}

0 comments on commit ebd1f73

Please sign in to comment.