Skip to content
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

feat: Add Helm URL to service resource #58

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/resources/service_deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ Optional:

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

<a id="nestedatt--helm--repository"></a>
### Nested Schema for `helm.repository`
Expand Down
34 changes: 34 additions & 0 deletions docs/resources/shared_secret.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "plural_shared_secret Resource - terraform-provider-plural"
subcategory: ""
description: |-
A one-time-viewable secret shared with a list of eligible users.
---

# plural_shared_secret (Resource)

A one-time-viewable secret shared with a list of eligible users.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) The name of this shared secret.
- `secret` (String, Sensitive) Content of this shared secret.

### Optional

- `notification_bindings` (Attributes Set) The users/groups you want this secret to be delivered to. (see [below for nested schema](#nestedatt--notification_bindings))

<a id="nestedatt--notification_bindings"></a>
### Nested Schema for `notification_bindings`

Optional:

- `group_id` (String)
- `id` (String)
- `user_id` (String)
43 changes: 19 additions & 24 deletions example/service/helm/main.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
terraform {
required_providers {
plural = {
source = "pluralsh/plural"
version = "0.2.1"
}
}
}

provider "plural" {
use_cli = true
}

data "plural_cluster" "byok_workload_cluster" {
handle = "gcp-workload-cluster"
data "plural_cluster" "cluster" {
handle = "mgmt"
}

resource "plural_service_deployment" "cd-test" {
Expand All @@ -12,34 +21,24 @@ resource "plural_service_deployment" "cd-test" {
namespace = "tf-cd-helm-test"

cluster = {
handle = data.plural_cluster.byok_workload_cluster.handle
handle = data.plural_cluster.cluster.handle
}

# Requires flux-source-controller addon to be installed and flux repo CRD for podinfo to exist
helm = {
chart = "podinfo"
repository = {
name = "podinfo"
namespace = "default"
}
version = "6.5.3"
chart = "grafana"
version = "8.x.x"
url = "https://grafana.github.io/helm-charts"
}

# Optional
version = "0.0.2"
docs_path = "doc"
protect = false

configuration = [
{
name : "host"
value : "tf-cd-test.gcp.plural.sh"
},
{
name : "tag"
value : "sha-4d01e86"
}
]
configuration = {
"host" = "tf-cd-test.gcp.plural.sh",
"tag" = "sha-4d01e86"
}

sync_config = {
namespace_metadata = {
Expand All @@ -51,8 +50,4 @@ resource "plural_service_deployment" "cd-test" {
}
}
}

depends_on = [
data.plural_cluster.byok_workload_cluster,
]
}
2 changes: 2 additions & 0 deletions internal/model/service_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ type ServiceDeploymentHelm struct {
Values types.String `tfsdk:"values"`
ValuesFiles types.Set `tfsdk:"values_files"`
Version types.String `tfsdk:"version"`
URL types.String `tfsdk:"url"`
}

func (this *ServiceDeploymentHelm) Attributes() *gqlclient.HelmConfigAttributes {
Expand All @@ -309,6 +310,7 @@ func (this *ServiceDeploymentHelm) Attributes() *gqlclient.HelmConfigAttributes
Chart: this.Chart.ValueStringPointer(),
Version: this.Version.ValueStringPointer(),
Repository: this.Repository.Attributes(),
URL: this.URL.ValueStringPointer(),
}
}

Expand Down
9 changes: 7 additions & 2 deletions internal/resource/service_deployment_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,13 @@ func (r *ServiceDeploymentResource) schemaHelm() schema.SingleNestedAttribute {
},
"version": schema.StringAttribute{
Optional: true,
Description: "Chart version to use",
MarkdownDescription: "Chart version to use",
Description: "Chart version to use.",
MarkdownDescription: "Chart version to use.",
},
"url": schema.StringAttribute{
Optional: true,
Description: "Helm repository URL use.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this docstring should really be Helm repository URL to use.

MarkdownDescription: "Helm repository URL use.",
},
},
Validators: []validator.Object{
Expand Down
Loading