Skip to content

Commit dfc9e39

Browse files
authored
Fix Argus Scrape Config SAML2 field default (#239)
* Fix Argus Scrape Config SAML2 field default * Adjust acceptance test
1 parent e4f2c40 commit dfc9e39

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

stackit/internal/services/argus/argus_acc_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@ func TestAccResource(t *testing.T) {
278278
scrape_interval = "%s"
279279
sample_limit = %s
280280
metrics_path = "%s"
281+
saml2 = {
282+
enable_url_parameters = false
283+
}
281284
}
282285
`,
283286
testutil.ArgusProviderConfig(),

stackit/internal/services/argus/scrapeconfig/datasource.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,11 @@ func (d *scrapeConfigDataSource) Schema(_ context.Context, _ datasource.SchemaRe
136136
Computed: true,
137137
},
138138
"saml2": schema.SingleNestedAttribute{
139-
Description: "A SAML2 configuration block",
139+
Description: "A SAML2 configuration block.",
140140
Computed: true,
141141
Attributes: map[string]schema.Attribute{
142142
"enable_url_parameters": schema.BoolAttribute{
143-
Description: "Are URL parameters be enabled?",
143+
Description: "Specifies if URL parameters are enabled",
144144
Computed: true,
145145
},
146146
},

stackit/internal/services/argus/scrapeconfig/resource.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
1717
"github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
1818
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64default"
19+
"github.com/hashicorp/terraform-plugin-framework/resource/schema/objectdefault"
1920
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
2021
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault"
2122
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
@@ -214,9 +215,20 @@ func (r *scrapeConfigResource) Schema(_ context.Context, _ resource.SchemaReques
214215
"saml2": schema.SingleNestedAttribute{
215216
Description: "A SAML2 configuration block.",
216217
Optional: true,
218+
Computed: true,
219+
Default: objectdefault.StaticValue(
220+
types.ObjectValueMust(
221+
map[string]attr.Type{
222+
"enable_url_parameters": types.BoolType,
223+
},
224+
map[string]attr.Value{
225+
"enable_url_parameters": types.BoolValue(DefaultSAML2EnableURLParameters),
226+
},
227+
),
228+
),
217229
Attributes: map[string]schema.Attribute{
218230
"enable_url_parameters": schema.BoolAttribute{
219-
Description: "Are URL parameters be enabled?",
231+
Description: "Specifies if URL parameters are enabled.",
220232
Optional: true,
221233
Computed: true,
222234
Default: booldefault.StaticBool(DefaultSAML2EnableURLParameters),

0 commit comments

Comments
 (0)