mirror of
https://github.com/FlipsideCrypto/convox.git
synced 2026-02-06 10:56:56 +00:00
local: make platform detection a module (#69)
This commit is contained in:
parent
2e7b2de757
commit
a3bf903f0d
27
terraform/platform/main.tf
Normal file
27
terraform/platform/main.tf
Normal file
@ -0,0 +1,27 @@
|
||||
provider "local" {
|
||||
version = "~> 1.4"
|
||||
}
|
||||
|
||||
provider "null" {
|
||||
version = "~> 2.1"
|
||||
}
|
||||
|
||||
locals {
|
||||
filename = pathexpand("/tmp/convox.platform")
|
||||
}
|
||||
|
||||
resource "null_resource" "platform" {
|
||||
triggers = {
|
||||
hash = fileexists(local.filename) ? filebase64(local.filename) : "none"
|
||||
}
|
||||
|
||||
provisioner "local-exec" {
|
||||
command = "mkdir -p ${dirname(local.filename)} && uname -s > ${local.filename}"
|
||||
}
|
||||
}
|
||||
|
||||
data "local_file" "platform" {
|
||||
depends_on = [null_resource.platform]
|
||||
|
||||
filename = local.filename
|
||||
}
|
||||
3
terraform/platform/outputs.tf
Normal file
3
terraform/platform/outputs.tf
Normal file
@ -0,0 +1,3 @@
|
||||
output "name" {
|
||||
value = data.local_file.platform.content
|
||||
}
|
||||
@ -10,10 +10,6 @@ provider "kubernetes" {
|
||||
version = "~> 1.10"
|
||||
}
|
||||
|
||||
locals {
|
||||
platform_filename = "/tmp/convox.platform"
|
||||
}
|
||||
|
||||
data "http" "releases" {
|
||||
url = "https://api.github.com/repos/convox/convox/releases"
|
||||
}
|
||||
@ -23,16 +19,8 @@ locals {
|
||||
release = coalesce(var.release, local.current)
|
||||
}
|
||||
|
||||
resource "null_resource" "platform" {
|
||||
provisioner "local-exec" {
|
||||
command = "uname -s > ${local.platform_filename}"
|
||||
}
|
||||
}
|
||||
|
||||
data "local_file" "platform" {
|
||||
depends_on = [null_resource.platform]
|
||||
|
||||
filename = local.platform_filename
|
||||
module "platform" {
|
||||
source = "../../platform"
|
||||
}
|
||||
|
||||
module "rack" {
|
||||
@ -43,6 +31,6 @@ module "rack" {
|
||||
}
|
||||
|
||||
name = var.name
|
||||
platform = trimspace(data.local_file.platform.content)
|
||||
platform = module.platform.name
|
||||
release = local.release
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user