Skip to content
Merged
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
5 changes: 5 additions & 0 deletions lambda/specs/install/backend.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
terraform {
backend "s3" {
key = "lambda/install/terraform.tfstate"
}
}
77 changes: 77 additions & 0 deletions lambda/specs/install/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
################################################################################
# Scope Definition
# Registers the service specification, scope type, and action specs in nullplatform.
################################################################################

module "scope_definition" {
source = "git::https://github.com/nullplatform/tofu-modules.git//nullplatform/scope_definition?ref=v6.19.1"

nrn = var.nrn
np_api_key = var.np_api_key

service_path = var.service_path

repository_service_spec = var.github_raw_url
repository_service_spec_branch = var.github_branch
repository_scope_template = var.github_raw_url
repository_scope_template_branch = var.github_branch
repository_action_templates = var.github_raw_url
repository_action_templates_branch = var.github_branch

repo_path = var.repo_path

service_spec_name = var.service_spec_name
service_spec_description = var.service_spec_description

action_spec_names = [
"adjust-provisioned-concurrency",
"adjust-reserved-concurrency",
"create-scope",
"delete-deployment",
"delete-scope",
"diagnose-deployment",
"diagnose-scope",
"finalize-blue-green",
"invoke",
"rollback-deployment",
"start-blue-green",
"start-initial",
"switch-traffic",
"update-scope",
]

external_metrics_provider = var.external_metrics_provider
external_logging_provider = var.external_logging_provider

create_scope_configuration = true
}

################################################################################
# Scope Definition Agent Association
# Creates the notification channel that connects nullplatform events to the agent.
################################################################################

module "scope_definition_agent_association" {
source = "git::https://github.com/nullplatform/tofu-modules.git//nullplatform/scope_definition_agent_association?ref=v6.19.1"

nrn = var.nrn
api_key = var.np_api_key

# description = "Notification channel for AWS Lambda scope definition"

scope_specification_id = module.scope_definition.service_specification_id
scope_specification_slug = module.scope_definition.service_slug

service_path = var.service_path

repository_notification_channel = var.github_raw_url
repository_notification_channel_branch = var.github_branch

repo_path = var.repo_path

tags_selectors = var.tags_selectors

enabled_override = var.overrides_enabled
override_repo_path = var.overrides_repo_path
overrides_service_path = var.overrides_service_path
}
24 changes: 24 additions & 0 deletions lambda/specs/install/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
terraform {
required_providers {
nullplatform = {
source = "nullplatform/nullplatform"
version = "0.0.87, < 0.1.0"
}
http = {
source = "hashicorp/http"
version = "~> 3.0"
}
external = {
source = "hashicorp/external"
version = "~> 2.3"
}
null = {
source = "hashicorp/null"
version = "~> 3.2"
}
}
}

provider "nullplatform" {
api_key = var.np_api_key
}
42 changes: 42 additions & 0 deletions lambda/specs/install/terraform.tfvars.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copy this file to terraform.tfvars and fill in the values.
# terraform.tfvars is gitignored — never commit secrets.

################################################################################
# Required
################################################################################

nrn = "organization:account"
np_api_key = "your-nullplatform-api-key"

tags_selectors = {
environment = "production"
}

################################################################################
# Repository (override if using a fork or private mirror)
################################################################################

# github_raw_url = "https://raw.githubusercontent.com/nullplatform/scopes-lambda/refs/heads"
# github_branch = "main"

################################################################################
# Agent
################################################################################

# repo_path = "/root/.np/nullplatform/scopes-lambda"

################################################################################
# Scope Definition (override to customize the display name)
################################################################################

# service_spec_name = "AWS Lambda"
# service_spec_description = "AWS Lambda functions managed by nullplatform"
# service_path = "lambda"

################################################################################
# Overrides (optional — appends --overrides-path to the agent cmdline)
################################################################################

# overrides_enabled = true
# overrides_repo_path = "/root/.np/nullplatform/scopes-networking"
# overrides_service_path = "/lambda"
97 changes: 97 additions & 0 deletions lambda/specs/install/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
################################################################################
# Required
################################################################################

variable "nrn" {
description = "Nullplatform Resource Name (organization:account format)"
type = string
}

variable "np_api_key" {
description = "Nullplatform API key for authentication"
type = string
sensitive = true
}

variable "tags_selectors" {
description = "Map of tags used to select the agent that will handle this scope's notification channel"
type = map(string)
}

################################################################################
# Repository
################################################################################

variable "github_raw_url" {
description = "Base URL for fetching raw files from GitHub (without trailing slash)"
type = string
default = "https://raw.githubusercontent.com/nullplatform/scopes-lambda/refs/heads"
}

variable "github_branch" {
description = "Git branch to use when fetching spec templates"
type = string
default = "main"
}

variable "repo_path" {
description = "Local path where the scopes-lambda repository is cloned on the agent"
type = string
default = "/root/.np/nullplatform/scopes-lambda"
}

################################################################################
# Scope Definition
################################################################################

variable "service_spec_name" {
description = "Display name for the scope type in nullplatform"
type = string
default = "AWS Lambda"
}

variable "service_spec_description" {
description = "Description of the scope type"
type = string
default = "AWS Lambda functions managed by nullplatform"
}

variable "external_metrics_provider" {
description = "Name of the external metrics provider"
type = string
default = "externalmetrics"
}

variable "external_logging_provider" {
description = "Name of the external logging provider"
type = string
default = "external"
}

variable "service_path" {
description = "Path to the spec definition"
type = string
default = "lambda"
}

################################################################################
# Overrides
################################################################################

variable "overrides_enabled" {
description = "Append --overrides-path to the agent cmdline for local config overrides"
type = bool
default = false
}

variable "overrides_repo_path" {
description = "Base path of the overrides repository on the agent (e.g. /root/.np/nullplatform/scopes-networking)"
type = string
default = null
}

variable "overrides_service_path" {
description = "Service subfolder within the overrides repository (e.g. /lambda)"
type = string
default = null
}