massdriver-cloud / massdriver-cli

Deprecated. See https://github.com/massdriver-cloud/mass
https://massdriver.cloud
Apache License 2.0
3 stars 2 forks source link

mass app templates new #104

Open coryodaniel opened 2 years ago

coryodaniel commented 2 years ago

Add a command for creating new templates quickly.

schema: draft-07
name: <md .Name md>
description: <md .Description md>
ref: github.com/YOUR_ORG/<md .Ref md>
access: private
type: application

params:
  required:
  - port
  - log_level
  properties:
    port:
      title: Port
      description: "The port number to run on. This is an example value, this could be anything!"
      type: string
    log_level:
      type: string
      title: Log Level
      description: "The log level to log at. This is an example value, this could be anything!"
      enum:
        - error
        - warning
        - info

connections:
  required:
  <md- range $key, $art:= .Connections md>
    - <md $key md>
  <md- end md>
  properties:
  <md- range $key, $art:= .Connections md>
    <md $key md>:
      $ref: <md $art md>
  <md- end md>

ui:
  ui:order:
  - port
  - log_level

app:
  envs:
    LOG_LEVEL: .params.log_level
    PORT: .params.port
  policies: []
    # - .connections.k8s_auth.data.security.iam.subscribe

main.tf

module "application" {
  source  = "github.com/massdriver-cloud/terraform-modules//massdriver-application"
  name    = var.md_metadata.name_prefix
  # service = "function"
  # service = "vm"
  # service = "kubernetes"

  # kubernetes = {
  #   namespace        = var.namespace
  #   cluster_artifact = var.kubernetes_cluster
  # }
}

_providers.tf

terraform {
  required_providers {
    mdxc = {
      source = "massdriver-cloud/mdxc"
    }

    massdriver = {
      source = "massdriver-cloud/massdriver"
    }
  }
}

provider "mdxc" {
  # TODO: configure auth for GCP & Azure
  azure = local.cloud == "azure" ? null : null
  gcp   = local.cloud == "gcp" ? null : null
  aws = local.cloud == "aws" ? {
    region      = var.region
    role_arn    = var.aws_authentication.data.arn
    external_id = var.aws_authentication.data.external_id
  } : null
}
coryodaniel commented 2 years ago

This is uber low priority, i made the base set by hand.