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
26 changes: 26 additions & 0 deletions artifact-definitions/landing-zone.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$md": {
"label": "Landing Zone",
"name": "landing-zone",
"ui": {
"connectionOrientation": "environmentDefault",
"environmentDefaultGroup": "Landing Zones"
}
},
"$schema": "http://json-schema.org/draft-07/schema",
"description": "Example landing zone artifact - customize this schema to match your landing zone outputs",
"properties": {
"project_id": {
"type": "string",
"description": "The ID of the project"
},
"service_account_id": {
"type": "string",
"description": "The ID of the service account"
},
"network_id": {
"type": "string",
"description": "The ID of the network"
}
}
}
4 changes: 3 additions & 1 deletion bundles/application/massdriver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,16 @@ connections:
required:
- network
- database
# - bucket
- zone
properties:
network:
$ref: network
database:
$ref: postgres
bucket:
$ref: bucket
zone:
$ref: landing-zone

artifacts:
required: []
Expand Down
2 changes: 2 additions & 0 deletions bundles/application/operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
templating: mustache
---

Hello from {{connections.zone.project_id}} Zone!

# 🚀 Application Bundle Runbook

> **Templating**: This runbook supports mustache templating.
Expand Down
5 changes: 5 additions & 0 deletions bundles/application/src/_massdriver_variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,8 @@ variable "port" {
variable "replicas" {
type = number
}
// Auto-generated variable declarations from massdriver.yaml
variable "zone" {
type = any
default = null
}
5 changes: 3 additions & 2 deletions bundles/application/src/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ terraform {
}

locals {
has_database = var.database != null
has_bucket = var.bucket != null
has_database = var.database != null
has_bucket = var.bucket != null
zone_project_id = var.zone.project_id
}

resource "random_pet" "main" {
Expand Down
17 changes: 17 additions & 0 deletions bundles/landing-zone/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions bundles/landing-zone/massdriver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
schema: draft-07
name: landing-zone
description: "Landing Zones"
source_url: https://github.com/YOUR_ORG/massdriver-catalog/tree/main/bundles/bucket
version: 0.0.0

params:
properties:
project_name:
type: string

connections:
required: []
properties: {}

artifacts:
required:
- zone
properties:
zone:
$ref: landing-zone
title: Landing Zone

steps:
- path: src
provisioner: opentofu:1.10

ui:
ui:order:
- "*"
5 changes: 5 additions & 0 deletions bundles/landing-zone/operator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
templating: mustache
---

# Landing Zone TODO
28 changes: 28 additions & 0 deletions bundles/landing-zone/src/_massdriver_variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Auto-generated variable declarations from massdriver.yaml
variable "md_metadata" {
type = object({
default_tags = object({
managed-by = string
md-manifest = string
md-package = string
md-project = string
md-target = string
})
deployment = object({
id = string
})
name_prefix = string
observability = object({
alarm_webhook_url = string
})
package = object({
created_at = string
deployment_enqueued_at = string
previous_status = string
updated_at = string
})
target = object({
contact_email = string
})
})
}
9 changes: 9 additions & 0 deletions bundles/landing-zone/src/artifacts.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "massdriver_artifact" "zone" {
field = "zone"
name = "Zone ${var.md_metadata.name_prefix}"
artifact = jsonencode({
project_id = local.project_id
network_id = local.network_id
service_account_id = local.service_account_id
})
}
44 changes: 44 additions & 0 deletions bundles/landing-zone/src/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
terraform {
required_version = ">= 1.0"
required_providers {
random = {
source = "hashicorp/random"
version = "~> 3.0"
}
massdriver = {
source = "massdriver-cloud/massdriver"
version = "~> 1.3"
}
}
}

variable "project_name" {
type = string
}

resource "random_pet" "project" {
keepers = {
name = var.project_name
}
}


resource "random_pet" "network" {
keepers = {
name = var.project_name
}
}


resource "random_pet" "service_account" {
keepers = {
name = var.project_name
}
}


locals {
project_id = random_pet.project.id
network_id = random_pet.network.id
service_account_id = random_pet.service_account.id
}