Skip to content

Commit 11fa840

Browse files
authored
Merge pull request #57 from OpsLevel/db/add-service-relationship
add module for opslevel_service_relationship
2 parents 598039e + c1bfc30 commit 11fa840

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

modules/hierarchy/system/main.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ resource "opslevel_system" "this" {
88
owner = local.owner
99
}
1010

11-
# TODO: This would be a really clean way to ensure service.parent is set via this module
12-
#resource "opslevel_service_relationship" "this" {
13-
# for_each = { for service in var.services : service => service }
14-
# system = opslevel_system.this.id
15-
# service = each.value
16-
#}
11+
resource "opslevel_service_relationship" "this" {
12+
for_each = { for service in var.services : service => service }
13+
14+
system = opslevel_system.this.id
15+
service = each.value
16+
}

modules/service/relationship/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
resource "opslevel_service_relationship" "this" {
2+
service = var.service
3+
system = var.system
4+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
output "this" {
2+
value = opslevel_service_relationship.this
3+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
variable "service" {
2+
type = string
3+
description = "The id or alias of the service."
4+
}
5+
6+
variable "system" {
7+
type = string
8+
description = "The id or alias of the system."
9+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../versions.tf

0 commit comments

Comments
 (0)