Skip to content

Commit c835aa1

Browse files
committed
feat: add meshstack_building_block_definition resource
1 parent 3196b76 commit c835aa1

File tree

6 files changed

+899
-0
lines changed

6 files changed

+899
-0
lines changed
Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
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+
name = "my-building-block-def"
19+
owned_by_workspace = "my-workspace"
20+
tags = {
21+
environment = ["dev", "staging"]
22+
team = ["platform"]
23+
}
24+
}
25+
26+
display_name = "Example Building Block"
27+
symbol = "🔧"
28+
target_type = "TENANT"
29+
description = "An example building block definition for infrastructure provisioning"
30+
readme = "# Example Building Block\n\nThis building block provisions example infrastructure."
31+
supported_platforms = ["azure.example", "aws.example"]
32+
run_transparency = false
33+
use_in_landing_zones_only = true
34+
support_url = "https://support.example.com"
35+
documentation_url = "https://docs.example.com/building-blocks/example"
36+
notification_subscriber_usernames = ["platform-team"]
37+
38+
draft = true
39+
40+
implementation = {
41+
terraform = {
42+
terraform_version = "1.9.0"
43+
repository_url = "https://github.com/example/building-block.git"
44+
async = false
45+
use_mesh_http_backend_fallback = false
46+
}
47+
}
48+
49+
only_apply_once_per_tenant = false
50+
deletion_mode = "DELETE"
51+
52+
runner_ref = {
53+
uuid = "66ddc814-1e69-4dad-b5f1-3a5bce51c01f"
54+
}
55+
56+
inputs = {
57+
region = {
58+
type = "SINGLE_SELECT"
59+
required = true
60+
description = "Target region for deployment"
61+
}
62+
instance_count = {
63+
type = "INTEGER"
64+
required = false
65+
default = "1"
66+
description = "Number of instances to create"
67+
}
68+
enable_monitoring = {
69+
type = "BOOLEAN"
70+
required = false
71+
default = "false"
72+
description = "Enable monitoring for resources"
73+
}
74+
custom_config = {
75+
type = "CODE"
76+
required = false
77+
description = "Custom JSON configuration"
78+
}
79+
}
80+
81+
outputs = {
82+
endpoint_url = {
83+
type = "STRING"
84+
description = "The endpoint URL of the provisioned resource"
85+
}
86+
resource_id = {
87+
type = "STRING"
88+
description = "Unique identifier of the created resource"
89+
}
90+
is_ready = {
91+
type = "BOOLEAN"
92+
description = "Whether the resource is ready for use"
93+
}
94+
}
95+
}
96+
```
97+
98+
<!-- schema generated by tfplugindocs -->
99+
## Schema
100+
101+
### Required
102+
103+
- `description` (String) Description of the building block definition.
104+
- `display_name` (String) Display name for the building block definition.
105+
- `draft` (Boolean) Whether the current version is a draft. Set to false to release the version.
106+
- `implementation` (Attributes) Implementation configuration for the building block. (see [below for nested schema](#nestedatt--implementation))
107+
- `metadata` (Attributes) (see [below for nested schema](#nestedatt--metadata))
108+
- `runner_ref` (Attributes) Reference to the building block runner to use. (see [below for nested schema](#nestedatt--runner_ref))
109+
- `supported_platforms` (List of String) List of platform identifiers that this building block supports.
110+
- `target_type` (String) Target type for building blocks using this definition. One of `TENANT`, `WORKSPACE`.
111+
- `use_in_landing_zones_only` (Boolean) Whether this building block can only be used in landing zones.
112+
113+
### Optional
114+
115+
- `deletion_mode` (String) Deletion behavior. One of `DELETE`, `KEEP`.
116+
- `documentation_url` (String) URL for additional documentation.
117+
- `inputs` (Attributes Map) Building block definition inputs. Each input defines the type and constraints for user-provided values. (see [below for nested schema](#nestedatt--inputs))
118+
- `notification_subscriber_usernames` (List of String) List of usernames to notify about events related to this building block.
119+
- `only_apply_once_per_tenant` (Boolean) Whether this building block can only be applied once per tenant.
120+
- `outputs` (Attributes Map) Building block definition outputs. Defines what outputs are exposed by the building block. (see [below for nested schema](#nestedatt--outputs))
121+
- `readme` (String) Detailed readme/documentation in markdown format.
122+
- `run_transparency` (Boolean) Whether to enable run transparency for this building block.
123+
- `support_url` (String) URL for support resources.
124+
- `symbol` (String) Icon symbol for the building block definition.
125+
126+
### Read-Only
127+
128+
- `state` (String) State of the current version (read-only). One of `DRAFT`, `RELEASED`.
129+
- `version_latest` (Attributes) Latest version (including drafts). (see [below for nested schema](#nestedatt--version_latest))
130+
- `version_latest_release` (Attributes) Latest released version (excludes drafts). (see [below for nested schema](#nestedatt--version_latest_release))
131+
- `version_number` (Number) Current version number (read-only).
132+
- `versions` (Attributes List) List of all available versions of this building block definition. (see [below for nested schema](#nestedatt--versions))
133+
134+
<a id="nestedatt--implementation"></a>
135+
### Nested Schema for `implementation`
136+
137+
Required:
138+
139+
- `terraform` (Attributes) Terraform implementation configuration. (see [below for nested schema](#nestedatt--implementation--terraform))
140+
141+
<a id="nestedatt--implementation--terraform"></a>
142+
### Nested Schema for `implementation.terraform`
143+
144+
Required:
145+
146+
- `repository_url` (String) Git repository URL containing the Terraform code.
147+
- `terraform_version` (String) Terraform version to use (e.g., `1.9.0`).
148+
149+
Optional:
150+
151+
- `async` (Boolean) Whether to run Terraform asynchronously.
152+
- `use_mesh_http_backend_fallback` (Boolean) Whether to use meshStack's HTTP backend as fallback.
153+
154+
155+
156+
<a id="nestedatt--metadata"></a>
157+
### Nested Schema for `metadata`
158+
159+
Required:
160+
161+
- `name` (String) Building block definition identifier.
162+
- `owned_by_workspace` (String) The workspace that owns this building block definition.
163+
164+
Optional:
165+
166+
- `tags` (Map of List of String) Tags associated with this building block definition.
167+
168+
Read-Only:
169+
170+
- `created_on` (String) Timestamp when the building block definition was created.
171+
- `marked_for_deletion_by` (String) User who marked the building block definition for deletion.
172+
- `marked_for_deletion_on` (String) Timestamp when the building block definition was marked for deletion.
173+
- `uuid` (String) Unique identifier of the building block definition (server-generated).
174+
175+
176+
<a id="nestedatt--runner_ref"></a>
177+
### Nested Schema for `runner_ref`
178+
179+
Required:
180+
181+
- `uuid` (String) UUID of the building block runner.
182+
183+
Read-Only:
184+
185+
- `kind` (String) Kind of the referenced entity, always `meshBuildingBlockRunner`.
186+
187+
188+
<a id="nestedatt--inputs"></a>
189+
### Nested Schema for `inputs`
190+
191+
Required:
192+
193+
- `type` (String) Input type. One of `STRING`, `INTEGER`, `BOOLEAN`, `CODE`, `SINGLE_SELECT`, `MULTI_SELECT`.
194+
195+
Optional:
196+
197+
- `default` (String) Default value for the input (as string, will be converted based on type).
198+
- `description` (String) Description of the input parameter.
199+
- `required` (Boolean) Whether this input is required.
200+
201+
202+
<a id="nestedatt--outputs"></a>
203+
### Nested Schema for `outputs`
204+
205+
Required:
206+
207+
- `type` (String) Output type. One of `STRING`, `INTEGER`, `BOOLEAN`, `CODE`.
208+
209+
Optional:
210+
211+
- `description` (String) Description of the output value.
212+
213+
214+
<a id="nestedatt--version_latest"></a>
215+
### Nested Schema for `version_latest`
216+
217+
Read-Only:
218+
219+
- `content_hash` (String) Hash of the version content.
220+
- `uuid` (String) UUID of the latest version.
221+
222+
223+
<a id="nestedatt--version_latest_release"></a>
224+
### Nested Schema for `version_latest_release`
225+
226+
Read-Only:
227+
228+
- `content_hash` (String) Hash of the version content.
229+
- `uuid` (String) UUID of the latest released version.
230+
231+
232+
<a id="nestedatt--versions"></a>
233+
### Nested Schema for `versions`
234+
235+
Read-Only:
236+
237+
- `content_hash` (String) Hash of the version content for change detection.
238+
- `uuid` (String) UUID of the version.

examples/embed.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ import _ "embed"
55
var (
66
//go:embed resources/meshstack_location/resource.tf
77
LocationResourceConfig string
8+
9+
//go:embed resources/meshstack_building_block_definition/resource.tf
10+
BuildingBlockDefinitionResourceConfig string
811
)
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
resource "meshstack_building_block_definition" "example" {
2+
metadata = {
3+
name = "my-building-block-def"
4+
owned_by_workspace = "my-workspace"
5+
tags = {
6+
environment = ["dev", "staging"]
7+
team = ["platform"]
8+
}
9+
}
10+
11+
display_name = "Example Building Block"
12+
symbol = "🔧"
13+
target_type = "TENANT"
14+
description = "An example building block definition for infrastructure provisioning"
15+
readme = "# Example Building Block\n\nThis building block provisions example infrastructure."
16+
supported_platforms = ["azure.example", "aws.example"]
17+
run_transparency = false
18+
use_in_landing_zones_only = true
19+
support_url = "https://support.example.com"
20+
documentation_url = "https://docs.example.com/building-blocks/example"
21+
notification_subscriber_usernames = ["platform-team"]
22+
23+
draft = true
24+
25+
implementation = {
26+
terraform = {
27+
terraform_version = "1.9.0"
28+
repository_url = "https://github.com/example/building-block.git"
29+
async = false
30+
use_mesh_http_backend_fallback = false
31+
}
32+
}
33+
34+
only_apply_once_per_tenant = false
35+
deletion_mode = "DELETE"
36+
37+
runner_ref = {
38+
uuid = "66ddc814-1e69-4dad-b5f1-3a5bce51c01f"
39+
}
40+
41+
inputs = {
42+
region = {
43+
type = "SINGLE_SELECT"
44+
required = true
45+
description = "Target region for deployment"
46+
}
47+
instance_count = {
48+
type = "INTEGER"
49+
required = false
50+
default = "1"
51+
description = "Number of instances to create"
52+
}
53+
enable_monitoring = {
54+
type = "BOOLEAN"
55+
required = false
56+
default = "false"
57+
description = "Enable monitoring for resources"
58+
}
59+
custom_config = {
60+
type = "CODE"
61+
required = false
62+
description = "Custom JSON configuration"
63+
}
64+
}
65+
66+
outputs = {
67+
endpoint_url = {
68+
type = "STRING"
69+
description = "The endpoint URL of the provisioned resource"
70+
}
71+
resource_id = {
72+
type = "STRING"
73+
description = "Unique identifier of the created resource"
74+
}
75+
is_ready = {
76+
type = "BOOLEAN"
77+
description = "Whether the resource is ready for use"
78+
}
79+
}
80+
}
81+

0 commit comments

Comments
 (0)