Fix Argus Scrape Config SAML2 field default (#239)

* Fix Argus Scrape Config SAML2 field default

* Adjust acceptance test
This commit is contained in:
João Palet 2024-01-31 09:05:48 +00:00 committed by GitHub
parent e4f2c40443
commit dfc9e391d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 3 deletions

View file

@ -278,6 +278,9 @@ func TestAccResource(t *testing.T) {
scrape_interval = "%s"
sample_limit = %s
metrics_path = "%s"
saml2 = {
enable_url_parameters = false
}
}
`,
testutil.ArgusProviderConfig(),

View file

@ -136,11 +136,11 @@ func (d *scrapeConfigDataSource) Schema(_ context.Context, _ datasource.SchemaRe
Computed: true,
},
"saml2": schema.SingleNestedAttribute{
Description: "A SAML2 configuration block",
Description: "A SAML2 configuration block.",
Computed: true,
Attributes: map[string]schema.Attribute{
"enable_url_parameters": schema.BoolAttribute{
Description: "Are URL parameters be enabled?",
Description: "Specifies if URL parameters are enabled",
Computed: true,
},
},

View file

@ -16,6 +16,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64default"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/objectdefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
@ -214,9 +215,20 @@ func (r *scrapeConfigResource) Schema(_ context.Context, _ resource.SchemaReques
"saml2": schema.SingleNestedAttribute{
Description: "A SAML2 configuration block.",
Optional: true,
Computed: true,
Default: objectdefault.StaticValue(
types.ObjectValueMust(
map[string]attr.Type{
"enable_url_parameters": types.BoolType,
},
map[string]attr.Value{
"enable_url_parameters": types.BoolValue(DefaultSAML2EnableURLParameters),
},
),
),
Attributes: map[string]schema.Attribute{
"enable_url_parameters": schema.BoolAttribute{
Description: "Are URL parameters be enabled?",
Description: "Specifies if URL parameters are enabled.",
Optional: true,
Computed: true,
Default: booldefault.StaticBool(DefaultSAML2EnableURLParameters),