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
Binary file added modules/meshstack/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions modules/meshstack/logo.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 modules/meshstack/payment-method/buildingblock/APP_TEAM_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# meshStack Payment Method

## Description
This building block provides a payment method for a specific workspace in meshStack. It allows teams to manage budgets and track spending across their cloud resources by assigning payment methods with defined amounts.

## Usage Motivation
This building block is for application teams managing workloads across multiple cloud platforms who need centralized cost control. Configuring a payment method enables teams to allocate budgets per workspace and ensure financial accountability.

## Usage Examples
- A development team creates a payment method with a budget of $10,000 for their workspace to control cloud spending.
- A team launching a new project sets up a payment method with an expiration date to align with their project timeline.
- An operations team assigns a payment method with custom tags to categorize and track spending by department or cost center.

## Shared Responsibility

| Responsibility | Platform Team | Application Team |
|------------------------|--------------|----------------|
| Creating and maintaining automation for payment methods | ✅ | ❌ |
| Provisioning payment methods for workspaces | ✅ | ❌ |
| Configuring the budget amount | ❌ | ✅ |
| Managing expiration dates | ❌ | ✅ |
| Applying tags for cost tracking | ❌ | ✅ |
| Monitoring spending against the payment method | ❌ | ✅ |

## Recommendations for Setting the Right Budget
To define an effective payment method budget:
- **Baseline your spending**: Review historical costs across all platforms to determine a reasonable budget.
- **Add buffer**: Include a buffer (10-20%) for unexpected usage spikes.
- **Set expiration dates**: For temporary projects, set expiration dates to automatically clean up unused payment methods.
- **Use tags effectively**: Apply consistent tags to enable better cost tracking and reporting across your organization.
95 changes: 95 additions & 0 deletions modules/meshstack/payment-method/buildingblock/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
name: meshStack Payment Method
supportedPlatforms:
- meshstack
description: |
Creates a new meshStack Payment Method for a Workspace
---
# meshStack Payment Method Building Block

This Terraform module creates a payment method for a specific workspace in meshStack.

## Features
- Create payment methods with configurable budgets
- Optional expiration dates
- Flexible tagging support

## Usage

```hcl
module "payment_method" {
source = "./modules/meshstack/payment-method/buildingblock"

payment_method_name = "dev-team-budget"
workspace_id = "workspace-abc123"
amount = 10000
expiration_date = "2025-12-31T23:59:59Z"

tags = {
team = ["development"]
environment = ["production"]
}
}
```

## Requirements

| Name | Version |
|------|---------|
| terraform | >= 1.0 |
| meshstack | ~> 0.14.0 |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|----------|
| payment_method_name | Name of the payment method | string | "default-payment-method" | no |
| workspace_id | The ID of the workspace to which this payment method will be assigned | string | n/a | yes |
| amount | The budget amount for this payment method | number | n/a | yes |
| expiration_date | The expiration date in RFC3339 format (e.g., '2025-12-31T23:59:59Z') | string | null | no |
| tags | Additional tags to apply to the payment method | map(list(string)) | {} | no |

## Outputs

| Name | Description |
|------|-------------|
| payment_method_name | The name of the payment method |
| workspace_id | The workspace ID associated with this payment method |
| amount | The budget amount for this payment method |

<!-- BEGIN_TF_DOCS -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_meshstack"></a> [meshstack](#requirement\_meshstack) | ~> 0.14.0 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [meshstack_payment_method.payment_method](https://registry.terraform.io/providers/meshcloud/meshstack/latest/docs/resources/payment_method) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_amount"></a> [amount](#input\_amount) | The budget amount for this payment method | `number` | n/a | yes |
| <a name="input_expiration_date"></a> [expiration\_date](#input\_expiration\_date) | The expiration date of the payment method in RFC3339 format (e.g., '2025-12-31') | `string` | `null` | no |
| <a name="input_payment_method_name"></a> [payment\_method\_name](#input\_payment\_method\_name) | Name of the payment method | `string` | `"default-payment-method"` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags to apply to the payment method | `map(list(string))` | `{}` | no |
| <a name="input_workspace_id"></a> [workspace\_id](#input\_workspace\_id) | The ID of the workspace to which this payment method will be assigned | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_amount"></a> [amount](#output\_amount) | The budget amount for this payment method |
| <a name="output_payment_method_name"></a> [payment\_method\_name](#output\_payment\_method\_name) | The name of the payment method |
| <a name="output_workspace_id"></a> [workspace\_id](#output\_workspace\_id) | The workspace ID associated with this payment method |
<!-- END_TF_DOCS -->
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions modules/meshstack/payment-method/buildingblock/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions modules/meshstack/payment-method/buildingblock/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
resource "meshstack_payment_method" "payment_method" {
metadata = {
name = var.payment_method_name
owned_by_workspace = var.workspace_id
}
spec = {
display_name = var.payment_method_name
amount = var.amount
expiration_date = var.expiration_date
tags = var.tags
}
}
14 changes: 14 additions & 0 deletions modules/meshstack/payment-method/buildingblock/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
output "payment_method_name" {
value = meshstack_payment_method.payment_method.metadata.name
description = "The name of the payment method"
}

output "workspace_id" {
value = meshstack_payment_method.payment_method.metadata.owned_by_workspace
description = "The workspace ID associated with this payment method"
}

output "amount" {
value = meshstack_payment_method.payment_method.spec.amount
description = "The budget amount for this payment method"
}
2 changes: 2 additions & 0 deletions modules/meshstack/payment-method/buildingblock/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
provider "meshstack" {
}
27 changes: 27 additions & 0 deletions modules/meshstack/payment-method/buildingblock/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
variable "payment_method_name" {
type = string
description = "Name of the payment method"
default = "default-payment-method"
}

variable "workspace_id" {
type = string
description = "The ID of the workspace to which this payment method will be assigned"
}

variable "amount" {
type = number
description = "The budget amount for this payment method"
}

variable "expiration_date" {
type = string
description = "The expiration date of the payment method in RFC3339 format (e.g., '2025-12-31')"
default = null
}

variable "tags" {
type = map(list(string))
description = "Additional tags to apply to the payment method"
default = {}
}
10 changes: 10 additions & 0 deletions modules/meshstack/payment-method/buildingblock/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
terraform {
required_version = ">= 1.0"

required_providers {
meshstack = {
source = "meshcloud/meshstack"
version = "~> 0.14.0"
}
}
}
Loading