Skip to content

Commit

Permalink
Merge pull request #57 from OpsLevel/db/add-service-relationship
Browse files Browse the repository at this point in the history
add module for opslevel_service_relationship
  • Loading branch information
davidbloss authored Dec 23, 2024
2 parents 598039e + c1bfc30 commit 11fa840
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
12 changes: 6 additions & 6 deletions modules/hierarchy/system/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ resource "opslevel_system" "this" {
owner = local.owner
}

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

system = opslevel_system.this.id
service = each.value
}
4 changes: 4 additions & 0 deletions modules/service/relationship/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource "opslevel_service_relationship" "this" {
service = var.service
system = var.system
}
3 changes: 3 additions & 0 deletions modules/service/relationship/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "this" {
value = opslevel_service_relationship.this
}
9 changes: 9 additions & 0 deletions modules/service/relationship/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
variable "service" {
type = string
description = "The id or alias of the service."
}

variable "system" {
type = string
description = "The id or alias of the system."
}
1 change: 1 addition & 0 deletions modules/service/relationship/versions.tf

0 comments on commit 11fa840

Please sign in to comment.