Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
30 changes: 30 additions & 0 deletions modules/firstmate/sync/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
terraform {
required_providers {
helm = {
source = "hashicorp/helm"
version = "=2.14.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "=2.3.1"
}
}
}

locals {
url = "${var.baseUrl}/${var.path}"
}

data "http" "sync" {
url = local.url
method = var.method

request_headers = {
Accept = "application/json"
authorization = var.api_key
}
# Optional request body
request_body = var.body
}


4 changes: 4 additions & 0 deletions modules/firstmate/sync/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "status_code" {
description = "The status code of the request"
value = data.http.sync.status_code
}
32 changes: 32 additions & 0 deletions modules/firstmate/sync/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
variable "baseUrl" {
description = "Baseurl of firstmate"
type = string
# default = "https://api.eu.firstmate.cloud/api/v1/sync"
default = "http://localhost:8080/api/v1/tfsync"
}

variable "path" {
description = "path of the request"
type = string
default = "kubernetes-monitoring"
}

variable "method" {
description = "Baseurl of firstmate"
type = string
default = "POST"
}

variable "body" {
description = "body of request"
type = string

}


variable "api_key" {
description = "Firstmate Api key"
type = string
}


14 changes: 13 additions & 1 deletion modules/kubernetes/firstmate-monitoring/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,16 @@ resource "helm_release" "firstmate_monitoring_release" {
name = "permissions.scalingMetrics"
value = var.permissions.scalingMetrics
}
}
}

module "sync" {
source = "git::git@github.com:firstmatecloud/firstmate-terraform-modules.git//modules/firstmate/sync?ref=add-http-call"
depends_on = [helm_release.firstmate_monitoring_release]
api_key = var.api_key
body = jsonencode({
cluster = {
name = var.cluster_name
}
})
path = "kubernetes-monitoring"
}