Skip to content

Commit 3f3d9a6

Browse files
authored
Merge pull request #91 from meshcloud/feature/meshstack-buildingblocks
Feature/meshstack buildingblocks
2 parents 42c5f88 + 84f48f3 commit 3f3d9a6

File tree

11 files changed

+211
-0
lines changed

11 files changed

+211
-0
lines changed

modules/meshstack/logo.png

91.5 KB
Loading

modules/meshstack/logo.svg

Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# meshStack Payment Method
2+
3+
## Description
4+
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.
5+
6+
## Usage Motivation
7+
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.
8+
9+
## Usage Examples
10+
- A development team creates a payment method with a budget of $10,000 for their workspace to control cloud spending.
11+
- A team launching a new project sets up a payment method with an expiration date to align with their project timeline.
12+
- An operations team assigns a payment method with custom tags to categorize and track spending by department or cost center.
13+
14+
## Shared Responsibility
15+
16+
| Responsibility | Platform Team | Application Team |
17+
|------------------------|--------------|----------------|
18+
| Creating and maintaining automation for payment methods |||
19+
| Provisioning payment methods for workspaces |||
20+
| Configuring the budget amount |||
21+
| Managing expiration dates |||
22+
| Applying tags for cost tracking |||
23+
| Monitoring spending against the payment method |||
24+
25+
## Recommendations for Setting the Right Budget
26+
To define an effective payment method budget:
27+
- **Baseline your spending**: Review historical costs across all platforms to determine a reasonable budget.
28+
- **Add buffer**: Include a buffer (10-20%) for unexpected usage spikes.
29+
- **Set expiration dates**: For temporary projects, set expiration dates to automatically clean up unused payment methods.
30+
- **Use tags effectively**: Apply consistent tags to enable better cost tracking and reporting across your organization.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
name: meshStack Payment Method
3+
supportedPlatforms:
4+
- meshstack
5+
description: |
6+
Creates a new meshStack Payment Method for a Workspace
7+
---
8+
# meshStack Payment Method Building Block
9+
10+
This Terraform module creates a payment method for a specific workspace in meshStack.
11+
12+
## Features
13+
- Create payment methods with configurable budgets
14+
- Optional expiration dates
15+
- Flexible tagging support
16+
17+
## Usage
18+
19+
```hcl
20+
module "payment_method" {
21+
source = "./modules/meshstack/payment-method/buildingblock"
22+
23+
payment_method_name = "dev-team-budget"
24+
workspace_id = "workspace-abc123"
25+
amount = 10000
26+
expiration_date = "2025-12-31T23:59:59Z"
27+
28+
tags = {
29+
team = ["development"]
30+
environment = ["production"]
31+
}
32+
}
33+
```
34+
35+
## Requirements
36+
37+
| Name | Version |
38+
|------|---------|
39+
| terraform | >= 1.0 |
40+
| meshstack | ~> 0.14.0 |
41+
42+
## Inputs
43+
44+
| Name | Description | Type | Default | Required |
45+
|------|-------------|------|---------|----------|
46+
| payment_method_name | Name of the payment method | string | "default-payment-method" | no |
47+
| workspace_id | The ID of the workspace to which this payment method will be assigned | string | n/a | yes |
48+
| amount | The budget amount for this payment method | number | n/a | yes |
49+
| expiration_date | The expiration date in RFC3339 format (e.g., '2025-12-31T23:59:59Z') | string | null | no |
50+
| tags | Additional tags to apply to the payment method | map(list(string)) | {} | no |
51+
52+
## Outputs
53+
54+
| Name | Description |
55+
|------|-------------|
56+
| payment_method_name | The name of the payment method |
57+
| workspace_id | The workspace ID associated with this payment method |
58+
| amount | The budget amount for this payment method |
59+
60+
<!-- BEGIN_TF_DOCS -->
61+
## Requirements
62+
63+
| Name | Version |
64+
|------|---------|
65+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
66+
| <a name="requirement_meshstack"></a> [meshstack](#requirement\_meshstack) | ~> 0.14.0 |
67+
68+
## Modules
69+
70+
No modules.
71+
72+
## Resources
73+
74+
| Name | Type |
75+
|------|------|
76+
| [meshstack_payment_method.payment_method](https://registry.terraform.io/providers/meshcloud/meshstack/latest/docs/resources/payment_method) | resource |
77+
78+
## Inputs
79+
80+
| Name | Description | Type | Default | Required |
81+
|------|-------------|------|---------|:--------:|
82+
| <a name="input_amount"></a> [amount](#input\_amount) | The budget amount for this payment method | `number` | n/a | yes |
83+
| <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 |
84+
| <a name="input_payment_method_name"></a> [payment\_method\_name](#input\_payment\_method\_name) | Name of the payment method | `string` | `"default-payment-method"` | no |
85+
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags to apply to the payment method | `map(list(string))` | `{}` | no |
86+
| <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 |
87+
88+
## Outputs
89+
90+
| Name | Description |
91+
|------|-------------|
92+
| <a name="output_amount"></a> [amount](#output\_amount) | The budget amount for this payment method |
93+
| <a name="output_payment_method_name"></a> [payment\_method\_name](#output\_payment\_method\_name) | The name of the payment method |
94+
| <a name="output_workspace_id"></a> [workspace\_id](#output\_workspace\_id) | The workspace ID associated with this payment method |
95+
<!-- END_TF_DOCS -->
92.1 KB
Loading

modules/meshstack/payment-method/buildingblock/logo.svg

Lines changed: 17 additions & 0 deletions
Loading
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
resource "meshstack_payment_method" "payment_method" {
2+
metadata = {
3+
name = var.payment_method_name
4+
owned_by_workspace = var.workspace_id
5+
}
6+
spec = {
7+
display_name = var.payment_method_name
8+
amount = var.amount
9+
expiration_date = var.expiration_date
10+
tags = var.tags
11+
}
12+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
output "payment_method_name" {
2+
value = meshstack_payment_method.payment_method.metadata.name
3+
description = "The name of the payment method"
4+
}
5+
6+
output "workspace_id" {
7+
value = meshstack_payment_method.payment_method.metadata.owned_by_workspace
8+
description = "The workspace ID associated with this payment method"
9+
}
10+
11+
output "amount" {
12+
value = meshstack_payment_method.payment_method.spec.amount
13+
description = "The budget amount for this payment method"
14+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
provider "meshstack" {
2+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
variable "payment_method_name" {
2+
type = string
3+
description = "Name of the payment method"
4+
default = "default-payment-method"
5+
}
6+
7+
variable "workspace_id" {
8+
type = string
9+
description = "The ID of the workspace to which this payment method will be assigned"
10+
}
11+
12+
variable "amount" {
13+
type = number
14+
description = "The budget amount for this payment method"
15+
}
16+
17+
variable "expiration_date" {
18+
type = string
19+
description = "The expiration date of the payment method in RFC3339 format (e.g., '2025-12-31')"
20+
default = null
21+
}
22+
23+
variable "tags" {
24+
type = map(list(string))
25+
description = "Additional tags to apply to the payment method"
26+
default = {}
27+
}

0 commit comments

Comments
 (0)