Skip to content

Commit a98c8c9

Browse files
committed
feat: add meshstack_building_block_definition
1 parent 517b91b commit a98c8c9

15 files changed

+2756
-0
lines changed

docs/resources/building_block_definition.md

Lines changed: 498 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
resource "meshstack_building_block_definition" "example" {
2+
metadata = {
3+
owned_by_workspace = "my-workspace"
4+
tags = { # Optional
5+
environment = ["production", "staging"]
6+
team = ["platform-team"]
7+
cost-center = ["cc-123"]
8+
}
9+
}
10+
11+
spec = {
12+
display_name = "Example Building Block"
13+
symbol = "🏗️" # Optional
14+
description = "An example building block definition"
15+
readme = "# Example Building Block\n\nThis is a comprehensive example showcasing all available attributes." # Optional
16+
support_url = "https://support.example.com/building-blocks" # Optional
17+
documentation_url = "https://docs.example.com/building-blocks" # Optional
18+
target_type = "TENANT_LEVEL" # Optional: defaults to "WORKSPACE"
19+
supported_platforms = ["azure.platform", "aws.platform"]
20+
run_transparency = true # Optional: defaults to false
21+
use_in_landing_zones_only = true # Optional: defaults to false
22+
notification_subscriber_usernames = ["admin@example.com", "ops@example.com"] # Optional
23+
}
24+
25+
version_spec = {
26+
draft = true
27+
runner_ref = {
28+
uuid = "" # points to shared default runner?
29+
}
30+
31+
only_apply_once_per_tenant = false # Optional: defaults to false
32+
deletion_mode = "DELETE" # Optional: defaults to "DELETE"
33+
34+
# Optional: Inputs for the building block
35+
inputs = {
36+
environment = {
37+
display_name = "Environment"
38+
type = "SINGLE_SELECT"
39+
assignment_type = "USER_INPUT"
40+
is_environment = false # Optional: defaults to false
41+
updateable_by_consumer = true # Optional: defaults to false
42+
selectable_values = ["dev", "staging", "prod"] # Optional
43+
description = "The target environment" # Optional
44+
}
45+
resource_name = {
46+
display_name = "Resource Name"
47+
type = "BOOLEAN"
48+
assignment_type = "STATIC"
49+
argument = jsonencode(true)
50+
default_value = jsonencode(true)
51+
is_environment = false # Optional: defaults to false
52+
updateable_by_consumer = true # Optional: defaults to false
53+
description = "Name of the resource to create" # Optional
54+
value_validation_regex = "^[a-z0-9-]+$" # Optional
55+
validation_regex_error_message = "Resource name must contain only lowercase letters, numbers, and hyphens" # Optional
56+
}
57+
something_very_secret = {
58+
display_name = ""
59+
type = "STRING"
60+
assignment_type = "STATIC"
61+
sensitive = {
62+
argument = {
63+
value = "write-only-plaintext-value-should-be-ephemeral"
64+
}
65+
default_value = {
66+
value = "write-only-plaintext-value-should-be-ephemeral"
67+
}
68+
}
69+
is_environment = false # Optional: defaults to false
70+
updateable_by_consumer = true # Optional: defaults to false
71+
description = "Name of the resource to create" # Optional
72+
value_validation_regex = "^[a-z0-9-]+$" # Optional
73+
validation_regex_error_message = "Resource name must contain only lowercase letters, numbers, and hyphens" # Optional
74+
}
75+
}
76+
77+
implementation = {
78+
terraform = {
79+
terraform_version = "1.9.0"
80+
repository_url = "https://github.com/example/building-block.git"
81+
async = false # Optional: defaults to false
82+
repository_path = "terraform/modules/example" # Optional
83+
ref_name = "v1.0.0" # Optional - git ref (branch, tag, commit)
84+
use_mesh_http_backend_fallback = false # Optional: defaults to false
85+
86+
# Optional: SSH configuration for private repositories
87+
ssh_private_key = {
88+
value = "-----BEGIN OPENSSH PRIVATE KEY-----\n..." # write-only, not stored in state
89+
fingerprint = null # change whenever value shall be re-applied
90+
}
91+
92+
# Optional: SSH known host configuration
93+
ssh_known_host = { # Optional
94+
host = "github.com"
95+
key_type = "ssh-rsa"
96+
key_value = "AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+..."
97+
}
98+
}
99+
100+
# OR use GitHub Actions implementation
101+
# github_actions = {
102+
# repository = "meshcloud/some-repo"
103+
# branch = "main"
104+
# apply_workflow = "apply.yml"
105+
# destroy_workflow = "destroy.yml" # optional
106+
# source_platform_full_identifier = "my-platform.tenant-id"
107+
# }
108+
}
109+
110+
# Optional: Outputs from the building block
111+
outputs = {
112+
tenant_id = {
113+
display_name = "Tenant ID"
114+
type = "STRING"
115+
assignment_type = "PLATFORM_TENANT_ID"
116+
}
117+
sign_in_url = {
118+
display_name = "Sign-in URL"
119+
type = "STRING"
120+
assignment_type = "SIGN_IN_URL"
121+
}
122+
}
123+
124+
# Optional: Dependencies on other building blocks
125+
dependency_refs = [
126+
"dep-1",
127+
"dep-2"
128+
]
129+
}
130+
}

0 commit comments

Comments
 (0)