Skip to content

Commit 9e3d4ab

Browse files
Merge pull request #58 from pluralsh/marcin/prod-2636-add-url-to-service-deployment-helm-schema-in-terraform
feat: Add Helm URL to service resource
2 parents fc28347 + 0065dcc commit 9e3d4ab

File tree

5 files changed

+64
-27
lines changed

5 files changed

+64
-27
lines changed

docs/resources/service_deployment.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ Optional:
8383

8484
- `chart` (String) The name of the chart to use.
8585
- `repository` (Attributes) Resource reference to the flux Helm repository used by this chart. (see [below for nested schema](#nestedatt--helm--repository))
86+
- `url` (String) Helm repository URL to use.
8687
- `values` (String) Helm values file to use with this service.
8788
- `values_files` (Set of String) List of relative paths to values files to use form Helm applies.
88-
- `version` (String) Chart version to use
89+
- `version` (String) Chart version to use.
8990

9091
<a id="nestedatt--helm--repository"></a>
9192
### Nested Schema for `helm.repository`

docs/resources/shared_secret.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "plural_shared_secret Resource - terraform-provider-plural"
4+
subcategory: ""
5+
description: |-
6+
A one-time-viewable secret shared with a list of eligible users.
7+
---
8+
9+
# plural_shared_secret (Resource)
10+
11+
A one-time-viewable secret shared with a list of eligible users.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `name` (String) The name of this shared secret.
21+
- `secret` (String, Sensitive) Content of this shared secret.
22+
23+
### Optional
24+
25+
- `notification_bindings` (Attributes Set) The users/groups you want this secret to be delivered to. (see [below for nested schema](#nestedatt--notification_bindings))
26+
27+
<a id="nestedatt--notification_bindings"></a>
28+
### Nested Schema for `notification_bindings`
29+
30+
Optional:
31+
32+
- `group_id` (String)
33+
- `id` (String)
34+
- `user_id` (String)

example/service/helm/main.tf

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1+
terraform {
2+
required_providers {
3+
plural = {
4+
source = "pluralsh/plural"
5+
version = "0.2.1"
6+
}
7+
}
8+
}
9+
110
provider "plural" {
211
use_cli = true
312
}
413

5-
data "plural_cluster" "byok_workload_cluster" {
6-
handle = "gcp-workload-cluster"
14+
data "plural_cluster" "cluster" {
15+
handle = "mgmt"
716
}
817

918
resource "plural_service_deployment" "cd-test" {
@@ -12,34 +21,24 @@ resource "plural_service_deployment" "cd-test" {
1221
namespace = "tf-cd-helm-test"
1322

1423
cluster = {
15-
handle = data.plural_cluster.byok_workload_cluster.handle
24+
handle = data.plural_cluster.cluster.handle
1625
}
1726

18-
# Requires flux-source-controller addon to be installed and flux repo CRD for podinfo to exist
1927
helm = {
20-
chart = "podinfo"
21-
repository = {
22-
name = "podinfo"
23-
namespace = "default"
24-
}
25-
version = "6.5.3"
28+
chart = "grafana"
29+
version = "8.x.x"
30+
url = "https://grafana.github.io/helm-charts"
2631
}
2732

2833
# Optional
2934
version = "0.0.2"
3035
docs_path = "doc"
3136
protect = false
3237

33-
configuration = [
34-
{
35-
name : "host"
36-
value : "tf-cd-test.gcp.plural.sh"
37-
},
38-
{
39-
name : "tag"
40-
value : "sha-4d01e86"
41-
}
42-
]
38+
configuration = {
39+
"host" = "tf-cd-test.gcp.plural.sh",
40+
"tag" = "sha-4d01e86"
41+
}
4342

4443
sync_config = {
4544
namespace_metadata = {
@@ -51,8 +50,4 @@ resource "plural_service_deployment" "cd-test" {
5150
}
5251
}
5352
}
54-
55-
depends_on = [
56-
data.plural_cluster.byok_workload_cluster,
57-
]
5853
}

internal/model/service_deployment.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ type ServiceDeploymentHelm struct {
291291
Values types.String `tfsdk:"values"`
292292
ValuesFiles types.Set `tfsdk:"values_files"`
293293
Version types.String `tfsdk:"version"`
294+
URL types.String `tfsdk:"url"`
294295
}
295296

296297
func (this *ServiceDeploymentHelm) Attributes() *gqlclient.HelmConfigAttributes {
@@ -309,6 +310,7 @@ func (this *ServiceDeploymentHelm) Attributes() *gqlclient.HelmConfigAttributes
309310
Chart: this.Chart.ValueStringPointer(),
310311
Version: this.Version.ValueStringPointer(),
311312
Repository: this.Repository.Attributes(),
313+
URL: this.URL.ValueStringPointer(),
312314
}
313315
}
314316

internal/resource/service_deployment_schema.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,13 @@ func (r *ServiceDeploymentResource) schemaHelm() schema.SingleNestedAttribute {
291291
},
292292
"version": schema.StringAttribute{
293293
Optional: true,
294-
Description: "Chart version to use",
295-
MarkdownDescription: "Chart version to use",
294+
Description: "Chart version to use.",
295+
MarkdownDescription: "Chart version to use.",
296+
},
297+
"url": schema.StringAttribute{
298+
Optional: true,
299+
Description: "Helm repository URL to use.",
300+
MarkdownDescription: "Helm repository URL to use.",
296301
},
297302
},
298303
Validators: []validator.Object{

0 commit comments

Comments
 (0)