-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/meshstack buildingblocks #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
01775aa
feat: adding payment method building block
younGihan 429289b
style: refactored
younGihan ee63b30
feat: updated logo to correct size. changed tags variable from map to…
younGihan 8f107ad
feat: update tags variables
younGihan 2ab3733
feat: update output file
younGihan 799b6f9
fix: updated readme file to correct format
younGihan b6cefbf
fix: updated readme file to correct format
younGihan 7a0c114
Update modules/meshstack/payment-method/buildingblock/README.md
younGihan 1f1b12d
Update modules/meshstack/payment-method/buildingblock/README.md
younGihan a32ad2b
Update modules/meshstack/payment-method/buildingblock/README.md
younGihan 84f48f3
Update modules/meshstack/payment-method/buildingblock/README.md
younGihan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
30
modules/meshstack/payment-method/buildingblock/APP_TEAM_README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| provider "meshstack" { | ||
| } |
27 changes: 27 additions & 0 deletions
27
modules/meshstack/payment-method/buildingblock/variables.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
10
modules/meshstack/payment-method/buildingblock/versions.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could update it to the newest version but not necessary