Skip to content

Commit 3b6598f

Browse files
committed
feat: add meshstack_building_block_definition
1 parent 2bfd616 commit 3b6598f

File tree

8 files changed

+1193
-0
lines changed

8 files changed

+1193
-0
lines changed
Lines changed: 310 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,310 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "meshstack_building_block_definition Resource - terraform-provider-meshstack"
4+
subcategory: ""
5+
description: |-
6+
Represents a meshStack building block definition with version information merged into a single resource.
7+
---
8+
9+
# meshstack_building_block_definition (Resource)
10+
11+
Represents a meshStack building block definition with version information merged into a single resource.
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "meshstack_building_block_definition" "example" {
17+
metadata = {
18+
owned_by_workspace = "my-workspace"
19+
tags = { # Optional
20+
environment = ["production", "staging"]
21+
team = ["platform-team"]
22+
cost-center = ["cc-123"]
23+
}
24+
}
25+
26+
spec = {
27+
display_name = "Example Building Block"
28+
symbol = "🏗️" # Optional
29+
description = "An example building block definition"
30+
readme = "# Example Building Block\n\nThis is a comprehensive example showcasing all available attributes." # Optional
31+
support_url = "https://support.example.com/building-blocks" # Optional
32+
documentation_url = "https://docs.example.com/building-blocks" # Optional
33+
target_type = "TENANT" # Optional: defaults to "WORKSPACE"
34+
supported_platforms = ["azure.platform", "aws.platform"]
35+
run_transparency = true # Optional: defaults to false
36+
use_in_landing_zones_only = true # Optional: defaults to false
37+
notification_subscriber_usernames = ["admin@example.com", "ops@example.com"] # Optional
38+
}
39+
40+
version_spec = {
41+
draft = true
42+
runner_ref = "my-runner"
43+
44+
only_apply_once_per_tenant = false # Optional: defaults to false
45+
deletion_mode = "DELETE" # Optional: defaults to "DELETE"
46+
47+
# Optional: Inputs for the building block
48+
inputs = {
49+
environment = {
50+
display_name = "Environment"
51+
type = "SINGLE_SELECT"
52+
assignment_type = "USER_INPUT"
53+
is_environment = false # Optional: defaults to false
54+
is_sensitive = false # Optional: defaults to false
55+
updateable_by_consumer = true # Optional: defaults to false
56+
selectable_values = ["dev", "staging", "prod"] # Optional
57+
description = "The target environment" # Optional
58+
}
59+
resource_name = {
60+
display_name = "Resource Name"
61+
type = "STRING"
62+
assignment_type = "USER_INPUT"
63+
is_environment = false # Optional: defaults to false
64+
is_sensitive = false # Optional: defaults to false
65+
updateable_by_consumer = true # Optional: defaults to false
66+
description = "Name of the resource to create" # Optional
67+
value_validation_regex = "^[a-z0-9-]+$" # Optional
68+
validation_regex_error_message = "Resource name must contain only lowercase letters, numbers, and hyphens" # Optional
69+
}
70+
}
71+
72+
# Optional: Implementation - Terraform or GitHub Actions
73+
implementation = {
74+
terraform = {
75+
terraform_version = "1.9.0"
76+
repository_url = "https://github.com/example/building-block.git"
77+
async = false # Optional: defaults to false
78+
repository_path = "terraform/modules/example" # Optional
79+
ref_name = "v1.0.0" # Optional - git ref (branch, tag, commit)
80+
use_mesh_http_backend_fallback = false # Optional: defaults to false
81+
82+
# Optional: SSH configuration for private repositories
83+
ssh_private_key = "-----BEGIN OPENSSH PRIVATE KEY-----\n..." # Optional: write-only, not stored in state
84+
ssh_private_key_version = "v1" # Required when ssh_private_key is set
85+
86+
# Optional: SSH known host configuration
87+
ssh_known_host = { # Optional
88+
host = "github.com"
89+
key_type = "ssh-rsa"
90+
key_value = "AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+..."
91+
}
92+
}
93+
94+
# OR use GitHub Actions implementation
95+
# github_actions = {
96+
# repository = "meshcloud/some-repo"
97+
# branch = "main"
98+
# apply_workflow = "apply.yml"
99+
# destroy_workflow = "destroy.yml" # optional
100+
# source_platform_full_identifier = "my-platform.tenant-id"
101+
# }
102+
}
103+
104+
# Optional: Outputs from the building block
105+
outputs = {
106+
tenant_id = {
107+
display_name = "Tenant ID"
108+
type = "STRING"
109+
assignment_type = "PLATFORM_TENANT_ID"
110+
}
111+
sign_in_url = {
112+
display_name = "Sign-in URL"
113+
type = "STRING"
114+
assignment_type = "SIGN_IN_URL"
115+
}
116+
}
117+
118+
# Optional: Dependencies on other building blocks
119+
dependency_refs = [
120+
"dep-1",
121+
"dep-2"
122+
]
123+
124+
}
125+
}
126+
```
127+
128+
<!-- schema generated by tfplugindocs -->
129+
## Schema
130+
131+
### Required
132+
133+
- `metadata` (Attributes) (see [below for nested schema](#nestedatt--metadata))
134+
- `spec` (Attributes) (see [below for nested schema](#nestedatt--spec))
135+
- `version_spec` (Attributes) Version specification for the building block definition. (see [below for nested schema](#nestedatt--version_spec))
136+
137+
### Read-Only
138+
139+
- `version_latest` (Attributes) Latest version (including drafts). (see [below for nested schema](#nestedatt--version_latest))
140+
- `version_latest_release` (Attributes) Latest released version (excludes drafts). (see [below for nested schema](#nestedatt--version_latest_release))
141+
- `versions` (Attributes List) List of all available versions of this building block definition. (see [below for nested schema](#nestedatt--versions))
142+
143+
<a id="nestedatt--metadata"></a>
144+
### Nested Schema for `metadata`
145+
146+
Required:
147+
148+
- `owned_by_workspace` (String) The workspace that owns this building block definition.
149+
150+
Optional:
151+
152+
- `tags` (Map of List of String) Tags associated with this building block definition.
153+
154+
Read-Only:
155+
156+
- `created_on` (String) Timestamp when the building block definition was created.
157+
- `marked_for_deletion_by` (String) User who marked the building block definition for deletion.
158+
- `marked_for_deletion_on` (String) Timestamp when the building block definition was marked for deletion.
159+
- `uuid` (String) Unique identifier of the building block definition (server-generated).
160+
161+
162+
<a id="nestedatt--spec"></a>
163+
### Nested Schema for `spec`
164+
165+
Required:
166+
167+
- `description` (String) Description of the building block definition.
168+
- `display_name` (String) Display name for the building block definition.
169+
170+
Optional:
171+
172+
- `documentation_url` (String) URL for additional documentation.
173+
- `notification_subscriber_usernames` (List of String) List of usernames to notify about events related to this building block.
174+
- `readme` (String) Detailed readme/documentation in markdown format.
175+
- `run_transparency` (Boolean) Whether to enable run transparency for this building block.
176+
- `support_url` (String) URL for support resources.
177+
- `supported_platforms` (List of String) List of platform identifiers that this building block supports. Required and must be non-empty if target_type is `TENANT`
178+
- `symbol` (String) Icon symbol for the building block definition.
179+
- `target_type` (String) Target type for building blocks using this definition. One of `TENANT`, `WORKSPACE`.
180+
- `use_in_landing_zones_only` (Boolean) Whether this building block can only be used in landing zones.
181+
182+
183+
<a id="nestedatt--version_spec"></a>
184+
### Nested Schema for `version_spec`
185+
186+
Required:
187+
188+
- `draft` (Boolean) Whether the current version is a draft. Set to false to release the version.
189+
- `runner_ref` (String) UUID of the building block runner to use.
190+
191+
Optional:
192+
193+
- `deletion_mode` (String) Deletion behavior. One of `DELETE`, `PURGE`.
194+
- `dependency_refs` (List of String) List of UUIDs of building block definitions this definition depends on.
195+
- `implementation` (Attributes) Implementation configuration for the building block. Must contain exactly one of `terraform` or `github_actions`. (see [below for nested schema](#nestedatt--version_spec--implementation))
196+
- `inputs` (Attributes Map) Building block definition inputs. Map from input key to input configuration. (see [below for nested schema](#nestedatt--version_spec--inputs))
197+
- `only_apply_once_per_tenant` (Boolean) Whether this building block can only be applied once per tenant.
198+
- `outputs` (Attributes Map) Building block definition outputs. Map from output key to output configuration. (see [below for nested schema](#nestedatt--version_spec--outputs))
199+
200+
<a id="nestedatt--version_spec--implementation"></a>
201+
### Nested Schema for `version_spec.implementation`
202+
203+
Optional:
204+
205+
- `github_actions` (Attributes) GitHub Actions implementation configuration. (see [below for nested schema](#nestedatt--version_spec--implementation--github_actions))
206+
- `terraform` (Attributes) Terraform implementation configuration. (see [below for nested schema](#nestedatt--version_spec--implementation--terraform))
207+
208+
<a id="nestedatt--version_spec--implementation--github_actions"></a>
209+
### Nested Schema for `version_spec.implementation.github_actions`
210+
211+
Optional:
212+
213+
- `apply_workflow` (String) Workflow file name for apply operations.
214+
- `branch` (String) Branch to use for workflows.
215+
- `destroy_workflow` (String) Workflow file name for destroy operations.
216+
- `repository` (String) GitHub repository in format `owner/repo`.
217+
- `source_platform_full_identifier` (String) Full platform identifier.
218+
219+
220+
<a id="nestedatt--version_spec--implementation--terraform"></a>
221+
### Nested Schema for `version_spec.implementation.terraform`
222+
223+
Required:
224+
225+
- `repository_url` (String) Git repository URL containing the Terraform code.
226+
- `terraform_version` (String) Terraform version to use (e.g., `1.9.0`).
227+
228+
Optional:
229+
230+
- `async` (Boolean) Whether to run Terraform asynchronously.
231+
- `ref_name` (String) Git reference (branch, tag, or commit) to use.
232+
- `repository_path` (String) Path within the repository to the Terraform module.
233+
- `ssh_known_host` (Attributes) SSH known host configuration. (see [below for nested schema](#nestedatt--version_spec--implementation--terraform--ssh_known_host))
234+
- `ssh_private_key` (String, Sensitive, [Write-only](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments)) SSH private key for accessing private repositories. This value is write-only and will not be stored in state.
235+
- `ssh_private_key_version` (String) Version identifier for the SSH private key. Change this value to trigger rotation of the write-only `ssh_private_key` attribute. Required when `ssh_private_key` is set.
236+
- `use_mesh_http_backend_fallback` (Boolean) Whether to use meshStack's HTTP backend as fallback.
237+
238+
<a id="nestedatt--version_spec--implementation--terraform--ssh_known_host"></a>
239+
### Nested Schema for `version_spec.implementation.terraform.ssh_known_host`
240+
241+
Required:
242+
243+
- `host` (String) Hostname (e.g., `github.com`).
244+
- `key_type` (String) SSH key type (e.g., `ssh-rsa`).
245+
- `key_value` (String) SSH key value.
246+
247+
248+
249+
250+
<a id="nestedatt--version_spec--inputs"></a>
251+
### Nested Schema for `version_spec.inputs`
252+
253+
Required:
254+
255+
- `assignment_type` (String) How the input value is assigned. One of `USER_INPUT`, `PLATFORM_OPERATOR_MANUAL_INPUT`, `BUILDING_BLOCK_OUTPUT`, `PLATFORM_TENANT_ID`, `WORKSPACE_IDENTIFIER`, `PROJECT_IDENTIFIER`, `FULL_PLATFORM_IDENTIFIER`, `TENANT_BUILDING_BLOCK_UUID`, `STATIC`, `USER_PERMISSIONS`.
256+
- `display_name` (String) Display name for the input shown to users.
257+
- `type` (String) Input type. One of `STRING`, `CODE`, `INTEGER`, `BOOLEAN`, `FILE`, `LIST`, `SINGLE_SELECT`, `MULTI_SELECT`.
258+
259+
Optional:
260+
261+
- `argument` (String) Argument value for static or template assignment types.
262+
- `default_value` (String) Default value for the input (as string, will be converted based on type).
263+
- `description` (String) Description of the input parameter.
264+
- `is_environment` (Boolean) Whether this input is exposed as an environment variable.
265+
- `is_sensitive` (Boolean) Whether this input contains sensitive data.
266+
- `selectable_values` (List of String) List of allowed values for SINGLE_SELECT or MULTI_SELECT types.
267+
- `updateable_by_consumer` (Boolean) Whether consumers can update this input value.
268+
- `validation_regex_error_message` (String) Error message shown when validation regex fails.
269+
- `value_validation_regex` (String) Regular expression to validate input values.
270+
271+
272+
<a id="nestedatt--version_spec--outputs"></a>
273+
### Nested Schema for `version_spec.outputs`
274+
275+
Required:
276+
277+
- `assignment_type` (String) How the output is assigned. One of `NONE`, `PLATFORM_TENANT_ID`, `SIGN_IN_URL`.
278+
- `display_name` (String) Display name for the output shown to users.
279+
- `type` (String) Output type. One of `STRING`, `CODE`, `INTEGER`, `BOOLEAN`, `FILE`, `LIST`, `SINGLE_SELECT`, `MULTI_SELECT`.
280+
281+
282+
283+
<a id="nestedatt--version_latest"></a>
284+
### Nested Schema for `version_latest`
285+
286+
Read-Only:
287+
288+
- `number` (Number) Version number.
289+
- `state` (String) State of the version. One of `DRAFT`, `RELEASED`.
290+
- `uuid` (String) UUID of the version.
291+
292+
293+
<a id="nestedatt--version_latest_release"></a>
294+
### Nested Schema for `version_latest_release`
295+
296+
Read-Only:
297+
298+
- `number` (Number) Version number.
299+
- `state` (String) State of the version. One of `DRAFT`, `RELEASED`.
300+
- `uuid` (String) UUID of the version.
301+
302+
303+
<a id="nestedatt--versions"></a>
304+
### Nested Schema for `versions`
305+
306+
Read-Only:
307+
308+
- `number` (Number) Version number.
309+
- `state` (String) State of the version. One of `DRAFT`, `RELEASED`.
310+
- `uuid` (String) UUID of the version.

0 commit comments

Comments
 (0)