Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions docs/resources/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ A Chart is a Helm package. It contains all of the resource definitions necessary
- `set_list` (Block List) Custom list values to be merged with the values. (see [below for nested schema](#nestedblock--set_list))
- `set_sensitive` (Block Set) Custom sensitive values to be merged with the values. (see [below for nested schema](#nestedblock--set_sensitive))
- `skip_crds` (Boolean) If set, no CRDs will be installed. By default, CRDs are installed if not already present. Defaults to `false`.
- `take_ownership` (Boolean) If set, allows Helm to adopt existing resources not marked as managed by the release. Defaults to `false`.
- `timeout` (Number) Time in seconds to wait for any individual kubernetes operation. Defaults to 300 seconds.
- `upgrade_install` (Boolean) If true, the provider will install the release at the specified version even if a release not controlled by the provider is present: this is equivalent to running 'helm upgrade --install' with the Helm CLI. WARNING: this may not be suitable for production use -- see the 'Upgrade Mode' note in the provider documentation. Defaults to `false`.
- `values` (List of String) List of values in raw yaml format to pass to helm.
Expand Down
12 changes: 12 additions & 0 deletions helm/resource_helm_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ type HelmReleaseModel struct {
SetSensitive types.List `tfsdk:"set_sensitive"`
SkipCrds types.Bool `tfsdk:"skip_crds"`
Status types.String `tfsdk:"status"`
TakeOwnership types.Bool `tfsdk:"take_ownership"`
Timeout types.Int64 `tfsdk:"timeout"`
Values types.List `tfsdk:"values"`
Verify types.Bool `tfsdk:"verify"`
Expand All @@ -133,6 +134,7 @@ var defaultAttributes = map[string]interface{}{
"reset_values": false,
"reuse_values": false,
"skip_crds": false,
"take_ownership": false,
"timeout": int64(300),
"verify": false,
"wait": true,
Expand Down Expand Up @@ -486,6 +488,12 @@ func (r *HelmRelease) Schema(ctx context.Context, req resource.SchemaRequest, re
Computed: true,
Description: "Status of the release",
},
"take_ownership": schema.BoolAttribute{
Optional: true,
Computed: true,
Default: booldefault.StaticBool(defaultAttributes["take_ownership"].(bool)),
Description: "Allow helm to adopt existing resources",
},
"timeout": schema.Int64Attribute{
Optional: true,
Computed: true,
Expand Down Expand Up @@ -797,6 +805,7 @@ func (r *HelmRelease) Create(ctx context.Context, req resource.CreateRequest, re
client.Replace = state.Replace.ValueBool()
client.Description = state.Description.ValueString()
client.CreateNamespace = state.CreateNamespace.ValueBool()
client.TakeOwnership = state.TakeOwnership.ValueBool()

if state.PostRender != nil {
binaryPath := state.PostRender.BinaryPath.ValueString()
Expand Down Expand Up @@ -1009,6 +1018,7 @@ func (r *HelmRelease) Update(ctx context.Context, req resource.UpdateRequest, re
client.MaxHistory = int(plan.MaxHistory.ValueInt64())
client.CleanupOnFail = plan.CleanupOnFail.ValueBool()
client.Description = plan.Description.ValueString()
client.TakeOwnership = plan.TakeOwnership.ValueBool()

if plan.PostRender != nil {
binaryPath := plan.PostRender.BinaryPath.ValueString()
Expand Down Expand Up @@ -1865,6 +1875,7 @@ func (r *HelmRelease) ModifyPlan(ctx context.Context, req resource.ModifyPlanReq
install.Replace = plan.Replace.ValueBool()
install.Description = plan.Description.ValueString()
install.CreateNamespace = plan.CreateNamespace.ValueBool()
install.TakeOwnership = plan.TakeOwnership.ValueBool()
install.PostRenderer = client.PostRenderer

values, diags := getValues(ctx, &plan)
Expand Down Expand Up @@ -1943,6 +1954,7 @@ func (r *HelmRelease) ModifyPlan(ctx context.Context, req resource.ModifyPlanReq
upgrade.MaxHistory = int(plan.MaxHistory.ValueInt64())
upgrade.CleanupOnFail = plan.CleanupOnFail.ValueBool()
upgrade.Description = plan.Description.ValueString()
upgrade.TakeOwnership = plan.TakeOwnership.ValueBool()
upgrade.PostRenderer = client.PostRenderer

values, diags := getValues(ctx, &plan)
Expand Down