diff --git a/docs/resources/group.md b/docs/resources/group.md index c5c2f13..3203fd4 100644 --- a/docs/resources/group.md +++ b/docs/resources/group.md @@ -331,7 +331,6 @@ Optional: Required: -- `content_administrator_uuid` (String) - `name` (String) - `owner_uuid` (String) - `technical_administrator_uuid` (String) @@ -340,6 +339,7 @@ Optional: - `abstract_provisioned_ldap` (Attributes) (see [below for nested schema](#nestedatt--administered_systems--abstract_provisioned_ldap)) - `active` (Boolean) +- `content_administrator_uuid` (String) - `organizational_unit_uuid` (String) - `provisioned_a_d` (Attributes) (see [below for nested schema](#nestedatt--administered_systems--provisioned_a_d)) - `provisioned_azure_oidc_directory` (Attributes) (see [below for nested schema](#nestedatt--administered_systems--provisioned_azure_oidc_directory)) @@ -696,7 +696,6 @@ Optional: Required: -- `content_administrator_uuid` (String) - `name` (String) - `owner_uuid` (String) - `technical_administrator_uuid` (String) @@ -705,6 +704,7 @@ Optional: - `abstract_provisioned_ldap` (Attributes) (see [below for nested schema](#nestedatt--content_administered_systems--abstract_provisioned_ldap)) - `active` (Boolean) +- `content_administrator_uuid` (String) - `organizational_unit_uuid` (String) - `provisioned_a_d` (Attributes) (see [below for nested schema](#nestedatt--content_administered_systems--provisioned_a_d)) - `provisioned_azure_oidc_directory` (Attributes) (see [below for nested schema](#nestedatt--content_administered_systems--provisioned_azure_oidc_directory)) @@ -1417,7 +1417,6 @@ Optional: Required: -- `content_administrator_uuid` (String) - `name` (String) - `owner_uuid` (String) - `technical_administrator_uuid` (String) @@ -1426,6 +1425,7 @@ Optional: - `abstract_provisioned_ldap` (Attributes) (see [below for nested schema](#nestedatt--owned_systems--abstract_provisioned_ldap)) - `active` (Boolean) +- `content_administrator_uuid` (String) - `organizational_unit_uuid` (String) - `provisioned_a_d` (Attributes) (see [below for nested schema](#nestedatt--owned_systems--provisioned_a_d)) - `provisioned_azure_oidc_directory` (Attributes) (see [below for nested schema](#nestedatt--owned_systems--provisioned_azure_oidc_directory)) @@ -1733,13 +1733,14 @@ Optional: Required: - `name` (String) -- `password_rotation` (String) - `system_uuid` (String) +- `username` (String) Optional: - `active` (Boolean) - `description` (String) +- `password_rotation` (String) - `technical_administrator_uuid` (String) Read-Only: @@ -1747,7 +1748,6 @@ Read-Only: - `links` (Attributes List) (see [below for nested schema](#nestedatt--service_accounts--links)) - `password_uuid` (String) - `permissions` (Attributes List) (see [below for nested schema](#nestedatt--service_accounts--permissions)) -- `username` (String) - `uuid` (String) diff --git a/docs/resources/grouponsystem.md b/docs/resources/grouponsystem.md index 1eae94b..7e3750c 100644 --- a/docs/resources/grouponsystem.md +++ b/docs/resources/grouponsystem.md @@ -125,6 +125,7 @@ Required: - `name` (String) - `system_uuid` (String) +- `username` (String) Optional: @@ -134,7 +135,6 @@ Read-Only: - `links` (Attributes List) (see [below for nested schema](#nestedatt--service_accounts--links)) - `permissions` (Attributes List) (see [below for nested schema](#nestedatt--service_accounts--permissions)) -- `username` (String) - `uuid` (String) diff --git a/docs/resources/serviceaccount.md b/docs/resources/serviceaccount.md index 873be3e..996c579 100644 --- a/docs/resources/serviceaccount.md +++ b/docs/resources/serviceaccount.md @@ -18,14 +18,15 @@ description: |- ### Required - `name` (String) -- `password_rotation` (String) - `system_uuid` (String) +- `username` (String) ### Optional - `active` (Boolean) - `additional` (List of String) - `description` (String) +- `password_rotation` (String) - `secret` (Attributes) (see [below for nested schema](#nestedatt--secret)) - `technical_administrator_uuid` (String) @@ -36,7 +37,6 @@ description: |- - `links` (Attributes List) (see [below for nested schema](#nestedatt--links)) - `password_uuid` (String) - `permissions` (Attributes List) (see [below for nested schema](#nestedatt--permissions)) -- `username` (String) - `uuid` (String) diff --git a/examples/provider-install-verification/main.tf b/examples/provider-install-verification/main.tf index 1ac8d36..5ba7155 100644 --- a/examples/provider-install-verification/main.tf +++ b/examples/provider-install-verification/main.tf @@ -34,7 +34,8 @@ resource "keyhubpreview_group" "terra" { client_uuid = "ebdf81ac-b02b-4335-9dc4-4a9bc4eb406d" value = "GROUP_FULL_VAULT_ACCESS" }] - additional = ["audit"] + application_administration = "true" + additional = ["audit"] } resource "keyhubpreview_group_vaultrecord" "terrarecord" { @@ -55,3 +56,31 @@ resource "keyhubpreview_grouponsystem" "terragos" { group_uuid = "c6c98d08-2cbf-45e9-937a-c5c0427348e2" }] } + +resource "keyhubpreview_clientapplication" "oauth2client" { + name = "Created by Terraform" + technical_administrator_uuid = resource.keyhubpreview_group.terra.uuid + owner_uuid = resource.keyhubpreview_group.terra.uuid + scopes = ["profile", "access_vault"] + o_auth2_client = { + debug_mode = "true" + } +} + +resource "keyhubpreview_clientapplication" "saml2client" { + name = "SAML2 Created by Terraform" + client_id = "https://keyhub-vm3" + technical_administrator_uuid = resource.keyhubpreview_group.terra.uuid + owner_uuid = resource.keyhubpreview_group.terra.uuid + saml2_client = { + subject_format = "ID" + metadata_url = "https://does.not.exist.localhost:8600/metadata" + } +} + +resource "keyhubpreview_serviceaccount" "sa" { + name = "Service account by Terraform" + technical_administrator_uuid = resource.keyhubpreview_group.terra.uuid + system_uuid = "47923975-b1af-47c8-bd7a-e52ebb4b9b84" + username = "terraform" +} diff --git a/go.mod b/go.mod index 2f82ae2..7c6746d 100644 --- a/go.mod +++ b/go.mod @@ -9,9 +9,9 @@ require ( github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 github.com/hashicorp/terraform-plugin-log v0.9.0 github.com/microsoft/kiota-abstractions-go v1.5.0 - github.com/topicuskeyhub/sdk-go v0.29.1-0.20231109164234-006d9ce6f621 - github.com/topicuskeyhub/terraform-provider-keyhub-generator v0.0.7 - golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 + github.com/topicuskeyhub/sdk-go v0.29.1-0.20231115090905-2e3dacc95093 + github.com/topicuskeyhub/terraform-provider-keyhub-generator v0.0.8 + golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa ) require ( @@ -38,7 +38,7 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.5.2 // indirect + github.com/hashicorp/go-plugin v1.6.0 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/hc-install v0.5.2 // indirect @@ -72,9 +72,9 @@ require ( github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/zclconf/go-cty v1.14.1 // indirect - go.opentelemetry.io/otel v1.19.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.opentelemetry.io/otel v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/trace v1.20.0 // indirect golang.org/x/crypto v0.15.0 // indirect golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.18.0 // indirect diff --git a/go.sum b/go.sum index 443fe81..8315f80 100644 --- a/go.sum +++ b/go.sum @@ -75,8 +75,8 @@ github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVH github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-plugin v1.5.2 h1:aWv8eimFqWlsEiMrYZdPYl+FdHaBJSN4AWwGWfT1G2Y= -github.com/hashicorp/go-plugin v1.5.2/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= +github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= +github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -180,10 +180,10 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/topicuskeyhub/sdk-go v0.29.1-0.20231109164234-006d9ce6f621 h1:PowF/Yqu7EktfF5TCP7fJzxGqbgOCaJZeNOajVi9J2E= -github.com/topicuskeyhub/sdk-go v0.29.1-0.20231109164234-006d9ce6f621/go.mod h1:PUxjT3L5DlYaftJjcPjsLHZ0PxIuGvrOm9XYhS4KZZQ= -github.com/topicuskeyhub/terraform-provider-keyhub-generator v0.0.7 h1:D+iCJ+pamsUDuIbOwV+nGQo0d9S6V1A253GqeuA3cqY= -github.com/topicuskeyhub/terraform-provider-keyhub-generator v0.0.7/go.mod h1:A7GmW/HaeHNr9Y9vF1FmaxZ6e8ByvrWZmDFh1ELzOTE= +github.com/topicuskeyhub/sdk-go v0.29.1-0.20231115090905-2e3dacc95093 h1:p7OfnBznCA59fRB+E9GL8qxuIAKA+ixdvNcyBWp4MDY= +github.com/topicuskeyhub/sdk-go v0.29.1-0.20231115090905-2e3dacc95093/go.mod h1:0I6HAiTtujy+fsOaCT78L6/wflACImwejPcSfAWKPbU= +github.com/topicuskeyhub/terraform-provider-keyhub-generator v0.0.8 h1:FltyUDCUkhpd8zq+8AQgcLx54tkf9S0lvOuDKK06cvQ= +github.com/topicuskeyhub/terraform-provider-keyhub-generator v0.0.8/go.mod h1:Cneu5QPgWXynzT5IzOW6sX9aAxypPQArE44f0fLyIvg= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= @@ -193,12 +193,12 @@ github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.14.1 h1:t9fyA35fwjjUMcmL5hLER+e/rEPqrbCK1/OSE4SI9KA= github.com/zclconf/go-cty v1.14.1/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= -go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= -go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= -go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= -go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= -go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= -go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= +go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= +go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= +go.opentelemetry.io/otel/metric v1.20.0 h1:ZlrO8Hu9+GAhnepmRGhSU7/VkpjrNowxRN9GyKR4wzA= +go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM= +go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= +go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -206,8 +206,8 @@ golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= -golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 h1:mchzmB1XO2pMaKFRqk/+MV3mgGG96aqaPXaMifQU47w= -golang.org/x/exp v0.0.0-20231108232855-2478ac86f678/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= +golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= +golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= diff --git a/internal/provider/full-helpers.go b/internal/provider/full-helpers.go index 4b9508b..1b92180 100644 --- a/internal/provider/full-helpers.go +++ b/internal/provider/full-helpers.go @@ -515,8 +515,11 @@ func errorReportToString(ctx context.Context, err error) string { var msg string if report.GetApplicationError() == nil { msg = fmt.Sprintf("Error %d from backend: %s", *report.GetCode(), stringPointerToString(report.GetMessage())) - } else { + } else if report.GetApplicationErrorParameters() == nil { msg = fmt.Sprintf("Error %d (%s) from backend: %s", *report.GetCode(), *report.GetApplicationError(), stringPointerToString(report.GetMessage())) + } else { + msg = fmt.Sprintf("Error %d (%s:%v) from backend: %s", *report.GetCode(), *report.GetApplicationError(), + filterErrorParameters(report.GetApplicationErrorParameters().GetAdditionalData()), stringPointerToString(report.GetMessage())) } tflog.Info(ctx, msg) if report.GetStacktrace() != nil { @@ -525,6 +528,16 @@ func errorReportToString(ctx context.Context, err error) string { return msg } +func filterErrorParameters(params map[string]any) map[string]string { + ret := make(map[string]string) + for k, v := range params { + if str, ok := v.(*string); ok { + ret[k] = *str + } + } + return ret +} + func stringPointerToString(input *string) string { if input != nil { return *input diff --git a/internal/provider/full-schema-rs.go b/internal/provider/full-schema-rs.go index 0759bfb..9c4fe8b 100644 --- a/internal/provider/full-schema-rs.go +++ b/internal/provider/full-schema-rs.go @@ -12,12 +12,14 @@ import ( "github.com/hashicorp/terraform-plugin-framework-validators/int64validator" "github.com/hashicorp/terraform-plugin-framework-validators/listvalidator" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" rsschema "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/boolplanmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/int64default" "github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/mapdefault" "github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" @@ -340,6 +342,7 @@ func resourceSchemaAttrsClientClientApplication(recurse bool) map[string]rsschem PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}, } schemaAttrs["client_id"] = rsschema.StringAttribute{ + Computed: true, Optional: true, Validators: []validator.String{ stringvalidator.UTF8LengthBetween(0, 255), @@ -354,6 +357,7 @@ func resourceSchemaAttrsClientClientApplication(recurse bool) map[string]rsschem schemaAttrs["scopes"] = rsschema.ListAttribute{ ElementType: types.StringType, Optional: true, + Computed: true, } schemaAttrs["sso_application"] = rsschema.BoolAttribute{ Computed: true, @@ -367,12 +371,14 @@ func resourceSchemaAttrsClientClientApplication(recurse bool) map[string]rsschem Computed: true, } schemaAttrs["owner_uuid"] = rsschema.StringAttribute{ + Computed: true, Optional: true, Validators: []validator.String{ stringvalidator.RegexMatches(regexp.MustCompile("[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"), "The value must be a valid UUID"), }, } schemaAttrs["technical_administrator_uuid"] = rsschema.StringAttribute{ + Computed: true, Optional: true, Validators: []validator.String{ stringvalidator.RegexMatches(regexp.MustCompile("[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"), "The value must be a valid UUID"), @@ -432,6 +438,7 @@ func resourceSchemaAttrsClientClientApplicationPrimer(recurse bool) map[string]r PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}, } schemaAttrs["client_id"] = rsschema.StringAttribute{ + Computed: true, Optional: true, Validators: []validator.String{ stringvalidator.UTF8LengthBetween(0, 255), @@ -446,6 +453,7 @@ func resourceSchemaAttrsClientClientApplicationPrimer(recurse bool) map[string]r schemaAttrs["scopes"] = rsschema.ListAttribute{ ElementType: types.StringType, Optional: true, + Computed: true, } schemaAttrs["sso_application"] = rsschema.BoolAttribute{ Computed: true, @@ -484,6 +492,7 @@ func resourceSchemaAttrsClientClientApplication_additionalObjects(recurse bool) Attributes: resourceSchemaAttrsGeneratedSecret(recurse), } attr.Optional = true + attr.Computed = true schemaAttrs["secret"] = attr } { @@ -533,6 +542,8 @@ func resourceSchemaAttrsClientOAuth2Client(recurse bool) map[string]rsschema.Att schemaAttrs["attributes"] = rsschema.MapAttribute{ ElementType: types.StringType, Optional: true, + Computed: true, + Default: mapdefault.StaticValue(types.MapValueMust(types.StringType, make(map[string]attr.Value))), } schemaAttrs["callback_uri"] = rsschema.StringAttribute{ Optional: true, @@ -719,6 +730,8 @@ func resourceSchemaAttrsClientSaml2Client(recurse bool) map[string]rsschema.Attr schemaAttrs["attributes"] = rsschema.MapAttribute{ ElementType: types.StringType, Optional: true, + Computed: true, + Default: mapdefault.StaticValue(types.MapValueMust(types.StringType, make(map[string]attr.Value))), } schemaAttrs["metadata"] = rsschema.StringAttribute{ Optional: true, @@ -2210,6 +2223,8 @@ func resourceSchemaAttrsMarkItemMarker(recurse bool) map[string]rsschema.Attribu schemaAttrs["parameters"] = rsschema.MapAttribute{ ElementType: types.StringType, Optional: true, + Computed: true, + Default: mapdefault.StaticValue(types.MapValueMust(types.StringType, make(map[string]attr.Value))), } return schemaAttrs } @@ -2413,6 +2428,8 @@ func resourceSchemaAttrsProvisioningAbstractProvisionedLDAP(recurse bool) map[st schemaAttrs["attributes"] = rsschema.MapAttribute{ ElementType: types.StringType, Optional: true, + Computed: true, + Default: mapdefault.StaticValue(types.MapValueMust(types.StringType, make(map[string]attr.Value))), } schemaAttrs["base_dn"] = rsschema.StringAttribute{ Required: true, @@ -2974,6 +2991,7 @@ func resourceSchemaAttrsProvisioningProvisionedSystem(recurse bool) map[string]r }, } schemaAttrs["organizational_unit_uuid"] = rsschema.StringAttribute{ + Computed: true, Optional: true, Validators: []validator.String{ stringvalidator.RegexMatches(regexp.MustCompile("[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"), "The value must be a valid UUID"), @@ -2991,7 +3009,7 @@ func resourceSchemaAttrsProvisioningProvisionedSystem(recurse bool) map[string]r Computed: true, } schemaAttrs["content_administrator_uuid"] = rsschema.StringAttribute{ - Required: true, + Optional: true, Validators: []validator.String{ stringvalidator.RegexMatches(regexp.MustCompile("[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"), "The value must be a valid UUID"), }, @@ -3145,6 +3163,7 @@ func resourceSchemaAttrsProvisioningProvisionedSystemPrimer(recurse bool) map[st }, } schemaAttrs["organizational_unit_uuid"] = rsschema.StringAttribute{ + Computed: true, Optional: true, Validators: []validator.String{ stringvalidator.RegexMatches(regexp.MustCompile("[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"), "The value must be a valid UUID"), @@ -3291,8 +3310,10 @@ func resourceSchemaAttrsServiceaccountServiceAccount(recurse bool) map[string]rs }, } schemaAttrs["username"] = rsschema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}, + Required: true, + Validators: []validator.String{ + stringvalidator.UTF8LengthBetween(0, 255), + }, } schemaAttrs["uuid"] = rsschema.StringAttribute{ Computed: true, @@ -3305,7 +3326,9 @@ func resourceSchemaAttrsServiceaccountServiceAccount(recurse bool) map[string]rs Computed: true, } schemaAttrs["password_rotation"] = rsschema.StringAttribute{ - Required: true, + Computed: true, + Optional: true, + Default: stringdefault.StaticString("DAILY"), Validators: []validator.String{ stringvalidator.OneOf( "MANUAL", "MANUAL_STORED_IN_VAULT", "DAILY", @@ -3437,8 +3460,10 @@ func resourceSchemaAttrsServiceaccountServiceAccountPrimer(recurse bool) map[str }, } schemaAttrs["username"] = rsschema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}, + Required: true, + Validators: []validator.String{ + stringvalidator.UTF8LengthBetween(0, 255), + }, } schemaAttrs["uuid"] = rsschema.StringAttribute{ Computed: true,