diff --git a/integrations/terraform/Makefile b/integrations/terraform/Makefile index b9d1c49a25a3a..21901e845f308 100644 --- a/integrations/terraform/Makefile +++ b/integrations/terraform/Makefile @@ -65,6 +65,18 @@ endif --terraform_out=config=protoc-gen-terraform-teleport.yaml:./tfschema \ teleport/legacy/types/types.proto + mv ./tfschema/github.com/gravitational/teleport/api/types/types_terraform.go ./tfschema/ + + @protoc \ + -I=../../api/proto \ + -I=$(PROTOBUF_MOD_PATH) \ + --plugin=$(GENTERRAFORMPATH)/protoc-gen-terraform \ + --terraform_out=config=protoc-gen-terraform-teleport-token.yaml:./tfschema \ + teleport/legacy/types/types.proto + + mkdir -p ./tfschema/token + mv ./tfschema/github.com/gravitational/teleport/api/types/types_terraform.go ./tfschema/token/ + @protoc \ -I=../../api/proto \ -I=$(PROTOBUF_MOD_PATH) \ @@ -86,7 +98,6 @@ endif --terraform_out=config=protoc-gen-terraform-accesslist.yaml:./tfschema \ teleport/accesslist/v1/accesslist.proto - mv ./tfschema/github.com/gravitational/teleport/api/types/types_terraform.go ./tfschema/ mv ./tfschema/github.com/gravitational/teleport/api/gen/proto/go/teleport/loginrule/v1/loginrule_terraform.go ./tfschema/loginrule/v1/ mv ./tfschema/github.com/gravitational/teleport/api/gen/proto/go/teleport/accesslist/v1/accesslist_terraform.go ./tfschema/accesslist/v1/ mv ./tfschema/github.com/gravitational/teleport/api/types/device_terraform.go ./tfschema/devicetrust/v1/ diff --git a/integrations/terraform/gen/main.go b/integrations/terraform/gen/main.go index 090d028e2f38e..047a3d7213e0e 100644 --- a/integrations/terraform/gen/main.go +++ b/integrations/terraform/gen/main.go @@ -38,6 +38,7 @@ import ( accesslistSchema "github.com/gravitational/teleport/integrations/terraform/tfschema/accesslist/v1" devicetrustSchema "github.com/gravitational/teleport/integrations/terraform/tfschema/devicetrust/v1" loginruleSchema "github.com/gravitational/teleport/integrations/terraform/tfschema/loginrule/v1" + tokenSchema "github.com/gravitational/teleport/integrations/terraform/tfschema/token" ) // payload represents template payload @@ -289,6 +290,8 @@ var ( Kind: "token", HasStaticID: false, ExtraImports: []string{"strconv"}, + SchemaPackage: "token", + SchemaPackagePath: "github.com/gravitational/teleport/integrations/terraform/tfschema/token", TerraformResourceType: "teleport_provision_token", HasCheckAndSetDefaults: true, } @@ -564,7 +567,7 @@ var ( "login_rule": loginruleSchema.GenSchemaLoginRule, "okta_import_rule": tfschema.GenSchemaOktaImportRuleV1, "oidc_connector": tfschema.GenSchemaOIDCConnectorV3, - "provision_token": tfschema.GenSchemaProvisionTokenV2, + "provision_token": tokenSchema.GenSchemaProvisionTokenV2, "role": tfschema.GenSchemaRoleV6, "saml_connector": tfschema.GenSchemaSAMLConnectorV2, "session_recording_config": tfschema.GenSchemaSessionRecordingConfigV2, diff --git a/integrations/terraform/protoc-gen-terraform-teleport-token.yaml b/integrations/terraform/protoc-gen-terraform-teleport-token.yaml new file mode 100644 index 0000000000000..102c33a2d74db --- /dev/null +++ b/integrations/terraform/protoc-gen-terraform-teleport-token.yaml @@ -0,0 +1,89 @@ +--- +target_package_name: "token" +default_package_name: "github.com/gravitational/teleport/api/types" +duration_custom_type: Duration +use_state_for_unknown_by_default: true + +# Top-level type names to export +types: + - "ProvisionTokenV2" + +# These import paths were not being automatically picked up by +# protoc-gen-terraform without these overrides +import_path_overrides: + github_com_gravitational_teleport_integrations_terraform_tfschema: "github.com/gravitational/teleport/integrations/terraform/tfschema" + +# id field is required for integration tests. It is not used by provider. +# We have to add it manually (might be removed in the future versions). +injected_fields: + ProvisionTokenV2: + - + name: id + type: github.com/hashicorp/terraform-plugin-framework/types.StringType + computed: true + plan_modifiers: + - "github.com/hashicorp/terraform-plugin-framework/tfsdk.UseStateForUnknown()" + +# These fields will be excluded +exclude_fields: + # Metadata (we id resources by name on our side) + - "Metadata.ID" + +name_overrides: + +# These fields will be marked as Computed: true +computed_fields: + # Metadata + - "Metadata.Namespace" + + # Provision token + - "ProvisionTokenV2.Spec.AWSIIDTTL" + - "ProvisionTokenV2.Kind" + - "ProvisionTokenV2.Metadata.Name" + +# These fields will be marked as Required: true +required_fields: + # Provision token + - "ProvisionTokenV2.Spec" + - "ProvisionTokenV2.Spec.Options" + - "ProvisionTokenV2.Spec.Roles" + - "ProvisionTokenV2.Version" + +# These fields must be marked as sensitive +sensitive_fields: + - "ProvisionTokenV2.Metadata.Name" + +# These suffixes for custom methods called when field has custom_type flag. By default they might be weird. +suffixes: + "BoolOption": "BoolOptionNullable" + "Labels": "Labels" + "github.com/gravitational/teleport/api/types/wrappers.Traits": "Traits" + "github.com/gravitational/teleport/api/types/wrappers.Strings": "Strings" + +plan_modifiers: + # Force to recreate resource if it's name changes + Metadata.Name: + - "github.com/hashicorp/terraform-plugin-framework/tfsdk.RequiresReplace()" + ProvisionTokenV2.Metadata.Name: + - "github.com/hashicorp/terraform-plugin-framework/tfsdk.RequiresReplace()" + - "github.com/hashicorp/terraform-plugin-framework/tfsdk.UseStateForUnknown()" + +validators: + # Expires must be in the future + Metadata.Expires: + - github_com_gravitational_teleport_integrations_terraform_tfschema.MustTimeBeInFuture() + ProvisionTokenV2.Version: + - github_com_gravitational_teleport_integrations_terraform_tfschema.UseVersionBetween(2,2) + +time_type: + type: "github.com/gravitational/teleport/integrations/terraform/tfschema.TimeType" + value_type: "github.com/gravitational/teleport/integrations/terraform/tfschema.TimeValue" + cast_to_type: "time.Time" + cast_from_type: "time.Time" + type_constructor: "github.com/gravitational/teleport/integrations/terraform/tfschema.UseRFC3339Time()" + +duration_type: + type: "github.com/gravitational/teleport/integrations/terraform/tfschema.DurationType" + value_type: "github.com/gravitational/teleport/integrations/terraform/tfschema.DurationValue" + cast_to_type: "time.Duration" + cast_from_type: "time.Duration" diff --git a/integrations/terraform/protoc-gen-terraform-teleport.yaml b/integrations/terraform/protoc-gen-terraform-teleport.yaml index b4ca7b9c922b8..3468d2f4ec2a2 100644 --- a/integrations/terraform/protoc-gen-terraform-teleport.yaml +++ b/integrations/terraform/protoc-gen-terraform-teleport.yaml @@ -14,7 +14,6 @@ types: - "GithubConnectorV3" - "OIDCConnectorV3" - "OktaImportRuleV1" - - "ProvisionTokenV2" - "RoleV6" - "SAMLConnectorV2" - "ServerV2" @@ -81,13 +80,6 @@ injected_fields: computed: true plan_modifiers: - "github.com/hashicorp/terraform-plugin-framework/tfsdk.UseStateForUnknown()" - ProvisionTokenV2: - - - name: id - type: github.com/hashicorp/terraform-plugin-framework/types.StringType - computed: true - plan_modifiers: - - "github.com/hashicorp/terraform-plugin-framework/tfsdk.UseStateForUnknown()" RoleV6: - name: id @@ -198,11 +190,6 @@ computed_fields: # Github connector - "GithubConnectorV3.Kind" - # Provision token - - "ProvisionTokenV2.Spec.AWSIIDTTL" - - "ProvisionTokenV2.Kind" - - "ProvisionTokenV2.Metadata.Name" - # OIDC connector - "OIDCConnectorV3.Kind" @@ -311,12 +298,6 @@ required_fields: - "OktaImportRuleV1.Metadata.Name" - "OktaImportRuleV1.Version" - # Provision token - - "ProvisionTokenV2.Spec" - - "ProvisionTokenV2.Spec.Options" - - "ProvisionTokenV2.Spec.Roles" - - "ProvisionTokenV2.Version" - # Role - "RoleV6.Metadata.Name" - "RoleV6.Version" @@ -347,7 +328,6 @@ required_fields: # These fields must be marked as sensitive sensitive_fields: - - "ProvisionTokenV2.Metadata.Name" - "SAMLConnectorV2.Spec.Cert" - "SAMLConnectorV2.Spec.SigningKeyPair.PrivateKey" - "SAMLConnectorV2.Spec.EncryptionKeyPair.PrivateKey" @@ -368,9 +348,6 @@ plan_modifiers: # Force to recreate resource if it's name changes Metadata.Name: - "github.com/hashicorp/terraform-plugin-framework/tfsdk.RequiresReplace()" - ProvisionTokenV2.Metadata.Name: - - "github.com/hashicorp/terraform-plugin-framework/tfsdk.RequiresReplace()" - - "github.com/hashicorp/terraform-plugin-framework/tfsdk.UseStateForUnknown()" ServerV2.Metadata.Name: - "github.com/hashicorp/terraform-plugin-framework/tfsdk.UseStateForUnknown()" - "github.com/hashicorp/terraform-plugin-framework/tfsdk.RequiresReplace()" @@ -399,8 +376,6 @@ validators: - UseVersionBetween(3,3) OktaImportRuleV1.Version: - UseVersionBetween(1,1) - ProvisionTokenV2.Version: - - UseVersionBetween(2,2) RoleV6.Version: - UseVersionBetween(3,7) SAMLConnectorV2.Version: diff --git a/integrations/terraform/provider/data_source_teleport_provision_token.go b/integrations/terraform/provider/data_source_teleport_provision_token.go index adc0180be6c75..aedc7747f462d 100755 --- a/integrations/terraform/provider/data_source_teleport_provision_token.go +++ b/integrations/terraform/provider/data_source_teleport_provision_token.go @@ -27,7 +27,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/tfsdk" "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/gravitational/teleport/integrations/terraform/tfschema" + token "github.com/gravitational/teleport/integrations/terraform/tfschema/token" ) // dataSourceTeleportProvisionTokenType is the data source metadata type @@ -40,7 +40,7 @@ type dataSourceTeleportProvisionToken struct { // GetSchema returns the data source schema func (r dataSourceTeleportProvisionTokenType) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagnostics) { - return tfschema.GenSchemaProvisionTokenV2(ctx) + return token.GenSchemaProvisionTokenV2(ctx) } // NewDataSource creates the empty data source @@ -68,7 +68,7 @@ func (r dataSourceTeleportProvisionToken) Read(ctx context.Context, req tfsdk.Re var state types.Object provisionToken := provisionTokenI.(*apitypes.ProvisionTokenV2) - diags = tfschema.CopyProvisionTokenV2ToTerraform(ctx, provisionToken, &state) + diags = token.CopyProvisionTokenV2ToTerraform(ctx, provisionToken, &state) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { return diff --git a/integrations/terraform/provider/resource_teleport_provision_token.go b/integrations/terraform/provider/resource_teleport_provision_token.go index eed7283bf5849..d549c6a560d70 100755 --- a/integrations/terraform/provider/resource_teleport_provision_token.go +++ b/integrations/terraform/provider/resource_teleport_provision_token.go @@ -34,7 +34,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/jonboulle/clockwork" - "github.com/gravitational/teleport/integrations/terraform/tfschema" + token "github.com/gravitational/teleport/integrations/terraform/tfschema/token" ) // resourceTeleportProvisionTokenType is the resource metadata type @@ -47,7 +47,7 @@ type resourceTeleportProvisionToken struct { // GetSchema returns the resource schema func (r resourceTeleportProvisionTokenType) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagnostics) { - return tfschema.GenSchemaProvisionTokenV2(ctx) + return token.GenSchemaProvisionTokenV2(ctx) } // NewResource creates the empty resource @@ -72,7 +72,7 @@ func (r resourceTeleportProvisionToken) Create(ctx context.Context, req tfsdk.Cr } provisionToken := &apitypes.ProvisionTokenV2{} - diags = tfschema.CopyProvisionTokenV2FromTerraform(ctx, plan, provisionToken) + diags = token.CopyProvisionTokenV2FromTerraform(ctx, plan, provisionToken) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { return @@ -151,7 +151,7 @@ func (r resourceTeleportProvisionToken) Create(ctx context.Context, req tfsdk.Cr } provisionToken = provisionTokenResource - diags = tfschema.CopyProvisionTokenV2ToTerraform(ctx, provisionToken, &plan) + diags = token.CopyProvisionTokenV2ToTerraform(ctx, provisionToken, &plan) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { return @@ -194,7 +194,7 @@ func (r resourceTeleportProvisionToken) Read(ctx context.Context, req tfsdk.Read } provisionToken := provisionTokenI.(*apitypes.ProvisionTokenV2) - diags = tfschema.CopyProvisionTokenV2ToTerraform(ctx, provisionToken, &state) + diags = token.CopyProvisionTokenV2ToTerraform(ctx, provisionToken, &state) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { return @@ -222,7 +222,7 @@ func (r resourceTeleportProvisionToken) Update(ctx context.Context, req tfsdk.Up } provisionToken := &apitypes.ProvisionTokenV2{} - diags = tfschema.CopyProvisionTokenV2FromTerraform(ctx, plan, provisionToken) + diags = token.CopyProvisionTokenV2FromTerraform(ctx, plan, provisionToken) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { return @@ -280,7 +280,7 @@ func (r resourceTeleportProvisionToken) Update(ctx context.Context, req tfsdk.Up resp.Diagnostics.Append(diagFromWrappedErr("Error reading ProvisionToken", trace.Errorf("Can not convert %T to ProvisionTokenV2", provisionTokenI), "token")) return } - diags = tfschema.CopyProvisionTokenV2ToTerraform(ctx, provisionToken, &plan) + diags = token.CopyProvisionTokenV2ToTerraform(ctx, provisionToken, &plan) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { return @@ -330,7 +330,7 @@ func (r resourceTeleportProvisionToken) ImportState(ctx context.Context, req tfs return } - diags = tfschema.CopyProvisionTokenV2ToTerraform(ctx, provisionTokenResource, &state) + diags = token.CopyProvisionTokenV2ToTerraform(ctx, provisionTokenResource, &state) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { return diff --git a/integrations/terraform/reference.mdx b/integrations/terraform/reference.mdx index ba9121d297cea..3289e888f777d 100755 --- a/integrations/terraform/reference.mdx +++ b/integrations/terraform/reference.mdx @@ -1415,6 +1415,7 @@ Spec is a provisioning token V2 spec | spacelift | object | | Spacelift allows the configuration of options specific to the "spacelift" join method. | | suggested_agent_matcher_labels | map of string arrays | | | | suggested_labels | map of string arrays | | | +| tpm | object | | TPM allows the configuration of options specific to the "tpm" join method. | #### spec.allow @@ -1518,24 +1519,24 @@ GitLab allows the configuration of options specific to the "gitlab" join method. Allow is a list of TokenRules, nodes using this token must match one allow rule to use this token. -| Name | Type | Required | Description | -|-----------------------|--------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| ci_config_ref_uri | string | | CIConfigRefURI is the ref path to the top-level pipeline definition, for example, gitlab.example.com/my-group/my-project//.gitlab-ci.yml@refs/heads/main. | -| ci_config_sha | string | | CIConfigSHA is the git commit SHA for the ci_config_ref_uri. | -| deployment_tier | string | | DeploymentTier is the deployment tier of the environment the job specifies | -| environment | string | | Environment limits access by the environment the job deploys to (if one is associated) | -| environment_protected | bool | | | -| namespace_path | string | | NamespacePath is used to limit access to jobs in a group or user's projects. Example: `mygroup` This field supports simple "glob-style" matching: - Use '*' to match zero or more characters. - Use '?' to match any single character. | -| pipeline_source | string | | PipelineSource limits access by the job pipeline source type. https://docs.gitlab.com/ee/ci/jobs/job_control.html#common-if-clauses-for-rules Example: `web` | -| project_path | string | | ProjectPath is used to limit access to jobs belonging to an individual project. Example: `mygroup/myproject` This field supports simple "glob-style" matching: - Use '*' to match zero or more characters. - Use '?' to match any single character. | -| project_visibility | string | | ProjectVisibility is the visibility of the project where the pipeline is running. Can be internal, private, or public. | -| ref | string | | Ref allows access to be limited to jobs triggered by a specific git ref. Ensure this is used in combination with ref_type. This field supports simple "glob-style" matching: - Use '*' to match zero or more characters. - Use '?' to match any single character. | -| ref_protected | bool | | | -| ref_type | string | | RefType allows access to be limited to jobs triggered by a specific git ref type. Example: `branch` or `tag` | -| sub | string | | Sub roughly uniquely identifies the workload. Example: `project_path:mygroup/my-project:ref_type:branch:ref:main` project_path:GROUP/PROJECT:ref_type:TYPE:ref:BRANCH_NAME This field supports simple "glob-style" matching: - Use '*' to match zero or more characters. - Use '?' to match any single character. | -| user_email | string | | UserEmail is the email of the user executing the job | -| user_id | string | | UserID is the ID of the user executing the job | -| user_login | string | | UserLogin is the username of the user executing the job | +| Name | Type | Required | Description | +|-----------------------|--------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| ci_config_ref_uri | string | | CIConfigRefURI is the ref path to the top-level pipeline definition, for example, gitlab.example.com/my-group/my-project//.gitlab-ci.yml@refs/heads/main. | +| ci_config_sha | string | | CIConfigSHA is the git commit SHA for the ci_config_ref_uri. | +| deployment_tier | string | | DeploymentTier is the deployment tier of the environment the job specifies | +| environment | string | | Environment limits access by the environment the job deploys to (if one is associated) | +| environment_protected | bool | | | +| namespace_path | string | | NamespacePath is used to limit access to jobs in a group or user's projects. Example: `mygroup` This field supports simple "glob-style" matching: - Use '*' to match zero or more characters. - Use '?' to match any single character. | +| pipeline_source | string | | PipelineSource limits access by the job pipeline source type. https://docs.gitlab.com/ee/ci/jobs/job_control.html#common-if-clauses-for-rules Example: `web` | +| project_path | string | | ProjectPath is used to limit access to jobs belonging to an individual project. Example: `mygroup/myproject` This field supports simple "glob-style" matching: - Use '*' to match zero or more characters. - Use '?' to match any single character. | +| project_visibility | string | | ProjectVisibility is the visibility of the project where the pipeline is running. Can be internal, private, or public. | +| ref | string | | Ref allows access to be limited to jobs triggered by a specific git ref. Ensure this is used in combination with ref_type. This field supports simple "glob-style" matching: - Use '*' to match zero or more characters. - Use '?' to match any single character. | +| ref_protected | bool | | | +| ref_type | string | | RefType allows access to be limited to jobs triggered by a specific git ref type. Example: `branch` or `tag` | +| sub | string | | Sub roughly uniquely identifies the workload. Example: `project_path:mygroup/my-project:ref_type:branch:ref:main` project_path:{group}/{project}:ref_type:{type}:ref:{branch_name} This field supports simple "glob-style" matching: - Use '*' to match zero or more characters. - Use '?' to match any single character. | +| user_email | string | | UserEmail is the email of the user executing the job | +| user_id | string | | UserID is the ID of the user executing the job | +| user_login | string | | UserLogin is the username of the user executing the job | #### spec.kubernetes @@ -1583,6 +1584,25 @@ Allow is a list of Rules, nodes using this token must match one allow rule to us | scope | string | | Scope is the scope of the token - either `read` or `write`. See https://docs.spacelift.io/integrations/cloud-providers/oidc/#about-scopes | | space_id | string | | SpaceID is the ID of the space in which the run that owns the token was executed. | +#### spec.tpm + +TPM allows the configuration of options specific to the "tpm" join method. + +| Name | Type | Required | Description | +|--------------------|------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| allow | object | | Allow is a list of Rules, the presented delegated identity must match one allow rule to permit joining. | +| ekcert_allowed_cas | array of strings | | EKCertAllowedCAs is a list of CA certificates that will be used to validate TPM EKCerts. When specified, joining TPMs must present an EKCert signed by one of the specified CAs. TPMs that do not present an EKCert will be not permitted to join. When unspecified, TPMs will be allowed to join with either an EKCert or an EKPubHash. | + +##### spec.tpm.allow + +Allow is a list of Rules, the presented delegated identity must match one allow rule to permit joining. + +| Name | Type | Required | Description | +|-----------------------|--------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| description | string | | Description is a human-readable description of the rule. It has no bearing on whether or not a TPM is allowed to join, but can be used to associate a rule with a specific host (e.g the asset tag of the server in which the TPM resides). Example: "build-server-100" | +| ek_certificate_serial | string | | EKCertificateSerial is the serial number of the EKCert in hexadecimal with colon separated nibbles. This value will not be checked when a TPM does not have an EKCert configured. Example: 73:df:dc:bd:af:ef:8a:d8:15:2e:96:71:7a:3e:7f:a4 | +| ek_public_hash | string | | EKPublicHash is the SHA256 hash of the EKPub marshaled in PKIX format and encoded in hexadecimal. This value will also be checked when a TPM has submitted an EKCert, and the public key in the EKCert will be used for this check. Example: d4b45864d9d6fabfc568d74f26c35ababde2105337d7af9a6605e1c56c891aa6 | + Example: ``` @@ -2564,6 +2584,7 @@ resource "teleport_trusted_device" "TESTDEVICE1" { |----------|--------|----------|------------------------------------------------------------------------------------| | metadata | object | | Metadata is resource metadata | | spec | object | | Spec is a user specification | +| status | object | | | | sub_kind | string | | SubKind is an optional resource sub kind, used in some resources | | version | string | * | Version is the resource version. It must be specified. Supported values are: `v2`. | @@ -2620,6 +2641,14 @@ SAMLIdentities lists associated SAML identities that let user log in using exter | connector_id | string | | ConnectorID is id of registered OIDC connector, e.g. 'google-example.com' | | username | string | | Username is username supplied by external identity provider | +### status + + + +| Name | Type | Required | Description | +|----------------|--------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| password_state | number | | password_state reflects what the system knows about the user's password. Note that this is a "best effort" property, in that it can be UNSPECIFIED for users who were created before this property was introduced and didn't perform any password-related activity since then. See RFD 0159 for details. Do NOT use this value for authentication purposes! | + Example: ``` diff --git a/integrations/terraform/testlib/fixtures/provision_token_v2_gitlab_0_create.tf b/integrations/terraform/testlib/fixtures/provision_token_v2_gitlab_0_create.tf new file mode 100644 index 0000000000000..b8725eee91b1b --- /dev/null +++ b/integrations/terraform/testlib/fixtures/provision_token_v2_gitlab_0_create.tf @@ -0,0 +1,21 @@ +resource "teleport_provision_token" "token" { + version = "v2" + metadata = { + name = "gitlab-test-terraform" + description = "" + } + + spec = { + roles = ["Bot"] + join_method = "gitlab" + bot_name = "gitlab-bot" + gitlab = { + domain = "bug.report" + allow = [ + { + project_path = "my-repo" + } + ] + } + } +} diff --git a/integrations/terraform/testlib/fixtures/provision_token_v2_gitlab_1_update.tf b/integrations/terraform/testlib/fixtures/provision_token_v2_gitlab_1_update.tf new file mode 100644 index 0000000000000..702e7ad90dd82 --- /dev/null +++ b/integrations/terraform/testlib/fixtures/provision_token_v2_gitlab_1_update.tf @@ -0,0 +1,22 @@ +resource "teleport_provision_token" "token" { + version = "v2" + metadata = { + name = "gitlab-test-terraform" + description = "" + } + + spec = { + roles = ["Bot"] + join_method = "gitlab" + bot_name = "gitlab-bot" + gitlab = { + domain = "bug.report" + allow = [ + { + project_path = "my-repo" + environment_protected = true + } + ] + } + } +} diff --git a/integrations/terraform/testlib/fixtures/provision_token_v2_gitlab_2_update.tf b/integrations/terraform/testlib/fixtures/provision_token_v2_gitlab_2_update.tf new file mode 100644 index 0000000000000..b8725eee91b1b --- /dev/null +++ b/integrations/terraform/testlib/fixtures/provision_token_v2_gitlab_2_update.tf @@ -0,0 +1,21 @@ +resource "teleport_provision_token" "token" { + version = "v2" + metadata = { + name = "gitlab-test-terraform" + description = "" + } + + spec = { + roles = ["Bot"] + join_method = "gitlab" + bot_name = "gitlab-bot" + gitlab = { + domain = "bug.report" + allow = [ + { + project_path = "my-repo" + } + ] + } + } +} diff --git a/integrations/terraform/testlib/provision_token_test.go b/integrations/terraform/testlib/provision_token_test.go index c9bbb3f5c1ca8..2a636cc43db0a 100644 --- a/integrations/terraform/testlib/provision_token_test.go +++ b/integrations/terraform/testlib/provision_token_test.go @@ -313,3 +313,71 @@ func (s *TerraformSuiteOSS) TestProvisionTokenIAMToken() { }, }) } + +func (s *TerraformSuiteOSS) TestProvisionTokenV2Gitlab() { + ctx, cancel := context.WithCancel(context.Background()) + s.T().Cleanup(cancel) + + checkRoleDestroyed := func(state *terraform.State) error { + _, err := s.client.GetToken(ctx, "test") + if trace.IsNotFound(err) { + return nil + } + + return err + } + + name := "teleport_provision_token.token" + + resource.Test(s.T(), resource.TestCase{ + ProtoV6ProviderFactories: s.terraformProviders, + CheckDestroy: checkRoleDestroyed, + Steps: []resource.TestStep{ + { + Config: s.getFixture("provision_token_v2_gitlab_0_create.tf"), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(name, "kind", "token"), + resource.TestCheckResourceAttr(name, "metadata.name", "gitlab-test-terraform"), + resource.TestCheckResourceAttr(name, "spec.roles.0", "Bot"), + resource.TestCheckResourceAttr(name, "spec.join_method", "gitlab"), + resource.TestCheckNoResourceAttr(name, "spec.gitlab.allow.0.environment_protected"), + resource.TestCheckNoResourceAttr(name, "spec.gitlab.allow.0.ref_protected"), + ), + }, + { + Config: s.getFixture("provision_token_v2_gitlab_0_create.tf"), + PlanOnly: true, + }, + { + Config: s.getFixture("provision_token_v2_gitlab_1_update.tf"), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(name, "kind", "token"), + resource.TestCheckResourceAttr(name, "metadata.name", "gitlab-test-terraform"), + resource.TestCheckResourceAttr(name, "spec.roles.0", "Bot"), + resource.TestCheckResourceAttr(name, "spec.join_method", "gitlab"), + resource.TestCheckResourceAttr(name, "spec.gitlab.allow.0.environment_protected", "true"), + resource.TestCheckNoResourceAttr(name, "spec.gitlab.allow.0.ref_protected"), + ), + }, + { + Config: s.getFixture("provision_token_v2_gitlab_1_update.tf"), + PlanOnly: true, + }, + { + Config: s.getFixture("provision_token_v2_gitlab_2_update.tf"), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(name, "kind", "token"), + resource.TestCheckResourceAttr(name, "metadata.name", "gitlab-test-terraform"), + resource.TestCheckResourceAttr(name, "spec.roles.0", "Bot"), + resource.TestCheckResourceAttr(name, "spec.join_method", "gitlab"), + resource.TestCheckNoResourceAttr(name, "spec.gitlab.allow.0.environment_protected"), + resource.TestCheckNoResourceAttr(name, "spec.gitlab.allow.0.ref_protected"), + ), + }, + { + Config: s.getFixture("provision_token_v2_gitlab_2_update.tf"), + PlanOnly: true, + }, + }, + }) +} diff --git a/integrations/terraform/tfschema/token/custom_types.go b/integrations/terraform/tfschema/token/custom_types.go new file mode 100644 index 0000000000000..70e10070845ac --- /dev/null +++ b/integrations/terraform/tfschema/token/custom_types.go @@ -0,0 +1,81 @@ +/* +Copyright 2024 Gravitational, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package token + +import ( + "context" + "fmt" + + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/tfsdk" + "github.com/hashicorp/terraform-plugin-framework/types" + + apitypes "github.com/gravitational/teleport/api/types" + "github.com/gravitational/teleport/integrations/terraform/tfschema" +) + +// GenSchemaLabels returns Terraform schema for Labels type +func GenSchemaLabels(ctx context.Context) tfsdk.Attribute { + return tfschema.GenSchemaLabels(ctx) +} + +// GenSchemaBoolOptionsNullable returns Terraform schema for BoolOption type +func GenSchemaBoolOptionNullable(_ context.Context) tfsdk.Attribute { + return tfsdk.Attribute{ + Optional: true, + Type: types.BoolType, + } +} + +func CopyFromBoolOptionNullable(diags diag.Diagnostics, tf attr.Value, o **apitypes.BoolOption) { + v, ok := tf.(types.Bool) + if !ok { + diags.AddError("Error reading from Terraform object", fmt.Sprintf("Can not convert %T to types.Bool", tf)) + return + } + if !v.Null && !v.Unknown { + value := apitypes.BoolOption{Value: v.Value} + *o = &value + return + } +} + +func CopyToBoolOptionNullable(diags diag.Diagnostics, o *apitypes.BoolOption, t attr.Type, v attr.Value) attr.Value { + value, ok := v.(types.Bool) + if !ok { + value = types.Bool{} + } + + if o == nil { + value.Null = true + return value + } + + value.Null = false + value.Value = o.Value + + return value +} + +func CopyFromLabels(diags diag.Diagnostics, v attr.Value, o *apitypes.Labels) { + tfschema.CopyFromLabels(diags, v, o) +} + +func CopyToLabels(diags diag.Diagnostics, o apitypes.Labels, t attr.Type, v attr.Value) attr.Value { + return tfschema.CopyToLabels(diags, o, t, v) +} diff --git a/integrations/terraform/tfschema/token/types_terraform.go b/integrations/terraform/tfschema/token/types_terraform.go new file mode 100644 index 0000000000000..0949c22ed4a20 --- /dev/null +++ b/integrations/terraform/tfschema/token/types_terraform.go @@ -0,0 +1,4759 @@ +/* +Copyright 2015-2022 Gravitational, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: teleport/legacy/types/types.proto + +package token + +import ( + context "context" + fmt "fmt" + math "math" + time "time" + + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/gravitational/teleport/api/gen/proto/go/attestation/v1" + github_com_gravitational_teleport_api_types "github.com/gravitational/teleport/api/types" + github_com_gravitational_teleport_integrations_terraform_tfschema "github.com/gravitational/teleport/integrations/terraform/tfschema" + github_com_hashicorp_terraform_plugin_framework_attr "github.com/hashicorp/terraform-plugin-framework/attr" + github_com_hashicorp_terraform_plugin_framework_diag "github.com/hashicorp/terraform-plugin-framework/diag" + github_com_hashicorp_terraform_plugin_framework_tfsdk "github.com/hashicorp/terraform-plugin-framework/tfsdk" + github_com_hashicorp_terraform_plugin_framework_types "github.com/hashicorp/terraform-plugin-framework/types" + github_com_hashicorp_terraform_plugin_go_tftypes "github.com/hashicorp/terraform-plugin-go/tftypes" + _ "google.golang.org/protobuf/types/known/timestamppb" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// GenSchemaProvisionTokenV2 returns tfsdk.Schema definition for ProvisionTokenV2 +func GenSchemaProvisionTokenV2(ctx context.Context) (github_com_hashicorp_terraform_plugin_framework_tfsdk.Schema, github_com_hashicorp_terraform_plugin_framework_diag.Diagnostics) { + return github_com_hashicorp_terraform_plugin_framework_tfsdk.Schema{Attributes: map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ + "id": { + Computed: true, + Optional: false, + PlanModifiers: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributePlanModifier{github_com_hashicorp_terraform_plugin_framework_tfsdk.UseStateForUnknown()}, + Required: false, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "kind": { + Computed: true, + Description: "Kind is a resource kind", + Optional: true, + PlanModifiers: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributePlanModifier{github_com_hashicorp_terraform_plugin_framework_tfsdk.UseStateForUnknown()}, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "metadata": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ + "description": { + Description: "Description is object description", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "expires": { + Description: "Expires is a global expiry time header can be set on any resource in the system.", + Optional: true, + Type: github_com_gravitational_teleport_integrations_terraform_tfschema.UseRFC3339Time(), + Validators: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributeValidator{github_com_gravitational_teleport_integrations_terraform_tfschema.MustTimeBeInFuture()}, + }, + "labels": { + Description: "Labels is a set of labels", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.MapType{ElemType: github_com_hashicorp_terraform_plugin_framework_types.StringType}, + }, + "name": { + Computed: true, + Description: "Name is an object name", + Optional: true, + PlanModifiers: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributePlanModifier{github_com_hashicorp_terraform_plugin_framework_tfsdk.RequiresReplace(), github_com_hashicorp_terraform_plugin_framework_tfsdk.UseStateForUnknown()}, + Sensitive: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "namespace": { + Computed: true, + Description: "Namespace is object namespace. The field should be called \"namespace\" when it returns in Teleport 2.4.", + Optional: true, + PlanModifiers: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributePlanModifier{github_com_hashicorp_terraform_plugin_framework_tfsdk.UseStateForUnknown()}, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "revision": { + Description: "Revision is an opaque identifier which tracks the versions of a resource over time. Clients should ignore and not alter its value but must return the revision in any updates of a resource.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + }), + Description: "Metadata is resource metadata", + Optional: true, + }, + "spec": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ + "allow": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.ListNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ + "aws_account": { + Description: "AWSAccount is the AWS account ID.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "aws_arn": { + Description: "AWSARN is used for the IAM join method, the AWS identity of joining nodes must match this ARN. Supports wildcards \"*\" and \"?\".", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "aws_regions": { + Description: "AWSRegions is used for the EC2 join method and is a list of AWS regions a node is allowed to join from.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.ListType{ElemType: github_com_hashicorp_terraform_plugin_framework_types.StringType}, + }, + "aws_role": { + Description: "AWSRole is used for the EC2 join method and is the the ARN of the AWS role that the auth server will assume in order to call the ec2 API.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + }), + Description: "Allow is a list of TokenRules, nodes using this token must match one allow rule to use this token.", + Optional: true, + }, + "aws_iid_ttl": { + Computed: true, + Description: "AWSIIDTTL is the TTL to use for AWS EC2 Instance Identity Documents used to join the cluster with this token.", + Optional: true, + PlanModifiers: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributePlanModifier{github_com_hashicorp_terraform_plugin_framework_tfsdk.UseStateForUnknown()}, + Type: github_com_gravitational_teleport_integrations_terraform_tfschema.DurationType{}, + }, + "azure": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{"allow": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.ListNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ + "resource_groups": { + Description: "ResourceGroups is a list of Azure resource groups the node is allowed to join from.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.ListType{ElemType: github_com_hashicorp_terraform_plugin_framework_types.StringType}, + }, + "subscription": { + Description: "Subscription is the Azure subscription.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + }), + Description: "Allow is a list of Rules, nodes using this token must match one allow rule to use this token.", + Optional: true, + }}), + Description: "Azure allows the configuration of options specific to the \"azure\" join method.", + Optional: true, + }, + "bot_name": { + Description: "BotName is the name of the bot this token grants access to, if any", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "circleci": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ + "allow": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.ListNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ + "context_id": { + Description: "", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "project_id": { + Description: "", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + }), + Description: "Allow is a list of TokenRules, nodes using this token must match one allow rule to use this token.", + Optional: true, + }, + "organization_id": { + Description: "", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + }), + Description: "CircleCI allows the configuration of options specific to the \"circleci\" join method.", + Optional: true, + }, + "gcp": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{"allow": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.ListNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ + "locations": { + Description: "Locations is a list of regions (e.g. \"us-west1\") and/or zones (e.g. \"us-west1-b\").", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.ListType{ElemType: github_com_hashicorp_terraform_plugin_framework_types.StringType}, + }, + "project_ids": { + Description: "ProjectIDs is a list of project IDs (e.g. \"\").", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.ListType{ElemType: github_com_hashicorp_terraform_plugin_framework_types.StringType}, + }, + "service_accounts": { + Description: "ServiceAccounts is a list of service account emails (e.g. \"-compute@developer.gserviceaccount.com\").", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.ListType{ElemType: github_com_hashicorp_terraform_plugin_framework_types.StringType}, + }, + }), + Description: "Allow is a list of Rules, nodes using this token must match one allow rule to use this token.", + Optional: true, + }}), + Description: "GCP allows the configuration of options specific to the \"gcp\" join method.", + Optional: true, + }, + "github": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ + "allow": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.ListNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ + "actor": { + Description: "The personal account that initiated the workflow run.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "environment": { + Description: "The name of the environment used by the job.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "ref": { + Description: "The git ref that triggered the workflow run.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "ref_type": { + Description: "The type of ref, for example: \"branch\".", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "repository": { + Description: "The repository from where the workflow is running. This includes the name of the owner e.g `gravitational/teleport`", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "repository_owner": { + Description: "The name of the organization in which the repository is stored.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "sub": { + Description: "Sub also known as Subject is a string that roughly uniquely identifies the workload. The format of this varies depending on the type of github action run.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "workflow": { + Description: "The name of the workflow.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + }), + Description: "Allow is a list of TokenRules, nodes using this token must match one allow rule to use this token.", + Optional: true, + }, + "enterprise_server_host": { + Description: "EnterpriseServerHost allows joining from runners associated with a GitHub Enterprise Server instance. When unconfigured, tokens will be validated against github.com, but when configured to the host of a GHES instance, then the tokens will be validated against host. This value should be the hostname of the GHES instance, and should not include the scheme or a path. The instance must be accessible over HTTPS at this hostname and the certificate must be trusted by the Auth Server.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "enterprise_slug": { + Description: "EnterpriseSlug allows the slug of a GitHub Enterprise organisation to be included in the expected issuer of the OIDC tokens. This is for compatibility with the `include_enterprise_slug` option in GHE. This field should be set to the slug of your enterprise if this is enabled. If this is not enabled, then this field must be left empty. This field cannot be specified if `enterprise_server_host` is specified. See https://docs.github.com/en/enterprise-cloud@latest/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#customizing-the-issuer-value-for-an-enterprise for more information about customized issuer values.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + }), + Description: "GitHub allows the configuration of options specific to the \"github\" join method.", + Optional: true, + }, + "gitlab": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ + "allow": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.ListNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ + "ci_config_ref_uri": { + Description: "CIConfigRefURI is the ref path to the top-level pipeline definition, for example, gitlab.example.com/my-group/my-project//.gitlab-ci.yml@refs/heads/main.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "ci_config_sha": { + Description: "CIConfigSHA is the git commit SHA for the ci_config_ref_uri.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "deployment_tier": { + Description: "DeploymentTier is the deployment tier of the environment the job specifies", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "environment": { + Description: "Environment limits access by the environment the job deploys to (if one is associated)", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "environment_protected": GenSchemaBoolOptionNullable(ctx), + "namespace_path": { + Description: "NamespacePath is used to limit access to jobs in a group or user's projects. Example: `mygroup` This field supports simple \"glob-style\" matching: - Use '*' to match zero or more characters. - Use '?' to match any single character.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "pipeline_source": { + Description: "PipelineSource limits access by the job pipeline source type. https://docs.gitlab.com/ee/ci/jobs/job_control.html#common-if-clauses-for-rules Example: `web`", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "project_path": { + Description: "ProjectPath is used to limit access to jobs belonging to an individual project. Example: `mygroup/myproject` This field supports simple \"glob-style\" matching: - Use '*' to match zero or more characters. - Use '?' to match any single character.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "project_visibility": { + Description: "ProjectVisibility is the visibility of the project where the pipeline is running. Can be internal, private, or public.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "ref": { + Description: "Ref allows access to be limited to jobs triggered by a specific git ref. Ensure this is used in combination with ref_type. This field supports simple \"glob-style\" matching: - Use '*' to match zero or more characters. - Use '?' to match any single character.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "ref_protected": GenSchemaBoolOptionNullable(ctx), + "ref_type": { + Description: "RefType allows access to be limited to jobs triggered by a specific git ref type. Example: `branch` or `tag`", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "sub": { + Description: "Sub roughly uniquely identifies the workload. Example: `project_path:mygroup/my-project:ref_type:branch:ref:main` project_path:{group}/{project}:ref_type:{type}:ref:{branch_name} This field supports simple \"glob-style\" matching: - Use '*' to match zero or more characters. - Use '?' to match any single character.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "user_email": { + Description: "UserEmail is the email of the user executing the job", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "user_id": { + Description: "UserID is the ID of the user executing the job", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "user_login": { + Description: "UserLogin is the username of the user executing the job", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + }), + Description: "Allow is a list of TokenRules, nodes using this token must match one allow rule to use this token.", + Optional: true, + }, + "domain": { + Description: "Domain is the domain of your GitLab instance. This will default to `gitlab.com` - but can be set to the domain of your self-hosted GitLab e.g `gitlab.example.com`.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + }), + Description: "GitLab allows the configuration of options specific to the \"gitlab\" join method.", + Optional: true, + }, + "join_method": { + Description: "JoinMethod is the joining method required in order to use this token. Supported joining methods include \"token\", \"ec2\", and \"iam\".", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "kubernetes": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ + "allow": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.ListNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{"service_account": { + Description: "ServiceAccount is the namespaced name of the Kubernetes service account. Its format is \"namespace:service-account\".", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }}), + Description: "Allow is a list of Rules, nodes using this token must match one allow rule to use this token.", + Optional: true, + }, + "static_jwks": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{"jwks": { + Description: "JWKS should be the JSON Web Key Set formatted public keys of that the Kubernetes Cluster uses to sign service account tokens. This can be fetched from /openid/v1/jwks on the Kubernetes API Server.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }}), + Description: "StaticJWKS is the configuration specific to the `static_jwks` type.", + Optional: true, + }, + "type": { + Description: "Type controls which behavior should be used for validating the Kubernetes Service Account token. Support values: - `in_cluster` - `static_jwks` If unset, this defaults to `in_cluster`.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + }), + Description: "Kubernetes allows the configuration of options specific to the \"kubernetes\" join method.", + Optional: true, + }, + "roles": { + Description: "Roles is a list of roles associated with the token, that will be converted to metadata in the SSH and X509 certificates issued to the user of the token", + Required: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.ListType{ElemType: github_com_hashicorp_terraform_plugin_framework_types.StringType}, + }, + "spacelift": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ + "allow": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.ListNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ + "caller_id": { + Description: "CallerID is the ID of the caller, ie. the stack or module that generated the run.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "caller_type": { + Description: "CallerType is the type of the caller, ie. the entity that owns the run - either `stack` or `module`.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "scope": { + Description: "Scope is the scope of the token - either `read` or `write`. See https://docs.spacelift.io/integrations/cloud-providers/oidc/#about-scopes", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "space_id": { + Description: "SpaceID is the ID of the space in which the run that owns the token was executed.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + }), + Description: "Allow is a list of Rules, nodes using this token must match one allow rule to use this token.", + Optional: true, + }, + "hostname": { + Description: "Hostname is the hostname of the Spacelift tenant that tokens will originate from. E.g `example.app.spacelift.io`", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + }), + Description: "Spacelift allows the configuration of options specific to the \"spacelift\" join method.", + Optional: true, + }, + "suggested_agent_matcher_labels": GenSchemaLabels(ctx), + "suggested_labels": GenSchemaLabels(ctx), + "tpm": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ + "allow": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.ListNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ + "description": { + Description: "Description is a human-readable description of the rule. It has no bearing on whether or not a TPM is allowed to join, but can be used to associate a rule with a specific host (e.g the asset tag of the server in which the TPM resides). Example: \"build-server-100\"", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "ek_certificate_serial": { + Description: "EKCertificateSerial is the serial number of the EKCert in hexadecimal with colon separated nibbles. This value will not be checked when a TPM does not have an EKCert configured. Example: 73:df:dc:bd:af:ef:8a:d8:15:2e:96:71:7a:3e:7f:a4", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "ek_public_hash": { + Description: "EKPublicHash is the SHA256 hash of the EKPub marshaled in PKIX format and encoded in hexadecimal. This value will also be checked when a TPM has submitted an EKCert, and the public key in the EKCert will be used for this check. Example: d4b45864d9d6fabfc568d74f26c35ababde2105337d7af9a6605e1c56c891aa6", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + }), + Description: "Allow is a list of Rules, the presented delegated identity must match one allow rule to permit joining.", + Optional: true, + }, + "ekcert_allowed_cas": { + Description: "EKCertAllowedCAs is a list of CA certificates that will be used to validate TPM EKCerts. When specified, joining TPMs must present an EKCert signed by one of the specified CAs. TPMs that do not present an EKCert will be not permitted to join. When unspecified, TPMs will be allowed to join with either an EKCert or an EKPubHash.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.ListType{ElemType: github_com_hashicorp_terraform_plugin_framework_types.StringType}, + }, + }), + Description: "TPM allows the configuration of options specific to the \"tpm\" join method.", + Optional: true, + }, + }), + Description: "Spec is a provisioning token V2 spec", + Required: true, + }, + "sub_kind": { + Description: "SubKind is an optional resource sub kind, used in some resources", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + }, + "version": { + Description: "Version is the resource version. It must be specified. Supported values are:`v2`.", + Required: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + Validators: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributeValidator{github_com_gravitational_teleport_integrations_terraform_tfschema.UseVersionBetween(2, 2)}, + }, + }}, nil +} + +// CopyProvisionTokenV2FromTerraform copies contents of the source Terraform object into a target struct +func CopyProvisionTokenV2FromTerraform(_ context.Context, tf github_com_hashicorp_terraform_plugin_framework_types.Object, obj *github_com_gravitational_teleport_api_types.ProvisionTokenV2) github_com_hashicorp_terraform_plugin_framework_diag.Diagnostics { + var diags github_com_hashicorp_terraform_plugin_framework_diag.Diagnostics + { + a, ok := tf.Attrs["kind"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Kind"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Kind", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Kind = t + } + } + } + { + a, ok := tf.Attrs["sub_kind"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.SubKind"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.SubKind", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.SubKind = t + } + } + } + { + a, ok := tf.Attrs["version"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Version"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Version", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Version = t + } + } + } + { + a, ok := tf.Attrs["metadata"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Metadata"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Metadata", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) + } else { + obj.Metadata = github_com_gravitational_teleport_api_types.Metadata{} + if !v.Null && !v.Unknown { + tf := v + obj := &obj.Metadata + { + a, ok := tf.Attrs["name"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Metadata.Name"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Metadata.Name", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Name = t + } + } + } + { + a, ok := tf.Attrs["namespace"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Metadata.Namespace"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Metadata.Namespace", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Namespace = t + } + } + } + { + a, ok := tf.Attrs["description"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Metadata.Description"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Metadata.Description", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Description = t + } + } + } + { + a, ok := tf.Attrs["labels"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Metadata.Labels"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Map) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Metadata.Labels", "github.com/hashicorp/terraform-plugin-framework/types.Map"}) + } else { + obj.Labels = make(map[string]string, len(v.Elems)) + if !v.Null && !v.Unknown { + for k, a := range v.Elems { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Metadata.Labels", "github_com_hashicorp_terraform_plugin_framework_types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Labels[k] = t + } + } + } + } + } + } + { + a, ok := tf.Attrs["expires"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Metadata.Expires"}) + } else { + v, ok := a.(github_com_gravitational_teleport_integrations_terraform_tfschema.TimeValue) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Metadata.Expires", "github.com/gravitational/teleport/integrations/terraform/tfschema.TimeValue"}) + } else { + var t *time.Time + if !v.Null && !v.Unknown { + c := time.Time(v.Value) + t = &c + } + obj.Expires = t + } + } + } + { + a, ok := tf.Attrs["revision"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Metadata.Revision"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Metadata.Revision", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Revision = t + } + } + } + } + } + } + } + { + a, ok := tf.Attrs["spec"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) + } else { + obj.Spec = github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2{} + if !v.Null && !v.Unknown { + tf := v + obj := &obj.Spec + { + a, ok := tf.Attrs["roles"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Roles"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Roles", "github.com/hashicorp/terraform-plugin-framework/types.List"}) + } else { + obj.Roles = make([]github_com_gravitational_teleport_api_types.SystemRole, len(v.Elems)) + if !v.Null && !v.Unknown { + for k, a := range v.Elems { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Roles", "github_com_hashicorp_terraform_plugin_framework_types.String"}) + } else { + var t github_com_gravitational_teleport_api_types.SystemRole + if !v.Null && !v.Unknown { + t = github_com_gravitational_teleport_api_types.SystemRole(v.Value) + } + obj.Roles[k] = t + } + } + } + } + } + } + { + a, ok := tf.Attrs["allow"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Allow"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Allow", "github.com/hashicorp/terraform-plugin-framework/types.List"}) + } else { + obj.Allow = make([]*github_com_gravitational_teleport_api_types.TokenRule, len(v.Elems)) + if !v.Null && !v.Unknown { + for k, a := range v.Elems { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Allow", "github_com_hashicorp_terraform_plugin_framework_types.Object"}) + } else { + var t *github_com_gravitational_teleport_api_types.TokenRule + if !v.Null && !v.Unknown { + tf := v + t = &github_com_gravitational_teleport_api_types.TokenRule{} + obj := t + { + a, ok := tf.Attrs["aws_account"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Allow.AWSAccount"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSAccount", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.AWSAccount = t + } + } + } + { + a, ok := tf.Attrs["aws_regions"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Allow.AWSRegions"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSRegions", "github.com/hashicorp/terraform-plugin-framework/types.List"}) + } else { + obj.AWSRegions = make([]string, len(v.Elems)) + if !v.Null && !v.Unknown { + for k, a := range v.Elems { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSRegions", "github_com_hashicorp_terraform_plugin_framework_types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.AWSRegions[k] = t + } + } + } + } + } + } + { + a, ok := tf.Attrs["aws_role"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Allow.AWSRole"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSRole", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.AWSRole = t + } + } + } + { + a, ok := tf.Attrs["aws_arn"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Allow.AWSARN"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSARN", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.AWSARN = t + } + } + } + } + obj.Allow[k] = t + } + } + } + } + } + } + { + a, ok := tf.Attrs["aws_iid_ttl"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.AWSIIDTTL"}) + } else { + v, ok := a.(github_com_gravitational_teleport_integrations_terraform_tfschema.DurationValue) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.AWSIIDTTL", "github.com/gravitational/teleport/integrations/terraform/tfschema.DurationValue"}) + } else { + var t github_com_gravitational_teleport_api_types.Duration + if !v.Null && !v.Unknown { + t = github_com_gravitational_teleport_api_types.Duration(v.Value) + } + obj.AWSIIDTTL = t + } + } + } + { + a, ok := tf.Attrs["join_method"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.JoinMethod"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.JoinMethod", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t github_com_gravitational_teleport_api_types.JoinMethod + if !v.Null && !v.Unknown { + t = github_com_gravitational_teleport_api_types.JoinMethod(v.Value) + } + obj.JoinMethod = t + } + } + } + { + a, ok := tf.Attrs["bot_name"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.BotName"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.BotName", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.BotName = t + } + } + } + { + a, ok := tf.Attrs["suggested_labels"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.SuggestedLabels"}) + } + CopyFromLabels(diags, a, &obj.SuggestedLabels) + } + { + a, ok := tf.Attrs["github"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) + } else { + obj.GitHub = nil + if !v.Null && !v.Unknown { + tf := v + obj.GitHub = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GitHub{} + obj := obj.GitHub + { + a, ok := tf.Attrs["allow"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow", "github.com/hashicorp/terraform-plugin-framework/types.List"}) + } else { + obj.Allow = make([]*github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GitHub_Rule, len(v.Elems)) + if !v.Null && !v.Unknown { + for k, a := range v.Elems { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow", "github_com_hashicorp_terraform_plugin_framework_types.Object"}) + } else { + var t *github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GitHub_Rule + if !v.Null && !v.Unknown { + tf := v + t = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GitHub_Rule{} + obj := t + { + a, ok := tf.Attrs["sub"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Sub"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Sub", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Sub = t + } + } + } + { + a, ok := tf.Attrs["repository"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Repository"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Repository", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Repository = t + } + } + } + { + a, ok := tf.Attrs["repository_owner"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.RepositoryOwner"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.RepositoryOwner", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.RepositoryOwner = t + } + } + } + { + a, ok := tf.Attrs["workflow"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Workflow"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Workflow", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Workflow = t + } + } + } + { + a, ok := tf.Attrs["environment"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Environment"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Environment", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Environment = t + } + } + } + { + a, ok := tf.Attrs["actor"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Actor"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Actor", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Actor = t + } + } + } + { + a, ok := tf.Attrs["ref"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Ref"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Ref", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Ref = t + } + } + } + { + a, ok := tf.Attrs["ref_type"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.RefType"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.RefType", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.RefType = t + } + } + } + } + obj.Allow[k] = t + } + } + } + } + } + } + { + a, ok := tf.Attrs["enterprise_server_host"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.EnterpriseServerHost"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.EnterpriseServerHost", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.EnterpriseServerHost = t + } + } + } + { + a, ok := tf.Attrs["enterprise_slug"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.EnterpriseSlug"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.EnterpriseSlug", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.EnterpriseSlug = t + } + } + } + } + } + } + } + { + a, ok := tf.Attrs["circleci"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.CircleCI"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) + } else { + obj.CircleCI = nil + if !v.Null && !v.Unknown { + tf := v + obj.CircleCI = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2CircleCI{} + obj := obj.CircleCI + { + a, ok := tf.Attrs["allow"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.CircleCI.Allow"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI.Allow", "github.com/hashicorp/terraform-plugin-framework/types.List"}) + } else { + obj.Allow = make([]*github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2CircleCI_Rule, len(v.Elems)) + if !v.Null && !v.Unknown { + for k, a := range v.Elems { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI.Allow", "github_com_hashicorp_terraform_plugin_framework_types.Object"}) + } else { + var t *github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2CircleCI_Rule + if !v.Null && !v.Unknown { + tf := v + t = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2CircleCI_Rule{} + obj := t + { + a, ok := tf.Attrs["project_id"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.CircleCI.Allow.ProjectID"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI.Allow.ProjectID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.ProjectID = t + } + } + } + { + a, ok := tf.Attrs["context_id"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.CircleCI.Allow.ContextID"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI.Allow.ContextID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.ContextID = t + } + } + } + } + obj.Allow[k] = t + } + } + } + } + } + } + { + a, ok := tf.Attrs["organization_id"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.CircleCI.OrganizationID"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI.OrganizationID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.OrganizationID = t + } + } + } + } + } + } + } + { + a, ok := tf.Attrs["suggested_agent_matcher_labels"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.SuggestedAgentMatcherLabels"}) + } + CopyFromLabels(diags, a, &obj.SuggestedAgentMatcherLabels) + } + { + a, ok := tf.Attrs["kubernetes"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Kubernetes"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) + } else { + obj.Kubernetes = nil + if !v.Null && !v.Unknown { + tf := v + obj.Kubernetes = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Kubernetes{} + obj := obj.Kubernetes + { + a, ok := tf.Attrs["allow"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.Allow"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.Allow", "github.com/hashicorp/terraform-plugin-framework/types.List"}) + } else { + obj.Allow = make([]*github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Kubernetes_Rule, len(v.Elems)) + if !v.Null && !v.Unknown { + for k, a := range v.Elems { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.Allow", "github_com_hashicorp_terraform_plugin_framework_types.Object"}) + } else { + var t *github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Kubernetes_Rule + if !v.Null && !v.Unknown { + tf := v + t = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Kubernetes_Rule{} + obj := t + { + a, ok := tf.Attrs["service_account"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.Allow.ServiceAccount"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.Allow.ServiceAccount", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.ServiceAccount = t + } + } + } + } + obj.Allow[k] = t + } + } + } + } + } + } + { + a, ok := tf.Attrs["type"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.Type"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.Type", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t github_com_gravitational_teleport_api_types.KubernetesJoinType + if !v.Null && !v.Unknown { + t = github_com_gravitational_teleport_api_types.KubernetesJoinType(v.Value) + } + obj.Type = t + } + } + } + { + a, ok := tf.Attrs["static_jwks"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.StaticJWKS"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.StaticJWKS", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) + } else { + obj.StaticJWKS = nil + if !v.Null && !v.Unknown { + tf := v + obj.StaticJWKS = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Kubernetes_StaticJWKSConfig{} + obj := obj.StaticJWKS + { + a, ok := tf.Attrs["jwks"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.StaticJWKS.JWKS"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.StaticJWKS.JWKS", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.JWKS = t + } + } + } + } + } + } + } + } + } + } + } + { + a, ok := tf.Attrs["azure"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Azure"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Azure", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) + } else { + obj.Azure = nil + if !v.Null && !v.Unknown { + tf := v + obj.Azure = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Azure{} + obj := obj.Azure + { + a, ok := tf.Attrs["allow"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Azure.Allow"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Azure.Allow", "github.com/hashicorp/terraform-plugin-framework/types.List"}) + } else { + obj.Allow = make([]*github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Azure_Rule, len(v.Elems)) + if !v.Null && !v.Unknown { + for k, a := range v.Elems { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Azure.Allow", "github_com_hashicorp_terraform_plugin_framework_types.Object"}) + } else { + var t *github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Azure_Rule + if !v.Null && !v.Unknown { + tf := v + t = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Azure_Rule{} + obj := t + { + a, ok := tf.Attrs["subscription"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Azure.Allow.Subscription"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Azure.Allow.Subscription", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Subscription = t + } + } + } + { + a, ok := tf.Attrs["resource_groups"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Azure.Allow.ResourceGroups"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Azure.Allow.ResourceGroups", "github.com/hashicorp/terraform-plugin-framework/types.List"}) + } else { + obj.ResourceGroups = make([]string, len(v.Elems)) + if !v.Null && !v.Unknown { + for k, a := range v.Elems { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Azure.Allow.ResourceGroups", "github_com_hashicorp_terraform_plugin_framework_types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.ResourceGroups[k] = t + } + } + } + } + } + } + } + obj.Allow[k] = t + } + } + } + } + } + } + } + } + } + } + { + a, ok := tf.Attrs["gitlab"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) + } else { + obj.GitLab = nil + if !v.Null && !v.Unknown { + tf := v + obj.GitLab = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GitLab{} + obj := obj.GitLab + { + a, ok := tf.Attrs["allow"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow", "github.com/hashicorp/terraform-plugin-framework/types.List"}) + } else { + obj.Allow = make([]*github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GitLab_Rule, len(v.Elems)) + if !v.Null && !v.Unknown { + for k, a := range v.Elems { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow", "github_com_hashicorp_terraform_plugin_framework_types.Object"}) + } else { + var t *github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GitLab_Rule + if !v.Null && !v.Unknown { + tf := v + t = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GitLab_Rule{} + obj := t + { + a, ok := tf.Attrs["sub"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Sub"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Sub", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Sub = t + } + } + } + { + a, ok := tf.Attrs["ref"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Ref"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Ref", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Ref = t + } + } + } + { + a, ok := tf.Attrs["ref_type"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.RefType"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.RefType", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.RefType = t + } + } + } + { + a, ok := tf.Attrs["namespace_path"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.NamespacePath"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.NamespacePath", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.NamespacePath = t + } + } + } + { + a, ok := tf.Attrs["project_path"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectPath"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectPath", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.ProjectPath = t + } + } + } + { + a, ok := tf.Attrs["pipeline_source"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.PipelineSource"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.PipelineSource", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.PipelineSource = t + } + } + } + { + a, ok := tf.Attrs["environment"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Environment"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Environment", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Environment = t + } + } + } + { + a, ok := tf.Attrs["user_login"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserLogin"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserLogin", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.UserLogin = t + } + } + } + { + a, ok := tf.Attrs["user_id"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserID"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.UserID = t + } + } + } + { + a, ok := tf.Attrs["user_email"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserEmail"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserEmail", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.UserEmail = t + } + } + } + { + a, ok := tf.Attrs["ref_protected"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.RefProtected"}) + } + CopyFromBoolOptionNullable(diags, a, &obj.RefProtected) + } + { + a, ok := tf.Attrs["environment_protected"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.EnvironmentProtected"}) + } + CopyFromBoolOptionNullable(diags, a, &obj.EnvironmentProtected) + } + { + a, ok := tf.Attrs["ci_config_sha"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigSHA"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigSHA", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.CIConfigSHA = t + } + } + } + { + a, ok := tf.Attrs["ci_config_ref_uri"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigRefURI"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigRefURI", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.CIConfigRefURI = t + } + } + } + { + a, ok := tf.Attrs["deployment_tier"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.DeploymentTier"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.DeploymentTier", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.DeploymentTier = t + } + } + } + { + a, ok := tf.Attrs["project_visibility"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectVisibility"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectVisibility", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.ProjectVisibility = t + } + } + } + } + obj.Allow[k] = t + } + } + } + } + } + } + { + a, ok := tf.Attrs["domain"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Domain"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Domain", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Domain = t + } + } + } + } + } + } + } + { + a, ok := tf.Attrs["gcp"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GCP"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GCP", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) + } else { + obj.GCP = nil + if !v.Null && !v.Unknown { + tf := v + obj.GCP = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GCP{} + obj := obj.GCP + { + a, ok := tf.Attrs["allow"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GCP.Allow"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow", "github.com/hashicorp/terraform-plugin-framework/types.List"}) + } else { + obj.Allow = make([]*github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GCP_Rule, len(v.Elems)) + if !v.Null && !v.Unknown { + for k, a := range v.Elems { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow", "github_com_hashicorp_terraform_plugin_framework_types.Object"}) + } else { + var t *github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GCP_Rule + if !v.Null && !v.Unknown { + tf := v + t = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GCP_Rule{} + obj := t + { + a, ok := tf.Attrs["project_ids"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GCP.Allow.ProjectIDs"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.ProjectIDs", "github.com/hashicorp/terraform-plugin-framework/types.List"}) + } else { + obj.ProjectIDs = make([]string, len(v.Elems)) + if !v.Null && !v.Unknown { + for k, a := range v.Elems { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.ProjectIDs", "github_com_hashicorp_terraform_plugin_framework_types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.ProjectIDs[k] = t + } + } + } + } + } + } + { + a, ok := tf.Attrs["locations"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GCP.Allow.Locations"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.Locations", "github.com/hashicorp/terraform-plugin-framework/types.List"}) + } else { + obj.Locations = make([]string, len(v.Elems)) + if !v.Null && !v.Unknown { + for k, a := range v.Elems { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.Locations", "github_com_hashicorp_terraform_plugin_framework_types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Locations[k] = t + } + } + } + } + } + } + { + a, ok := tf.Attrs["service_accounts"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GCP.Allow.ServiceAccounts"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.ServiceAccounts", "github.com/hashicorp/terraform-plugin-framework/types.List"}) + } else { + obj.ServiceAccounts = make([]string, len(v.Elems)) + if !v.Null && !v.Unknown { + for k, a := range v.Elems { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.ServiceAccounts", "github_com_hashicorp_terraform_plugin_framework_types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.ServiceAccounts[k] = t + } + } + } + } + } + } + } + obj.Allow[k] = t + } + } + } + } + } + } + } + } + } + } + { + a, ok := tf.Attrs["spacelift"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Spacelift"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) + } else { + obj.Spacelift = nil + if !v.Null && !v.Unknown { + tf := v + obj.Spacelift = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Spacelift{} + obj := obj.Spacelift + { + a, ok := tf.Attrs["allow"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow", "github.com/hashicorp/terraform-plugin-framework/types.List"}) + } else { + obj.Allow = make([]*github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Spacelift_Rule, len(v.Elems)) + if !v.Null && !v.Unknown { + for k, a := range v.Elems { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow", "github_com_hashicorp_terraform_plugin_framework_types.Object"}) + } else { + var t *github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Spacelift_Rule + if !v.Null && !v.Unknown { + tf := v + t = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Spacelift_Rule{} + obj := t + { + a, ok := tf.Attrs["space_id"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.SpaceID"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.SpaceID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.SpaceID = t + } + } + } + { + a, ok := tf.Attrs["caller_id"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerID"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.CallerID = t + } + } + } + { + a, ok := tf.Attrs["caller_type"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerType"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerType", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.CallerType = t + } + } + } + { + a, ok := tf.Attrs["scope"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.Scope"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.Scope", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Scope = t + } + } + } + } + obj.Allow[k] = t + } + } + } + } + } + } + { + a, ok := tf.Attrs["hostname"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Hostname"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Hostname", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Hostname = t + } + } + } + } + } + } + } + { + a, ok := tf.Attrs["tpm"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.TPM"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.TPM", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) + } else { + obj.TPM = nil + if !v.Null && !v.Unknown { + tf := v + obj.TPM = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2TPM{} + obj := obj.TPM + { + a, ok := tf.Attrs["allow"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.TPM.Allow"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.TPM.Allow", "github.com/hashicorp/terraform-plugin-framework/types.List"}) + } else { + obj.Allow = make([]*github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2TPM_Rule, len(v.Elems)) + if !v.Null && !v.Unknown { + for k, a := range v.Elems { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.TPM.Allow", "github_com_hashicorp_terraform_plugin_framework_types.Object"}) + } else { + var t *github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2TPM_Rule + if !v.Null && !v.Unknown { + tf := v + t = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2TPM_Rule{} + obj := t + { + a, ok := tf.Attrs["description"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.TPM.Allow.Description"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.TPM.Allow.Description", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.Description = t + } + } + } + { + a, ok := tf.Attrs["ek_public_hash"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.TPM.Allow.EKPublicHash"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.TPM.Allow.EKPublicHash", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.EKPublicHash = t + } + } + } + { + a, ok := tf.Attrs["ek_certificate_serial"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.TPM.Allow.EKCertificateSerial"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.TPM.Allow.EKCertificateSerial", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.EKCertificateSerial = t + } + } + } + } + obj.Allow[k] = t + } + } + } + } + } + } + { + a, ok := tf.Attrs["ekcert_allowed_cas"] + if !ok { + diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.TPM.EKCertAllowedCAs"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.TPM.EKCertAllowedCAs", "github.com/hashicorp/terraform-plugin-framework/types.List"}) + } else { + obj.EKCertAllowedCAs = make([]string, len(v.Elems)) + if !v.Null && !v.Unknown { + for k, a := range v.Elems { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.TPM.EKCertAllowedCAs", "github_com_hashicorp_terraform_plugin_framework_types.String"}) + } else { + var t string + if !v.Null && !v.Unknown { + t = string(v.Value) + } + obj.EKCertAllowedCAs[k] = t + } + } + } + } + } + } + } + } + } + } + } + } + } + } + return diags +} + +// CopyProvisionTokenV2ToTerraform copies contents of the source Terraform object into a target struct +func CopyProvisionTokenV2ToTerraform(ctx context.Context, obj *github_com_gravitational_teleport_api_types.ProvisionTokenV2, tf *github_com_hashicorp_terraform_plugin_framework_types.Object) github_com_hashicorp_terraform_plugin_framework_diag.Diagnostics { + var diags github_com_hashicorp_terraform_plugin_framework_diag.Diagnostics + tf.Null = false + tf.Unknown = false + if tf.Attrs == nil { + tf.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value) + } + { + t, ok := tf.AttrTypes["kind"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Kind"}) + } else { + v, ok := tf.Attrs["kind"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Kind", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Kind", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Kind) == "" + } + v.Value = string(obj.Kind) + v.Unknown = false + tf.Attrs["kind"] = v + } + } + { + t, ok := tf.AttrTypes["sub_kind"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.SubKind"}) + } else { + v, ok := tf.Attrs["sub_kind"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.SubKind", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.SubKind", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.SubKind) == "" + } + v.Value = string(obj.SubKind) + v.Unknown = false + tf.Attrs["sub_kind"] = v + } + } + { + t, ok := tf.AttrTypes["version"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Version"}) + } else { + v, ok := tf.Attrs["version"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Version", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Version", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Version) == "" + } + v.Value = string(obj.Version) + v.Unknown = false + tf.Attrs["version"] = v + } + } + { + a, ok := tf.AttrTypes["metadata"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Metadata"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Metadata", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) + } else { + v, ok := tf.Attrs["metadata"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + { + obj := obj.Metadata + tf := &v + { + t, ok := tf.AttrTypes["name"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Metadata.Name"}) + } else { + v, ok := tf.Attrs["name"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Metadata.Name", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Metadata.Name", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Name) == "" + } + v.Value = string(obj.Name) + v.Unknown = false + tf.Attrs["name"] = v + } + } + { + t, ok := tf.AttrTypes["namespace"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Metadata.Namespace"}) + } else { + v, ok := tf.Attrs["namespace"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Metadata.Namespace", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Metadata.Namespace", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Namespace) == "" + } + v.Value = string(obj.Namespace) + v.Unknown = false + tf.Attrs["namespace"] = v + } + } + { + t, ok := tf.AttrTypes["description"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Metadata.Description"}) + } else { + v, ok := tf.Attrs["description"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Metadata.Description", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Metadata.Description", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Description) == "" + } + v.Value = string(obj.Description) + v.Unknown = false + tf.Attrs["description"] = v + } + } + { + a, ok := tf.AttrTypes["labels"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Metadata.Labels"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.MapType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Metadata.Labels", "github.com/hashicorp/terraform-plugin-framework/types.MapType"}) + } else { + c, ok := tf.Attrs["labels"].(github_com_hashicorp_terraform_plugin_framework_types.Map) + if !ok { + c = github_com_hashicorp_terraform_plugin_framework_types.Map{ + + ElemType: o.ElemType, + Elems: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Labels)), + Null: true, + } + } else { + if c.Elems == nil { + c.Elems = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Labels)) + } + } + if obj.Labels != nil { + t := o.ElemType + for k, a := range obj.Labels { + v, ok := tf.Attrs["labels"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Metadata.Labels", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Metadata.Labels", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = false + } + v.Value = string(a) + v.Unknown = false + c.Elems[k] = v + } + if len(obj.Labels) > 0 { + c.Null = false + } + } + c.Unknown = false + tf.Attrs["labels"] = c + } + } + } + { + t, ok := tf.AttrTypes["expires"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Metadata.Expires"}) + } else { + v, ok := tf.Attrs["expires"].(github_com_gravitational_teleport_integrations_terraform_tfschema.TimeValue) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Metadata.Expires", err}) + } + v, ok = i.(github_com_gravitational_teleport_integrations_terraform_tfschema.TimeValue) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Metadata.Expires", "github.com/gravitational/teleport/integrations/terraform/tfschema.TimeValue"}) + } + v.Null = false + } + if obj.Expires == nil { + v.Null = true + } else { + v.Null = false + v.Value = time.Time(*obj.Expires) + } + v.Unknown = false + tf.Attrs["expires"] = v + } + } + { + t, ok := tf.AttrTypes["revision"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Metadata.Revision"}) + } else { + v, ok := tf.Attrs["revision"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Metadata.Revision", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Metadata.Revision", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Revision) == "" + } + v.Value = string(obj.Revision) + v.Unknown = false + tf.Attrs["revision"] = v + } + } + } + v.Unknown = false + tf.Attrs["metadata"] = v + } + } + } + { + a, ok := tf.AttrTypes["spec"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) + } else { + v, ok := tf.Attrs["spec"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + { + obj := obj.Spec + tf := &v + { + a, ok := tf.AttrTypes["roles"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Roles"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Roles", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) + } else { + c, ok := tf.Attrs["roles"].(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + c = github_com_hashicorp_terraform_plugin_framework_types.List{ + + ElemType: o.ElemType, + Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Roles)), + Null: true, + } + } else { + if c.Elems == nil { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Roles)) + } + } + if obj.Roles != nil { + t := o.ElemType + if len(obj.Roles) != len(c.Elems) { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Roles)) + } + for k, a := range obj.Roles { + v, ok := tf.Attrs["roles"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Roles", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Roles", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(a) == "" + } + v.Value = string(a) + v.Unknown = false + c.Elems[k] = v + } + if len(obj.Roles) > 0 { + c.Null = false + } + } + c.Unknown = false + tf.Attrs["roles"] = c + } + } + } + { + a, ok := tf.AttrTypes["allow"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Allow"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Allow", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) + } else { + c, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + c = github_com_hashicorp_terraform_plugin_framework_types.List{ + + ElemType: o.ElemType, + Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)), + Null: true, + } + } else { + if c.Elems == nil { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) + } + } + if obj.Allow != nil { + o := o.ElemType.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if len(obj.Allow) != len(c.Elems) { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) + } + for k, a := range obj.Allow { + v, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + if a == nil { + v.Null = true + } else { + obj := a + tf := &v + { + t, ok := tf.AttrTypes["aws_account"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Allow.AWSAccount"}) + } else { + v, ok := tf.Attrs["aws_account"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Allow.AWSAccount", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSAccount", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.AWSAccount) == "" + } + v.Value = string(obj.AWSAccount) + v.Unknown = false + tf.Attrs["aws_account"] = v + } + } + { + a, ok := tf.AttrTypes["aws_regions"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Allow.AWSRegions"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSRegions", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) + } else { + c, ok := tf.Attrs["aws_regions"].(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + c = github_com_hashicorp_terraform_plugin_framework_types.List{ + + ElemType: o.ElemType, + Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.AWSRegions)), + Null: true, + } + } else { + if c.Elems == nil { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.AWSRegions)) + } + } + if obj.AWSRegions != nil { + t := o.ElemType + if len(obj.AWSRegions) != len(c.Elems) { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.AWSRegions)) + } + for k, a := range obj.AWSRegions { + v, ok := tf.Attrs["aws_regions"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Allow.AWSRegions", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSRegions", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(a) == "" + } + v.Value = string(a) + v.Unknown = false + c.Elems[k] = v + } + if len(obj.AWSRegions) > 0 { + c.Null = false + } + } + c.Unknown = false + tf.Attrs["aws_regions"] = c + } + } + } + { + t, ok := tf.AttrTypes["aws_role"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Allow.AWSRole"}) + } else { + v, ok := tf.Attrs["aws_role"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Allow.AWSRole", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSRole", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.AWSRole) == "" + } + v.Value = string(obj.AWSRole) + v.Unknown = false + tf.Attrs["aws_role"] = v + } + } + { + t, ok := tf.AttrTypes["aws_arn"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Allow.AWSARN"}) + } else { + v, ok := tf.Attrs["aws_arn"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Allow.AWSARN", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSARN", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.AWSARN) == "" + } + v.Value = string(obj.AWSARN) + v.Unknown = false + tf.Attrs["aws_arn"] = v + } + } + } + v.Unknown = false + c.Elems[k] = v + } + if len(obj.Allow) > 0 { + c.Null = false + } + } + c.Unknown = false + tf.Attrs["allow"] = c + } + } + } + { + t, ok := tf.AttrTypes["aws_iid_ttl"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.AWSIIDTTL"}) + } else { + v, ok := tf.Attrs["aws_iid_ttl"].(github_com_gravitational_teleport_integrations_terraform_tfschema.DurationValue) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.AWSIIDTTL", err}) + } + v, ok = i.(github_com_gravitational_teleport_integrations_terraform_tfschema.DurationValue) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.AWSIIDTTL", "github.com/gravitational/teleport/integrations/terraform/tfschema.DurationValue"}) + } + v.Null = false + } + v.Value = time.Duration(obj.AWSIIDTTL) + v.Unknown = false + tf.Attrs["aws_iid_ttl"] = v + } + } + { + t, ok := tf.AttrTypes["join_method"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.JoinMethod"}) + } else { + v, ok := tf.Attrs["join_method"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.JoinMethod", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.JoinMethod", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.JoinMethod) == "" + } + v.Value = string(obj.JoinMethod) + v.Unknown = false + tf.Attrs["join_method"] = v + } + } + { + t, ok := tf.AttrTypes["bot_name"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.BotName"}) + } else { + v, ok := tf.Attrs["bot_name"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.BotName", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.BotName", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.BotName) == "" + } + v.Value = string(obj.BotName) + v.Unknown = false + tf.Attrs["bot_name"] = v + } + } + { + t, ok := tf.AttrTypes["suggested_labels"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.SuggestedLabels"}) + } else { + v := CopyToLabels(diags, obj.SuggestedLabels, t, tf.Attrs["suggested_labels"]) + tf.Attrs["suggested_labels"] = v + } + } + { + a, ok := tf.AttrTypes["github"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) + } else { + v, ok := tf.Attrs["github"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + if obj.GitHub == nil { + v.Null = true + } else { + obj := obj.GitHub + tf := &v + { + a, ok := tf.AttrTypes["allow"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) + } else { + c, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + c = github_com_hashicorp_terraform_plugin_framework_types.List{ + + ElemType: o.ElemType, + Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)), + Null: true, + } + } else { + if c.Elems == nil { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) + } + } + if obj.Allow != nil { + o := o.ElemType.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if len(obj.Allow) != len(c.Elems) { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) + } + for k, a := range obj.Allow { + v, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + if a == nil { + v.Null = true + } else { + obj := a + tf := &v + { + t, ok := tf.AttrTypes["sub"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Sub"}) + } else { + v, ok := tf.Attrs["sub"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.Allow.Sub", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Sub", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Sub) == "" + } + v.Value = string(obj.Sub) + v.Unknown = false + tf.Attrs["sub"] = v + } + } + { + t, ok := tf.AttrTypes["repository"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Repository"}) + } else { + v, ok := tf.Attrs["repository"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.Allow.Repository", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Repository", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Repository) == "" + } + v.Value = string(obj.Repository) + v.Unknown = false + tf.Attrs["repository"] = v + } + } + { + t, ok := tf.AttrTypes["repository_owner"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.RepositoryOwner"}) + } else { + v, ok := tf.Attrs["repository_owner"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.Allow.RepositoryOwner", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.RepositoryOwner", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.RepositoryOwner) == "" + } + v.Value = string(obj.RepositoryOwner) + v.Unknown = false + tf.Attrs["repository_owner"] = v + } + } + { + t, ok := tf.AttrTypes["workflow"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Workflow"}) + } else { + v, ok := tf.Attrs["workflow"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.Allow.Workflow", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Workflow", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Workflow) == "" + } + v.Value = string(obj.Workflow) + v.Unknown = false + tf.Attrs["workflow"] = v + } + } + { + t, ok := tf.AttrTypes["environment"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Environment"}) + } else { + v, ok := tf.Attrs["environment"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.Allow.Environment", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Environment", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Environment) == "" + } + v.Value = string(obj.Environment) + v.Unknown = false + tf.Attrs["environment"] = v + } + } + { + t, ok := tf.AttrTypes["actor"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Actor"}) + } else { + v, ok := tf.Attrs["actor"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.Allow.Actor", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Actor", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Actor) == "" + } + v.Value = string(obj.Actor) + v.Unknown = false + tf.Attrs["actor"] = v + } + } + { + t, ok := tf.AttrTypes["ref"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Ref"}) + } else { + v, ok := tf.Attrs["ref"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.Allow.Ref", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Ref", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Ref) == "" + } + v.Value = string(obj.Ref) + v.Unknown = false + tf.Attrs["ref"] = v + } + } + { + t, ok := tf.AttrTypes["ref_type"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.RefType"}) + } else { + v, ok := tf.Attrs["ref_type"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.Allow.RefType", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.RefType", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.RefType) == "" + } + v.Value = string(obj.RefType) + v.Unknown = false + tf.Attrs["ref_type"] = v + } + } + } + v.Unknown = false + c.Elems[k] = v + } + if len(obj.Allow) > 0 { + c.Null = false + } + } + c.Unknown = false + tf.Attrs["allow"] = c + } + } + } + { + t, ok := tf.AttrTypes["enterprise_server_host"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.EnterpriseServerHost"}) + } else { + v, ok := tf.Attrs["enterprise_server_host"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.EnterpriseServerHost", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.EnterpriseServerHost", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.EnterpriseServerHost) == "" + } + v.Value = string(obj.EnterpriseServerHost) + v.Unknown = false + tf.Attrs["enterprise_server_host"] = v + } + } + { + t, ok := tf.AttrTypes["enterprise_slug"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.EnterpriseSlug"}) + } else { + v, ok := tf.Attrs["enterprise_slug"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.EnterpriseSlug", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.EnterpriseSlug", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.EnterpriseSlug) == "" + } + v.Value = string(obj.EnterpriseSlug) + v.Unknown = false + tf.Attrs["enterprise_slug"] = v + } + } + } + v.Unknown = false + tf.Attrs["github"] = v + } + } + } + { + a, ok := tf.AttrTypes["circleci"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.CircleCI"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) + } else { + v, ok := tf.Attrs["circleci"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + if obj.CircleCI == nil { + v.Null = true + } else { + obj := obj.CircleCI + tf := &v + { + a, ok := tf.AttrTypes["allow"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.CircleCI.Allow"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI.Allow", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) + } else { + c, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + c = github_com_hashicorp_terraform_plugin_framework_types.List{ + + ElemType: o.ElemType, + Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)), + Null: true, + } + } else { + if c.Elems == nil { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) + } + } + if obj.Allow != nil { + o := o.ElemType.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if len(obj.Allow) != len(c.Elems) { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) + } + for k, a := range obj.Allow { + v, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + if a == nil { + v.Null = true + } else { + obj := a + tf := &v + { + t, ok := tf.AttrTypes["project_id"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.CircleCI.Allow.ProjectID"}) + } else { + v, ok := tf.Attrs["project_id"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.CircleCI.Allow.ProjectID", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI.Allow.ProjectID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.ProjectID) == "" + } + v.Value = string(obj.ProjectID) + v.Unknown = false + tf.Attrs["project_id"] = v + } + } + { + t, ok := tf.AttrTypes["context_id"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.CircleCI.Allow.ContextID"}) + } else { + v, ok := tf.Attrs["context_id"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.CircleCI.Allow.ContextID", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI.Allow.ContextID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.ContextID) == "" + } + v.Value = string(obj.ContextID) + v.Unknown = false + tf.Attrs["context_id"] = v + } + } + } + v.Unknown = false + c.Elems[k] = v + } + if len(obj.Allow) > 0 { + c.Null = false + } + } + c.Unknown = false + tf.Attrs["allow"] = c + } + } + } + { + t, ok := tf.AttrTypes["organization_id"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.CircleCI.OrganizationID"}) + } else { + v, ok := tf.Attrs["organization_id"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.CircleCI.OrganizationID", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI.OrganizationID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.OrganizationID) == "" + } + v.Value = string(obj.OrganizationID) + v.Unknown = false + tf.Attrs["organization_id"] = v + } + } + } + v.Unknown = false + tf.Attrs["circleci"] = v + } + } + } + { + t, ok := tf.AttrTypes["suggested_agent_matcher_labels"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.SuggestedAgentMatcherLabels"}) + } else { + v := CopyToLabels(diags, obj.SuggestedAgentMatcherLabels, t, tf.Attrs["suggested_agent_matcher_labels"]) + tf.Attrs["suggested_agent_matcher_labels"] = v + } + } + { + a, ok := tf.AttrTypes["kubernetes"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Kubernetes"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) + } else { + v, ok := tf.Attrs["kubernetes"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + if obj.Kubernetes == nil { + v.Null = true + } else { + obj := obj.Kubernetes + tf := &v + { + a, ok := tf.AttrTypes["allow"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.Allow"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.Allow", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) + } else { + c, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + c = github_com_hashicorp_terraform_plugin_framework_types.List{ + + ElemType: o.ElemType, + Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)), + Null: true, + } + } else { + if c.Elems == nil { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) + } + } + if obj.Allow != nil { + o := o.ElemType.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if len(obj.Allow) != len(c.Elems) { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) + } + for k, a := range obj.Allow { + v, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + if a == nil { + v.Null = true + } else { + obj := a + tf := &v + { + t, ok := tf.AttrTypes["service_account"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.Allow.ServiceAccount"}) + } else { + v, ok := tf.Attrs["service_account"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Kubernetes.Allow.ServiceAccount", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.Allow.ServiceAccount", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.ServiceAccount) == "" + } + v.Value = string(obj.ServiceAccount) + v.Unknown = false + tf.Attrs["service_account"] = v + } + } + } + v.Unknown = false + c.Elems[k] = v + } + if len(obj.Allow) > 0 { + c.Null = false + } + } + c.Unknown = false + tf.Attrs["allow"] = c + } + } + } + { + t, ok := tf.AttrTypes["type"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.Type"}) + } else { + v, ok := tf.Attrs["type"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Kubernetes.Type", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.Type", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Type) == "" + } + v.Value = string(obj.Type) + v.Unknown = false + tf.Attrs["type"] = v + } + } + { + a, ok := tf.AttrTypes["static_jwks"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.StaticJWKS"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.StaticJWKS", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) + } else { + v, ok := tf.Attrs["static_jwks"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + if obj.StaticJWKS == nil { + v.Null = true + } else { + obj := obj.StaticJWKS + tf := &v + { + t, ok := tf.AttrTypes["jwks"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.StaticJWKS.JWKS"}) + } else { + v, ok := tf.Attrs["jwks"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Kubernetes.StaticJWKS.JWKS", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.StaticJWKS.JWKS", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.JWKS) == "" + } + v.Value = string(obj.JWKS) + v.Unknown = false + tf.Attrs["jwks"] = v + } + } + } + v.Unknown = false + tf.Attrs["static_jwks"] = v + } + } + } + } + v.Unknown = false + tf.Attrs["kubernetes"] = v + } + } + } + { + a, ok := tf.AttrTypes["azure"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Azure"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Azure", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) + } else { + v, ok := tf.Attrs["azure"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + if obj.Azure == nil { + v.Null = true + } else { + obj := obj.Azure + tf := &v + { + a, ok := tf.AttrTypes["allow"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Azure.Allow"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Azure.Allow", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) + } else { + c, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + c = github_com_hashicorp_terraform_plugin_framework_types.List{ + + ElemType: o.ElemType, + Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)), + Null: true, + } + } else { + if c.Elems == nil { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) + } + } + if obj.Allow != nil { + o := o.ElemType.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if len(obj.Allow) != len(c.Elems) { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) + } + for k, a := range obj.Allow { + v, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + if a == nil { + v.Null = true + } else { + obj := a + tf := &v + { + t, ok := tf.AttrTypes["subscription"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Azure.Allow.Subscription"}) + } else { + v, ok := tf.Attrs["subscription"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Azure.Allow.Subscription", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Azure.Allow.Subscription", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Subscription) == "" + } + v.Value = string(obj.Subscription) + v.Unknown = false + tf.Attrs["subscription"] = v + } + } + { + a, ok := tf.AttrTypes["resource_groups"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Azure.Allow.ResourceGroups"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Azure.Allow.ResourceGroups", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) + } else { + c, ok := tf.Attrs["resource_groups"].(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + c = github_com_hashicorp_terraform_plugin_framework_types.List{ + + ElemType: o.ElemType, + Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.ResourceGroups)), + Null: true, + } + } else { + if c.Elems == nil { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.ResourceGroups)) + } + } + if obj.ResourceGroups != nil { + t := o.ElemType + if len(obj.ResourceGroups) != len(c.Elems) { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.ResourceGroups)) + } + for k, a := range obj.ResourceGroups { + v, ok := tf.Attrs["resource_groups"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Azure.Allow.ResourceGroups", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Azure.Allow.ResourceGroups", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(a) == "" + } + v.Value = string(a) + v.Unknown = false + c.Elems[k] = v + } + if len(obj.ResourceGroups) > 0 { + c.Null = false + } + } + c.Unknown = false + tf.Attrs["resource_groups"] = c + } + } + } + } + v.Unknown = false + c.Elems[k] = v + } + if len(obj.Allow) > 0 { + c.Null = false + } + } + c.Unknown = false + tf.Attrs["allow"] = c + } + } + } + } + v.Unknown = false + tf.Attrs["azure"] = v + } + } + } + { + a, ok := tf.AttrTypes["gitlab"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) + } else { + v, ok := tf.Attrs["gitlab"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + if obj.GitLab == nil { + v.Null = true + } else { + obj := obj.GitLab + tf := &v + { + a, ok := tf.AttrTypes["allow"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) + } else { + c, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + c = github_com_hashicorp_terraform_plugin_framework_types.List{ + + ElemType: o.ElemType, + Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)), + Null: true, + } + } else { + if c.Elems == nil { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) + } + } + if obj.Allow != nil { + o := o.ElemType.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if len(obj.Allow) != len(c.Elems) { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) + } + for k, a := range obj.Allow { + v, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + if a == nil { + v.Null = true + } else { + obj := a + tf := &v + { + t, ok := tf.AttrTypes["sub"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Sub"}) + } else { + v, ok := tf.Attrs["sub"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.Sub", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Sub", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Sub) == "" + } + v.Value = string(obj.Sub) + v.Unknown = false + tf.Attrs["sub"] = v + } + } + { + t, ok := tf.AttrTypes["ref"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Ref"}) + } else { + v, ok := tf.Attrs["ref"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.Ref", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Ref", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Ref) == "" + } + v.Value = string(obj.Ref) + v.Unknown = false + tf.Attrs["ref"] = v + } + } + { + t, ok := tf.AttrTypes["ref_type"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.RefType"}) + } else { + v, ok := tf.Attrs["ref_type"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.RefType", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.RefType", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.RefType) == "" + } + v.Value = string(obj.RefType) + v.Unknown = false + tf.Attrs["ref_type"] = v + } + } + { + t, ok := tf.AttrTypes["namespace_path"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.NamespacePath"}) + } else { + v, ok := tf.Attrs["namespace_path"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.NamespacePath", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.NamespacePath", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.NamespacePath) == "" + } + v.Value = string(obj.NamespacePath) + v.Unknown = false + tf.Attrs["namespace_path"] = v + } + } + { + t, ok := tf.AttrTypes["project_path"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectPath"}) + } else { + v, ok := tf.Attrs["project_path"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectPath", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectPath", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.ProjectPath) == "" + } + v.Value = string(obj.ProjectPath) + v.Unknown = false + tf.Attrs["project_path"] = v + } + } + { + t, ok := tf.AttrTypes["pipeline_source"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.PipelineSource"}) + } else { + v, ok := tf.Attrs["pipeline_source"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.PipelineSource", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.PipelineSource", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.PipelineSource) == "" + } + v.Value = string(obj.PipelineSource) + v.Unknown = false + tf.Attrs["pipeline_source"] = v + } + } + { + t, ok := tf.AttrTypes["environment"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Environment"}) + } else { + v, ok := tf.Attrs["environment"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.Environment", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Environment", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Environment) == "" + } + v.Value = string(obj.Environment) + v.Unknown = false + tf.Attrs["environment"] = v + } + } + { + t, ok := tf.AttrTypes["user_login"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserLogin"}) + } else { + v, ok := tf.Attrs["user_login"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.UserLogin", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserLogin", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.UserLogin) == "" + } + v.Value = string(obj.UserLogin) + v.Unknown = false + tf.Attrs["user_login"] = v + } + } + { + t, ok := tf.AttrTypes["user_id"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserID"}) + } else { + v, ok := tf.Attrs["user_id"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.UserID", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.UserID) == "" + } + v.Value = string(obj.UserID) + v.Unknown = false + tf.Attrs["user_id"] = v + } + } + { + t, ok := tf.AttrTypes["user_email"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserEmail"}) + } else { + v, ok := tf.Attrs["user_email"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.UserEmail", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserEmail", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.UserEmail) == "" + } + v.Value = string(obj.UserEmail) + v.Unknown = false + tf.Attrs["user_email"] = v + } + } + { + t, ok := tf.AttrTypes["ref_protected"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.RefProtected"}) + } else { + v := CopyToBoolOptionNullable(diags, obj.RefProtected, t, tf.Attrs["ref_protected"]) + tf.Attrs["ref_protected"] = v + } + } + { + t, ok := tf.AttrTypes["environment_protected"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.EnvironmentProtected"}) + } else { + v := CopyToBoolOptionNullable(diags, obj.EnvironmentProtected, t, tf.Attrs["environment_protected"]) + tf.Attrs["environment_protected"] = v + } + } + { + t, ok := tf.AttrTypes["ci_config_sha"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigSHA"}) + } else { + v, ok := tf.Attrs["ci_config_sha"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigSHA", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigSHA", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.CIConfigSHA) == "" + } + v.Value = string(obj.CIConfigSHA) + v.Unknown = false + tf.Attrs["ci_config_sha"] = v + } + } + { + t, ok := tf.AttrTypes["ci_config_ref_uri"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigRefURI"}) + } else { + v, ok := tf.Attrs["ci_config_ref_uri"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigRefURI", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigRefURI", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.CIConfigRefURI) == "" + } + v.Value = string(obj.CIConfigRefURI) + v.Unknown = false + tf.Attrs["ci_config_ref_uri"] = v + } + } + { + t, ok := tf.AttrTypes["deployment_tier"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.DeploymentTier"}) + } else { + v, ok := tf.Attrs["deployment_tier"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.DeploymentTier", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.DeploymentTier", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.DeploymentTier) == "" + } + v.Value = string(obj.DeploymentTier) + v.Unknown = false + tf.Attrs["deployment_tier"] = v + } + } + { + t, ok := tf.AttrTypes["project_visibility"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectVisibility"}) + } else { + v, ok := tf.Attrs["project_visibility"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectVisibility", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectVisibility", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.ProjectVisibility) == "" + } + v.Value = string(obj.ProjectVisibility) + v.Unknown = false + tf.Attrs["project_visibility"] = v + } + } + } + v.Unknown = false + c.Elems[k] = v + } + if len(obj.Allow) > 0 { + c.Null = false + } + } + c.Unknown = false + tf.Attrs["allow"] = c + } + } + } + { + t, ok := tf.AttrTypes["domain"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Domain"}) + } else { + v, ok := tf.Attrs["domain"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Domain", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Domain", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Domain) == "" + } + v.Value = string(obj.Domain) + v.Unknown = false + tf.Attrs["domain"] = v + } + } + } + v.Unknown = false + tf.Attrs["gitlab"] = v + } + } + } + { + a, ok := tf.AttrTypes["gcp"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GCP"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GCP", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) + } else { + v, ok := tf.Attrs["gcp"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + if obj.GCP == nil { + v.Null = true + } else { + obj := obj.GCP + tf := &v + { + a, ok := tf.AttrTypes["allow"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GCP.Allow"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) + } else { + c, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + c = github_com_hashicorp_terraform_plugin_framework_types.List{ + + ElemType: o.ElemType, + Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)), + Null: true, + } + } else { + if c.Elems == nil { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) + } + } + if obj.Allow != nil { + o := o.ElemType.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if len(obj.Allow) != len(c.Elems) { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) + } + for k, a := range obj.Allow { + v, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + if a == nil { + v.Null = true + } else { + obj := a + tf := &v + { + a, ok := tf.AttrTypes["project_ids"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GCP.Allow.ProjectIDs"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.ProjectIDs", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) + } else { + c, ok := tf.Attrs["project_ids"].(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + c = github_com_hashicorp_terraform_plugin_framework_types.List{ + + ElemType: o.ElemType, + Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.ProjectIDs)), + Null: true, + } + } else { + if c.Elems == nil { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.ProjectIDs)) + } + } + if obj.ProjectIDs != nil { + t := o.ElemType + if len(obj.ProjectIDs) != len(c.Elems) { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.ProjectIDs)) + } + for k, a := range obj.ProjectIDs { + v, ok := tf.Attrs["project_ids"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GCP.Allow.ProjectIDs", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.ProjectIDs", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(a) == "" + } + v.Value = string(a) + v.Unknown = false + c.Elems[k] = v + } + if len(obj.ProjectIDs) > 0 { + c.Null = false + } + } + c.Unknown = false + tf.Attrs["project_ids"] = c + } + } + } + { + a, ok := tf.AttrTypes["locations"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GCP.Allow.Locations"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.Locations", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) + } else { + c, ok := tf.Attrs["locations"].(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + c = github_com_hashicorp_terraform_plugin_framework_types.List{ + + ElemType: o.ElemType, + Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Locations)), + Null: true, + } + } else { + if c.Elems == nil { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Locations)) + } + } + if obj.Locations != nil { + t := o.ElemType + if len(obj.Locations) != len(c.Elems) { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Locations)) + } + for k, a := range obj.Locations { + v, ok := tf.Attrs["locations"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GCP.Allow.Locations", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.Locations", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(a) == "" + } + v.Value = string(a) + v.Unknown = false + c.Elems[k] = v + } + if len(obj.Locations) > 0 { + c.Null = false + } + } + c.Unknown = false + tf.Attrs["locations"] = c + } + } + } + { + a, ok := tf.AttrTypes["service_accounts"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GCP.Allow.ServiceAccounts"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.ServiceAccounts", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) + } else { + c, ok := tf.Attrs["service_accounts"].(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + c = github_com_hashicorp_terraform_plugin_framework_types.List{ + + ElemType: o.ElemType, + Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.ServiceAccounts)), + Null: true, + } + } else { + if c.Elems == nil { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.ServiceAccounts)) + } + } + if obj.ServiceAccounts != nil { + t := o.ElemType + if len(obj.ServiceAccounts) != len(c.Elems) { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.ServiceAccounts)) + } + for k, a := range obj.ServiceAccounts { + v, ok := tf.Attrs["service_accounts"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GCP.Allow.ServiceAccounts", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.ServiceAccounts", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(a) == "" + } + v.Value = string(a) + v.Unknown = false + c.Elems[k] = v + } + if len(obj.ServiceAccounts) > 0 { + c.Null = false + } + } + c.Unknown = false + tf.Attrs["service_accounts"] = c + } + } + } + } + v.Unknown = false + c.Elems[k] = v + } + if len(obj.Allow) > 0 { + c.Null = false + } + } + c.Unknown = false + tf.Attrs["allow"] = c + } + } + } + } + v.Unknown = false + tf.Attrs["gcp"] = v + } + } + } + { + a, ok := tf.AttrTypes["spacelift"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Spacelift"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) + } else { + v, ok := tf.Attrs["spacelift"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + if obj.Spacelift == nil { + v.Null = true + } else { + obj := obj.Spacelift + tf := &v + { + a, ok := tf.AttrTypes["allow"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) + } else { + c, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + c = github_com_hashicorp_terraform_plugin_framework_types.List{ + + ElemType: o.ElemType, + Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)), + Null: true, + } + } else { + if c.Elems == nil { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) + } + } + if obj.Allow != nil { + o := o.ElemType.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if len(obj.Allow) != len(c.Elems) { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) + } + for k, a := range obj.Allow { + v, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + if a == nil { + v.Null = true + } else { + obj := a + tf := &v + { + t, ok := tf.AttrTypes["space_id"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.SpaceID"}) + } else { + v, ok := tf.Attrs["space_id"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Spacelift.Allow.SpaceID", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.SpaceID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.SpaceID) == "" + } + v.Value = string(obj.SpaceID) + v.Unknown = false + tf.Attrs["space_id"] = v + } + } + { + t, ok := tf.AttrTypes["caller_id"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerID"}) + } else { + v, ok := tf.Attrs["caller_id"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerID", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.CallerID) == "" + } + v.Value = string(obj.CallerID) + v.Unknown = false + tf.Attrs["caller_id"] = v + } + } + { + t, ok := tf.AttrTypes["caller_type"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerType"}) + } else { + v, ok := tf.Attrs["caller_type"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerType", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerType", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.CallerType) == "" + } + v.Value = string(obj.CallerType) + v.Unknown = false + tf.Attrs["caller_type"] = v + } + } + { + t, ok := tf.AttrTypes["scope"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.Scope"}) + } else { + v, ok := tf.Attrs["scope"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Spacelift.Allow.Scope", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.Scope", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Scope) == "" + } + v.Value = string(obj.Scope) + v.Unknown = false + tf.Attrs["scope"] = v + } + } + } + v.Unknown = false + c.Elems[k] = v + } + if len(obj.Allow) > 0 { + c.Null = false + } + } + c.Unknown = false + tf.Attrs["allow"] = c + } + } + } + { + t, ok := tf.AttrTypes["hostname"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Hostname"}) + } else { + v, ok := tf.Attrs["hostname"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Spacelift.Hostname", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Hostname", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Hostname) == "" + } + v.Value = string(obj.Hostname) + v.Unknown = false + tf.Attrs["hostname"] = v + } + } + } + v.Unknown = false + tf.Attrs["spacelift"] = v + } + } + } + { + a, ok := tf.AttrTypes["tpm"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.TPM"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.TPM", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) + } else { + v, ok := tf.Attrs["tpm"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + if obj.TPM == nil { + v.Null = true + } else { + obj := obj.TPM + tf := &v + { + a, ok := tf.AttrTypes["allow"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.TPM.Allow"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.TPM.Allow", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) + } else { + c, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + c = github_com_hashicorp_terraform_plugin_framework_types.List{ + + ElemType: o.ElemType, + Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)), + Null: true, + } + } else { + if c.Elems == nil { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) + } + } + if obj.Allow != nil { + o := o.ElemType.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if len(obj.Allow) != len(c.Elems) { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) + } + for k, a := range obj.Allow { + v, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + if a == nil { + v.Null = true + } else { + obj := a + tf := &v + { + t, ok := tf.AttrTypes["description"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.TPM.Allow.Description"}) + } else { + v, ok := tf.Attrs["description"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.TPM.Allow.Description", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.TPM.Allow.Description", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Description) == "" + } + v.Value = string(obj.Description) + v.Unknown = false + tf.Attrs["description"] = v + } + } + { + t, ok := tf.AttrTypes["ek_public_hash"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.TPM.Allow.EKPublicHash"}) + } else { + v, ok := tf.Attrs["ek_public_hash"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.TPM.Allow.EKPublicHash", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.TPM.Allow.EKPublicHash", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.EKPublicHash) == "" + } + v.Value = string(obj.EKPublicHash) + v.Unknown = false + tf.Attrs["ek_public_hash"] = v + } + } + { + t, ok := tf.AttrTypes["ek_certificate_serial"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.TPM.Allow.EKCertificateSerial"}) + } else { + v, ok := tf.Attrs["ek_certificate_serial"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.TPM.Allow.EKCertificateSerial", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.TPM.Allow.EKCertificateSerial", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.EKCertificateSerial) == "" + } + v.Value = string(obj.EKCertificateSerial) + v.Unknown = false + tf.Attrs["ek_certificate_serial"] = v + } + } + } + v.Unknown = false + c.Elems[k] = v + } + if len(obj.Allow) > 0 { + c.Null = false + } + } + c.Unknown = false + tf.Attrs["allow"] = c + } + } + } + { + a, ok := tf.AttrTypes["ekcert_allowed_cas"] + if !ok { + diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.TPM.EKCertAllowedCAs"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.TPM.EKCertAllowedCAs", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) + } else { + c, ok := tf.Attrs["ekcert_allowed_cas"].(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + c = github_com_hashicorp_terraform_plugin_framework_types.List{ + + ElemType: o.ElemType, + Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.EKCertAllowedCAs)), + Null: true, + } + } else { + if c.Elems == nil { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.EKCertAllowedCAs)) + } + } + if obj.EKCertAllowedCAs != nil { + t := o.ElemType + if len(obj.EKCertAllowedCAs) != len(c.Elems) { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.EKCertAllowedCAs)) + } + for k, a := range obj.EKCertAllowedCAs { + v, ok := tf.Attrs["ekcert_allowed_cas"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.TPM.EKCertAllowedCAs", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.TPM.EKCertAllowedCAs", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(a) == "" + } + v.Value = string(a) + v.Unknown = false + c.Elems[k] = v + } + if len(obj.EKCertAllowedCAs) > 0 { + c.Null = false + } + } + c.Unknown = false + tf.Attrs["ekcert_allowed_cas"] = c + } + } + } + } + v.Unknown = false + tf.Attrs["tpm"] = v + } + } + } + } + v.Unknown = false + tf.Attrs["spec"] = v + } + } + } + return diags +} + +// attrReadMissingDiag represents diagnostic message on an attribute missing in the source object +type attrReadMissingDiag struct { + Path string +} + +func (d attrReadMissingDiag) Severity() github_com_hashicorp_terraform_plugin_framework_diag.Severity { + return github_com_hashicorp_terraform_plugin_framework_diag.SeverityError +} + +func (d attrReadMissingDiag) Summary() string { + return "Error reading from Terraform object" +} + +func (d attrReadMissingDiag) Detail() string { + return fmt.Sprintf("A value for %v is missing in the source Terraform object Attrs", d.Path) +} + +func (d attrReadMissingDiag) Equal(o github_com_hashicorp_terraform_plugin_framework_diag.Diagnostic) bool { + return (d.Severity() == o.Severity()) && (d.Summary() == o.Summary()) && (d.Detail() == o.Detail()) +} + +// attrReadConversionFailureDiag represents diagnostic message on a failed type conversion on read +type attrReadConversionFailureDiag struct { + Path string + Type string +} + +func (d attrReadConversionFailureDiag) Severity() github_com_hashicorp_terraform_plugin_framework_diag.Severity { + return github_com_hashicorp_terraform_plugin_framework_diag.SeverityError +} + +func (d attrReadConversionFailureDiag) Summary() string { + return "Error reading from Terraform object" +} + +func (d attrReadConversionFailureDiag) Detail() string { + return fmt.Sprintf("A value for %v can not be converted to %v", d.Path, d.Type) +} + +func (d attrReadConversionFailureDiag) Equal(o github_com_hashicorp_terraform_plugin_framework_diag.Diagnostic) bool { + return (d.Severity() == o.Severity()) && (d.Summary() == o.Summary()) && (d.Detail() == o.Detail()) +} + +// attrWriteMissingDiag represents diagnostic message on an attribute missing in the target object +type attrWriteMissingDiag struct { + Path string +} + +func (d attrWriteMissingDiag) Severity() github_com_hashicorp_terraform_plugin_framework_diag.Severity { + return github_com_hashicorp_terraform_plugin_framework_diag.SeverityError +} + +func (d attrWriteMissingDiag) Summary() string { + return "Error writing to Terraform object" +} + +func (d attrWriteMissingDiag) Detail() string { + return fmt.Sprintf("A value for %v is missing in the source Terraform object AttrTypes", d.Path) +} + +func (d attrWriteMissingDiag) Equal(o github_com_hashicorp_terraform_plugin_framework_diag.Diagnostic) bool { + return (d.Severity() == o.Severity()) && (d.Summary() == o.Summary()) && (d.Detail() == o.Detail()) +} + +// attrWriteConversionFailureDiag represents diagnostic message on a failed type conversion on write +type attrWriteConversionFailureDiag struct { + Path string + Type string +} + +func (d attrWriteConversionFailureDiag) Severity() github_com_hashicorp_terraform_plugin_framework_diag.Severity { + return github_com_hashicorp_terraform_plugin_framework_diag.SeverityError +} + +func (d attrWriteConversionFailureDiag) Summary() string { + return "Error writing to Terraform object" +} + +func (d attrWriteConversionFailureDiag) Detail() string { + return fmt.Sprintf("A value for %v can not be converted to %v", d.Path, d.Type) +} + +func (d attrWriteConversionFailureDiag) Equal(o github_com_hashicorp_terraform_plugin_framework_diag.Diagnostic) bool { + return (d.Severity() == o.Severity()) && (d.Summary() == o.Summary()) && (d.Detail() == o.Detail()) +} + +// attrWriteGeneralError represents diagnostic message on a generic error on write +type attrWriteGeneralError struct { + Path string + Err error +} + +func (d attrWriteGeneralError) Severity() github_com_hashicorp_terraform_plugin_framework_diag.Severity { + return github_com_hashicorp_terraform_plugin_framework_diag.SeverityError +} + +func (d attrWriteGeneralError) Summary() string { + return "Error writing to Terraform object" +} + +func (d attrWriteGeneralError) Detail() string { + return fmt.Sprintf("%s: %s", d.Path, d.Err.Error()) +} + +func (d attrWriteGeneralError) Equal(o github_com_hashicorp_terraform_plugin_framework_diag.Diagnostic) bool { + return (d.Severity() == o.Severity()) && (d.Summary() == o.Summary()) && (d.Detail() == o.Detail()) +} diff --git a/integrations/terraform/tfschema/types_terraform.go b/integrations/terraform/tfschema/types_terraform.go index 185b589c3df26..3b052a5953a35 100644 --- a/integrations/terraform/tfschema/types_terraform.go +++ b/integrations/terraform/tfschema/types_terraform.go @@ -904,8 +904,8 @@ func GenSchemaAppV3(ctx context.Context) (github_com_hashicorp_terraform_plugin_ }}, nil } -// GenSchemaProvisionTokenV2 returns tfsdk.Schema definition for ProvisionTokenV2 -func GenSchemaProvisionTokenV2(ctx context.Context) (github_com_hashicorp_terraform_plugin_framework_tfsdk.Schema, github_com_hashicorp_terraform_plugin_framework_diag.Diagnostics) { +// GenSchemaClusterNetworkingConfigV2 returns tfsdk.Schema definition for ClusterNetworkingConfigV2 +func GenSchemaClusterNetworkingConfigV2(ctx context.Context) (github_com_hashicorp_terraform_plugin_framework_tfsdk.Schema, github_com_hashicorp_terraform_plugin_framework_diag.Diagnostics) { return github_com_hashicorp_terraform_plugin_framework_tfsdk.Schema{Attributes: map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ "id": { Computed: true, @@ -938,14 +938,7 @@ func GenSchemaProvisionTokenV2(ctx context.Context) (github_com_hashicorp_terraf Description: "Labels is a set of labels", Optional: true, Type: github_com_hashicorp_terraform_plugin_framework_types.MapType{ElemType: github_com_hashicorp_terraform_plugin_framework_types.StringType}, - }, - "name": { - Computed: true, - Description: "Name is an object name", - Optional: true, - PlanModifiers: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributePlanModifier{github_com_hashicorp_terraform_plugin_framework_tfsdk.RequiresReplace(), github_com_hashicorp_terraform_plugin_framework_tfsdk.UseStateForUnknown()}, - Sensitive: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + Validators: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributeValidator{UseMapKeysPresentValidator("teleport.dev/origin")}, }, "namespace": { Computed: true, @@ -965,348 +958,93 @@ func GenSchemaProvisionTokenV2(ctx context.Context) (github_com_hashicorp_terraf }, "spec": { Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ - "allow": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.ListNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ - "aws_account": { - Description: "AWSAccount is the AWS account ID.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "aws_arn": { - Description: "AWSARN is used for the IAM join method, the AWS identity of joining nodes must match this ARN. Supports wildcards \"*\" and \"?\".", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "aws_regions": { - Description: "AWSRegions is used for the EC2 join method and is a list of AWS regions a node is allowed to join from.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.ListType{ElemType: github_com_hashicorp_terraform_plugin_framework_types.StringType}, - }, - "aws_role": { - Description: "AWSRole is used for the EC2 join method and is the the ARN of the AWS role that the auth server will assume in order to call the ec2 API.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - }), - Description: "Allow is a list of TokenRules, nodes using this token must match one allow rule to use this token.", + "assist_command_execution_workers": { + Description: "AssistCommandExecutionWorkers determines the number of workers that will execute arbitrary Assist commands on servers in parallel", Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.Int64Type, }, - "aws_iid_ttl": { - Computed: true, - Description: "AWSIIDTTL is the TTL to use for AWS EC2 Instance Identity Documents used to join the cluster with this token.", - Optional: true, - PlanModifiers: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributePlanModifier{github_com_hashicorp_terraform_plugin_framework_tfsdk.UseStateForUnknown()}, - Type: DurationType{}, + "case_insensitive_routing": { + Description: "CaseInsensitiveRouting causes proxies to use case-insensitive hostname matching.", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.BoolType, }, - "azure": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{"allow": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.ListNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ - "resource_groups": { - Description: "ResourceGroups is a list of Azure resource groups the node is allowed to join from.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.ListType{ElemType: github_com_hashicorp_terraform_plugin_framework_types.StringType}, - }, - "subscription": { - Description: "Subscription is the Azure subscription.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - }), - Description: "Allow is a list of Rules, nodes using this token must match one allow rule to use this token.", - Optional: true, - }}), - Description: "Azure allows the configuration of options specific to the \"azure\" join method.", + "client_idle_timeout": { + Description: "ClientIdleTimeout sets global cluster default setting for client idle timeouts.", Optional: true, + Type: DurationType{}, }, - "bot_name": { - Description: "BotName is the name of the bot this token grants access to, if any", + "idle_timeout_message": { + Description: "ClientIdleTimeoutMessage is the message sent to the user when a connection times out.", Optional: true, Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, }, - "circleci": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ - "allow": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.ListNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ - "context_id": { - Description: "", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "project_id": { - Description: "", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - }), - Description: "Allow is a list of TokenRules, nodes using this token must match one allow rule to use this token.", - Optional: true, - }, - "organization_id": { - Description: "", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - }), - Description: "CircleCI allows the configuration of options specific to the \"circleci\" join method.", - Optional: true, + "keep_alive_count_max": { + Computed: true, + Description: "KeepAliveCountMax is the number of keep-alive messages that can be missed before the server disconnects the connection to the client.", + Optional: true, + PlanModifiers: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributePlanModifier{github_com_hashicorp_terraform_plugin_framework_tfsdk.UseStateForUnknown()}, + Type: github_com_hashicorp_terraform_plugin_framework_types.Int64Type, }, - "gcp": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{"allow": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.ListNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ - "locations": { - Description: "Locations is a list of regions (e.g. \"us-west1\") and/or zones (e.g. \"us-west1-b\").", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.ListType{ElemType: github_com_hashicorp_terraform_plugin_framework_types.StringType}, - }, - "project_ids": { - Description: "ProjectIDs is a list of project IDs (e.g. \"\").", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.ListType{ElemType: github_com_hashicorp_terraform_plugin_framework_types.StringType}, - }, - "service_accounts": { - Description: "ServiceAccounts is a list of service account emails (e.g. \"-compute@developer.gserviceaccount.com\").", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.ListType{ElemType: github_com_hashicorp_terraform_plugin_framework_types.StringType}, - }, - }), - Description: "Allow is a list of Rules, nodes using this token must match one allow rule to use this token.", - Optional: true, - }}), - Description: "GCP allows the configuration of options specific to the \"gcp\" join method.", + "keep_alive_interval": { + Computed: true, + Description: "KeepAliveInterval is the interval at which the server sends keep-alive messages to the client.", + Optional: true, + PlanModifiers: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributePlanModifier{github_com_hashicorp_terraform_plugin_framework_tfsdk.UseStateForUnknown()}, + Type: DurationType{}, + }, + "proxy_listener_mode": { + Description: "ProxyListenerMode is proxy listener mode used by Teleport Proxies. 0 is \"separate\"; 1 is \"multiplex\".", Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.Int64Type, }, - "github": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ - "allow": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.ListNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ - "actor": { - Description: "The personal account that initiated the workflow run.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "environment": { - Description: "The name of the environment used by the job.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "ref": { - Description: "The git ref that triggered the workflow run.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "ref_type": { - Description: "The type of ref, for example: \"branch\".", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "repository": { - Description: "The repository from where the workflow is running. This includes the name of the owner e.g `gravitational/teleport`", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "repository_owner": { - Description: "The name of the organization in which the repository is stored.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "sub": { - Description: "Sub also known as Subject is a string that roughly uniquely identifies the workload. The format of this varies depending on the type of github action run.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "workflow": { - Description: "The name of the workflow.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - }), - Description: "Allow is a list of TokenRules, nodes using this token must match one allow rule to use this token.", - Optional: true, - }, - "enterprise_server_host": { - Description: "EnterpriseServerHost allows joining from runners associated with a GitHub Enterprise Server instance. When unconfigured, tokens will be validated against github.com, but when configured to the host of a GHES instance, then the tokens will be validated against host. This value should be the hostname of the GHES instance, and should not include the scheme or a path. The instance must be accessible over HTTPS at this hostname and the certificate must be trusted by the Auth Server.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "enterprise_slug": { - Description: "EnterpriseSlug allows the slug of a GitHub Enterprise organisation to be included in the expected issuer of the OIDC tokens. This is for compatibility with the `include_enterprise_slug` option in GHE. This field should be set to the slug of your enterprise if this is enabled. If this is not enabled, then this field must be left empty. This field cannot be specified if `enterprise_server_host` is specified. See https://docs.github.com/en/enterprise-cloud@latest/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#customizing-the-issuer-value-for-an-enterprise for more information about customized issuer values.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - }), - Description: "GitHub allows the configuration of options specific to the \"github\" join method.", + "proxy_ping_interval": { + Description: "ProxyPingInterval defines in which interval the TLS routing ping message should be sent. This is applicable only when using ping-wrapped connections, regular TLS routing connections are not affected.", Optional: true, + Type: DurationType{}, }, - "gitlab": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ - "allow": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.ListNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ - "ci_config_ref_uri": { - Description: "CIConfigRefURI is the ref path to the top-level pipeline definition, for example, gitlab.example.com/my-group/my-project//.gitlab-ci.yml@refs/heads/main.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "ci_config_sha": { - Description: "CIConfigSHA is the git commit SHA for the ci_config_ref_uri.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "deployment_tier": { - Description: "DeploymentTier is the deployment tier of the environment the job specifies", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "environment": { - Description: "Environment limits access by the environment the job deploys to (if one is associated)", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "environment_protected": GenSchemaBoolOption(ctx), - "namespace_path": { - Description: "NamespacePath is used to limit access to jobs in a group or user's projects. Example: `mygroup` This field supports simple \"glob-style\" matching: - Use '*' to match zero or more characters. - Use '?' to match any single character.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "pipeline_source": { - Description: "PipelineSource limits access by the job pipeline source type. https://docs.gitlab.com/ee/ci/jobs/job_control.html#common-if-clauses-for-rules Example: `web`", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "project_path": { - Description: "ProjectPath is used to limit access to jobs belonging to an individual project. Example: `mygroup/myproject` This field supports simple \"glob-style\" matching: - Use '*' to match zero or more characters. - Use '?' to match any single character.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "project_visibility": { - Description: "ProjectVisibility is the visibility of the project where the pipeline is running. Can be internal, private, or public.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "ref": { - Description: "Ref allows access to be limited to jobs triggered by a specific git ref. Ensure this is used in combination with ref_type. This field supports simple \"glob-style\" matching: - Use '*' to match zero or more characters. - Use '?' to match any single character.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "ref_protected": GenSchemaBoolOption(ctx), - "ref_type": { - Description: "RefType allows access to be limited to jobs triggered by a specific git ref type. Example: `branch` or `tag`", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "sub": { - Description: "Sub roughly uniquely identifies the workload. Example: `project_path:mygroup/my-project:ref_type:branch:ref:main` project_path:GROUP/PROJECT:ref_type:TYPE:ref:BRANCH_NAME This field supports simple \"glob-style\" matching: - Use '*' to match zero or more characters. - Use '?' to match any single character.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "user_email": { - Description: "UserEmail is the email of the user executing the job", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "user_id": { - Description: "UserID is the ID of the user executing the job", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "user_login": { - Description: "UserLogin is the username of the user executing the job", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - }), - Description: "Allow is a list of TokenRules, nodes using this token must match one allow rule to use this token.", - Optional: true, - }, - "domain": { - Description: "Domain is the domain of your GitLab instance. This will default to `gitlab.com` - but can be set to the domain of your self-hosted GitLab e.g `gitlab.example.com`.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - }), - Description: "GitLab allows the configuration of options specific to the \"gitlab\" join method.", + "routing_strategy": { + Description: "RoutingStrategy determines the strategy used to route to nodes. 0 is \"unambiguous_match\"; 1 is \"most_recent\".", Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.Int64Type, }, - "join_method": { - Description: "JoinMethod is the joining method required in order to use this token. Supported joining methods include \"token\", \"ec2\", and \"iam\".", + "session_control_timeout": { + Description: "SessionControlTimeout is the session control lease expiry and defines the upper limit of how long a node may be out of contact with the auth server before it begins terminating controlled sessions.", Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + Type: DurationType{}, }, - "kubernetes": { + "tunnel_strategy": { Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ - "allow": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.ListNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{"service_account": { - Description: "ServiceAccount is the namespaced name of the Kubernetes service account. Its format is \"namespace:service-account\".", + "agent_mesh": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{"active": { + Computed: true, + Description: "Automatically generated field preventing empty message errors", Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + Type: github_com_hashicorp_terraform_plugin_framework_types.BoolType, }}), - Description: "Allow is a list of Rules, nodes using this token must match one allow rule to use this token.", + Description: "", Optional: true, }, - "static_jwks": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{"jwks": { - Description: "JWKS should be the JSON Web Key Set formatted public keys of that the Kubernetes Cluster uses to sign service account tokens. This can be fetched from /openid/v1/jwks on the Kubernetes API Server.", + "proxy_peering": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{"agent_connection_count": { + Description: "", Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + Type: github_com_hashicorp_terraform_plugin_framework_types.Int64Type, }}), - Description: "StaticJWKS is the configuration specific to the `static_jwks` type.", - Optional: true, - }, - "type": { - Description: "Type controls which behavior should be used for validating the Kubernetes Service Account token. Support values: - `in_cluster` - `static_jwks` If unset, this defaults to `in_cluster`.", + Description: "", Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, }, }), - Description: "Kubernetes allows the configuration of options specific to the \"kubernetes\" join method.", + Description: "TunnelStrategyV1 determines the tunnel strategy used in the cluster.", Optional: true, }, - "roles": { - Description: "Roles is a list of roles associated with the token, that will be converted to metadata in the SSH and X509 certificates issued to the user of the token", - Required: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.ListType{ElemType: github_com_hashicorp_terraform_plugin_framework_types.StringType}, - }, - "spacelift": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ - "allow": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.ListNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ - "caller_id": { - Description: "CallerID is the ID of the caller, ie. the stack or module that generated the run.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "caller_type": { - Description: "CallerType is the type of the caller, ie. the entity that owns the run - either `stack` or `module`.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "scope": { - Description: "Scope is the scope of the token - either `read` or `write`. See https://docs.spacelift.io/integrations/cloud-providers/oidc/#about-scopes", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "space_id": { - Description: "SpaceID is the ID of the space in which the run that owns the token was executed.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - }), - Description: "Allow is a list of Rules, nodes using this token must match one allow rule to use this token.", - Optional: true, - }, - "hostname": { - Description: "Hostname is the hostname of the Spacelift tenant that tokens will originate from. E.g `example.app.spacelift.io`", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - }), - Description: "Spacelift allows the configuration of options specific to the \"spacelift\" join method.", + "web_idle_timeout": { + Description: "WebIdleTimeout sets global cluster default setting for the web UI idle timeouts.", Optional: true, + Type: DurationType{}, }, - "suggested_agent_matcher_labels": GenSchemaLabels(ctx), - "suggested_labels": GenSchemaLabels(ctx), }), - Description: "Spec is a provisioning token V2 spec", - Required: true, + Description: "Spec is a ClusterNetworkingConfig specification", + Optional: true, }, "sub_kind": { Description: "SubKind is an optional resource sub kind, used in some resources", @@ -1314,174 +1052,18 @@ func GenSchemaProvisionTokenV2(ctx context.Context) (github_com_hashicorp_terraf Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, }, "version": { - Description: "Version is the resource version. It must be specified. Supported values are:`v2`.", - Required: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - Validators: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributeValidator{UseVersionBetween(2, 2)}, + Computed: true, + Description: "Version is the resource version. It must be specified. Supported values are:`v2`.", + Optional: true, + PlanModifiers: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributePlanModifier{github_com_hashicorp_terraform_plugin_framework_tfsdk.UseStateForUnknown()}, + Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, + Validators: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributeValidator{UseVersionBetween(2, 2)}, }, }}, nil } -// GenSchemaClusterNetworkingConfigV2 returns tfsdk.Schema definition for ClusterNetworkingConfigV2 -func GenSchemaClusterNetworkingConfigV2(ctx context.Context) (github_com_hashicorp_terraform_plugin_framework_tfsdk.Schema, github_com_hashicorp_terraform_plugin_framework_diag.Diagnostics) { - return github_com_hashicorp_terraform_plugin_framework_tfsdk.Schema{Attributes: map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ - "id": { - Computed: true, - Optional: false, - PlanModifiers: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributePlanModifier{github_com_hashicorp_terraform_plugin_framework_tfsdk.UseStateForUnknown()}, - Required: false, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "kind": { - Computed: true, - Description: "Kind is a resource kind", - Optional: true, - PlanModifiers: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributePlanModifier{github_com_hashicorp_terraform_plugin_framework_tfsdk.UseStateForUnknown()}, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "metadata": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ - "description": { - Description: "Description is object description", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "expires": { - Description: "Expires is a global expiry time header can be set on any resource in the system.", - Optional: true, - Type: UseRFC3339Time(), - Validators: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributeValidator{MustTimeBeInFuture()}, - }, - "labels": { - Description: "Labels is a set of labels", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.MapType{ElemType: github_com_hashicorp_terraform_plugin_framework_types.StringType}, - Validators: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributeValidator{UseMapKeysPresentValidator("teleport.dev/origin")}, - }, - "namespace": { - Computed: true, - Description: "Namespace is object namespace. The field should be called \"namespace\" when it returns in Teleport 2.4.", - Optional: true, - PlanModifiers: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributePlanModifier{github_com_hashicorp_terraform_plugin_framework_tfsdk.UseStateForUnknown()}, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "revision": { - Description: "Revision is an opaque identifier which tracks the versions of a resource over time. Clients should ignore and not alter its value but must return the revision in any updates of a resource.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - }), - Description: "Metadata is resource metadata", - Optional: true, - }, - "spec": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ - "assist_command_execution_workers": { - Description: "AssistCommandExecutionWorkers determines the number of workers that will execute arbitrary Assist commands on servers in parallel", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.Int64Type, - }, - "case_insensitive_routing": { - Description: "CaseInsensitiveRouting causes proxies to use case-insensitive hostname matching.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.BoolType, - }, - "client_idle_timeout": { - Description: "ClientIdleTimeout sets global cluster default setting for client idle timeouts.", - Optional: true, - Type: DurationType{}, - }, - "idle_timeout_message": { - Description: "ClientIdleTimeoutMessage is the message sent to the user when a connection times out.", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "keep_alive_count_max": { - Computed: true, - Description: "KeepAliveCountMax is the number of keep-alive messages that can be missed before the server disconnects the connection to the client.", - Optional: true, - PlanModifiers: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributePlanModifier{github_com_hashicorp_terraform_plugin_framework_tfsdk.UseStateForUnknown()}, - Type: github_com_hashicorp_terraform_plugin_framework_types.Int64Type, - }, - "keep_alive_interval": { - Computed: true, - Description: "KeepAliveInterval is the interval at which the server sends keep-alive messages to the client.", - Optional: true, - PlanModifiers: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributePlanModifier{github_com_hashicorp_terraform_plugin_framework_tfsdk.UseStateForUnknown()}, - Type: DurationType{}, - }, - "proxy_listener_mode": { - Description: "ProxyListenerMode is proxy listener mode used by Teleport Proxies. 0 is \"separate\"; 1 is \"multiplex\".", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.Int64Type, - }, - "proxy_ping_interval": { - Description: "ProxyPingInterval defines in which interval the TLS routing ping message should be sent. This is applicable only when using ping-wrapped connections, regular TLS routing connections are not affected.", - Optional: true, - Type: DurationType{}, - }, - "routing_strategy": { - Description: "RoutingStrategy determines the strategy used to route to nodes. 0 is \"unambiguous_match\"; 1 is \"most_recent\".", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.Int64Type, - }, - "session_control_timeout": { - Description: "SessionControlTimeout is the session control lease expiry and defines the upper limit of how long a node may be out of contact with the auth server before it begins terminating controlled sessions.", - Optional: true, - Type: DurationType{}, - }, - "tunnel_strategy": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ - "agent_mesh": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{"active": { - Computed: true, - Description: "Automatically generated field preventing empty message errors", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.BoolType, - }}), - Description: "", - Optional: true, - }, - "proxy_peering": { - Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{"agent_connection_count": { - Description: "", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.Int64Type, - }}), - Description: "", - Optional: true, - }, - }), - Description: "TunnelStrategyV1 determines the tunnel strategy used in the cluster.", - Optional: true, - }, - "web_idle_timeout": { - Description: "WebIdleTimeout sets global cluster default setting for the web UI idle timeouts.", - Optional: true, - Type: DurationType{}, - }, - }), - Description: "Spec is a ClusterNetworkingConfig specification", - Optional: true, - }, - "sub_kind": { - Description: "SubKind is an optional resource sub kind, used in some resources", - Optional: true, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - }, - "version": { - Computed: true, - Description: "Version is the resource version. It must be specified. Supported values are:`v2`.", - Optional: true, - PlanModifiers: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributePlanModifier{github_com_hashicorp_terraform_plugin_framework_tfsdk.UseStateForUnknown()}, - Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, - Validators: []github_com_hashicorp_terraform_plugin_framework_tfsdk.AttributeValidator{UseVersionBetween(2, 2)}, - }, - }}, nil -} - -// GenSchemaSessionRecordingConfigV2 returns tfsdk.Schema definition for SessionRecordingConfigV2 -func GenSchemaSessionRecordingConfigV2(ctx context.Context) (github_com_hashicorp_terraform_plugin_framework_tfsdk.Schema, github_com_hashicorp_terraform_plugin_framework_diag.Diagnostics) { +// GenSchemaSessionRecordingConfigV2 returns tfsdk.Schema definition for SessionRecordingConfigV2 +func GenSchemaSessionRecordingConfigV2(ctx context.Context) (github_com_hashicorp_terraform_plugin_framework_tfsdk.Schema, github_com_hashicorp_terraform_plugin_framework_diag.Diagnostics) { return github_com_hashicorp_terraform_plugin_framework_tfsdk.Schema{Attributes: map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{ "id": { Computed: true, @@ -2962,6 +2544,15 @@ func GenSchemaUserV2(ctx context.Context) (github_com_hashicorp_terraform_plugin Description: "Spec is a user specification", Optional: true, }, + "status": { + Attributes: github_com_hashicorp_terraform_plugin_framework_tfsdk.SingleNestedAttributes(map[string]github_com_hashicorp_terraform_plugin_framework_tfsdk.Attribute{"password_state": { + Description: "password_state reflects what the system knows about the user's password. Note that this is a \"best effort\" property, in that it can be UNSPECIFIED for users who were created before this property was introduced and didn't perform any password-related activity since then. See RFD 0159 for details. Do NOT use this value for authentication purposes!", + Optional: true, + Type: github_com_hashicorp_terraform_plugin_framework_types.Int64Type, + }}), + Description: "", + Optional: true, + }, "sub_kind": { Description: "SubKind is an optional resource sub kind, used in some resources", Optional: true, @@ -10560,4081 +10151,258 @@ func CopyAppV3ToTerraform(ctx context.Context, obj *github_com_gravitational_tel if len(obj.Headers) != len(c.Elems) { c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Headers)) } - for k, a := range obj.Headers { - v, ok := tf.Attrs["headers"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - if a == nil { - v.Null = true - } else { - obj := a - tf := &v - { - t, ok := tf.AttrTypes["name"] - if !ok { - diags.Append(attrWriteMissingDiag{"AppV3.Spec.Rewrite.Headers.Name"}) - } else { - v, ok := tf.Attrs["name"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"AppV3.Spec.Rewrite.Headers.Name", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"AppV3.Spec.Rewrite.Headers.Name", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Name) == "" - } - v.Value = string(obj.Name) - v.Unknown = false - tf.Attrs["name"] = v - } - } - { - t, ok := tf.AttrTypes["value"] - if !ok { - diags.Append(attrWriteMissingDiag{"AppV3.Spec.Rewrite.Headers.Value"}) - } else { - v, ok := tf.Attrs["value"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"AppV3.Spec.Rewrite.Headers.Value", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"AppV3.Spec.Rewrite.Headers.Value", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Value) == "" - } - v.Value = string(obj.Value) - v.Unknown = false - tf.Attrs["value"] = v - } - } - } - v.Unknown = false - c.Elems[k] = v - } - if len(obj.Headers) > 0 { - c.Null = false - } - } - c.Unknown = false - tf.Attrs["headers"] = c - } - } - } - { - t, ok := tf.AttrTypes["jwt_claims"] - if !ok { - diags.Append(attrWriteMissingDiag{"AppV3.Spec.Rewrite.JWTClaims"}) - } else { - v, ok := tf.Attrs["jwt_claims"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"AppV3.Spec.Rewrite.JWTClaims", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"AppV3.Spec.Rewrite.JWTClaims", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.JWTClaims) == "" - } - v.Value = string(obj.JWTClaims) - v.Unknown = false - tf.Attrs["jwt_claims"] = v - } - } - } - v.Unknown = false - tf.Attrs["rewrite"] = v - } - } - } - { - a, ok := tf.AttrTypes["aws"] - if !ok { - diags.Append(attrWriteMissingDiag{"AppV3.Spec.AWS"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"AppV3.Spec.AWS", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) - } else { - v, ok := tf.Attrs["aws"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - if obj.AWS == nil { - v.Null = true - } else { - obj := obj.AWS - tf := &v - { - t, ok := tf.AttrTypes["external_id"] - if !ok { - diags.Append(attrWriteMissingDiag{"AppV3.Spec.AWS.ExternalID"}) - } else { - v, ok := tf.Attrs["external_id"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"AppV3.Spec.AWS.ExternalID", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"AppV3.Spec.AWS.ExternalID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.ExternalID) == "" - } - v.Value = string(obj.ExternalID) - v.Unknown = false - tf.Attrs["external_id"] = v - } - } - } - v.Unknown = false - tf.Attrs["aws"] = v - } - } - } - { - t, ok := tf.AttrTypes["cloud"] - if !ok { - diags.Append(attrWriteMissingDiag{"AppV3.Spec.Cloud"}) - } else { - v, ok := tf.Attrs["cloud"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"AppV3.Spec.Cloud", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"AppV3.Spec.Cloud", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Cloud) == "" - } - v.Value = string(obj.Cloud) - v.Unknown = false - tf.Attrs["cloud"] = v - } - } - { - a, ok := tf.AttrTypes["user_groups"] - if !ok { - diags.Append(attrWriteMissingDiag{"AppV3.Spec.UserGroups"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"AppV3.Spec.UserGroups", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) - } else { - c, ok := tf.Attrs["user_groups"].(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - c = github_com_hashicorp_terraform_plugin_framework_types.List{ - - ElemType: o.ElemType, - Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.UserGroups)), - Null: true, - } - } else { - if c.Elems == nil { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.UserGroups)) - } - } - if obj.UserGroups != nil { - t := o.ElemType - if len(obj.UserGroups) != len(c.Elems) { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.UserGroups)) - } - for k, a := range obj.UserGroups { - v, ok := tf.Attrs["user_groups"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"AppV3.Spec.UserGroups", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"AppV3.Spec.UserGroups", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(a) == "" - } - v.Value = string(a) - v.Unknown = false - c.Elems[k] = v - } - if len(obj.UserGroups) > 0 { - c.Null = false - } - } - c.Unknown = false - tf.Attrs["user_groups"] = c - } - } - } - { - t, ok := tf.AttrTypes["integration"] - if !ok { - diags.Append(attrWriteMissingDiag{"AppV3.Spec.Integration"}) - } else { - v, ok := tf.Attrs["integration"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"AppV3.Spec.Integration", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"AppV3.Spec.Integration", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Integration) == "" - } - v.Value = string(obj.Integration) - v.Unknown = false - tf.Attrs["integration"] = v - } - } - } - v.Unknown = false - tf.Attrs["spec"] = v - } - } - } - return diags -} - -// CopyProvisionTokenV2FromTerraform copies contents of the source Terraform object into a target struct -func CopyProvisionTokenV2FromTerraform(_ context.Context, tf github_com_hashicorp_terraform_plugin_framework_types.Object, obj *github_com_gravitational_teleport_api_types.ProvisionTokenV2) github_com_hashicorp_terraform_plugin_framework_diag.Diagnostics { - var diags github_com_hashicorp_terraform_plugin_framework_diag.Diagnostics - { - a, ok := tf.Attrs["kind"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Kind"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Kind", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Kind = t - } - } - } - { - a, ok := tf.Attrs["sub_kind"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.SubKind"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.SubKind", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.SubKind = t - } - } - } - { - a, ok := tf.Attrs["version"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Version"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Version", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Version = t - } - } - } - { - a, ok := tf.Attrs["metadata"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Metadata"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Metadata", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) - } else { - obj.Metadata = github_com_gravitational_teleport_api_types.Metadata{} - if !v.Null && !v.Unknown { - tf := v - obj := &obj.Metadata - { - a, ok := tf.Attrs["name"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Metadata.Name"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Metadata.Name", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Name = t - } - } - } - { - a, ok := tf.Attrs["namespace"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Metadata.Namespace"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Metadata.Namespace", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Namespace = t - } - } - } - { - a, ok := tf.Attrs["description"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Metadata.Description"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Metadata.Description", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Description = t - } - } - } - { - a, ok := tf.Attrs["labels"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Metadata.Labels"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Map) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Metadata.Labels", "github.com/hashicorp/terraform-plugin-framework/types.Map"}) - } else { - obj.Labels = make(map[string]string, len(v.Elems)) - if !v.Null && !v.Unknown { - for k, a := range v.Elems { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Metadata.Labels", "github_com_hashicorp_terraform_plugin_framework_types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Labels[k] = t - } - } - } - } - } - } - { - a, ok := tf.Attrs["expires"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Metadata.Expires"}) - } else { - v, ok := a.(TimeValue) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Metadata.Expires", "TimeValue"}) - } else { - var t *time.Time - if !v.Null && !v.Unknown { - c := time.Time(v.Value) - t = &c - } - obj.Expires = t - } - } - } - { - a, ok := tf.Attrs["revision"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Metadata.Revision"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Metadata.Revision", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Revision = t - } - } - } - } - } - } - } - { - a, ok := tf.Attrs["spec"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) - } else { - obj.Spec = github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2{} - if !v.Null && !v.Unknown { - tf := v - obj := &obj.Spec - { - a, ok := tf.Attrs["roles"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Roles"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Roles", "github.com/hashicorp/terraform-plugin-framework/types.List"}) - } else { - obj.Roles = make([]github_com_gravitational_teleport_api_types.SystemRole, len(v.Elems)) - if !v.Null && !v.Unknown { - for k, a := range v.Elems { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Roles", "github_com_hashicorp_terraform_plugin_framework_types.String"}) - } else { - var t github_com_gravitational_teleport_api_types.SystemRole - if !v.Null && !v.Unknown { - t = github_com_gravitational_teleport_api_types.SystemRole(v.Value) - } - obj.Roles[k] = t - } - } - } - } - } - } - { - a, ok := tf.Attrs["allow"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Allow"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Allow", "github.com/hashicorp/terraform-plugin-framework/types.List"}) - } else { - obj.Allow = make([]*github_com_gravitational_teleport_api_types.TokenRule, len(v.Elems)) - if !v.Null && !v.Unknown { - for k, a := range v.Elems { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Allow", "github_com_hashicorp_terraform_plugin_framework_types.Object"}) - } else { - var t *github_com_gravitational_teleport_api_types.TokenRule - if !v.Null && !v.Unknown { - tf := v - t = &github_com_gravitational_teleport_api_types.TokenRule{} - obj := t - { - a, ok := tf.Attrs["aws_account"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Allow.AWSAccount"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSAccount", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.AWSAccount = t - } - } - } - { - a, ok := tf.Attrs["aws_regions"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Allow.AWSRegions"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSRegions", "github.com/hashicorp/terraform-plugin-framework/types.List"}) - } else { - obj.AWSRegions = make([]string, len(v.Elems)) - if !v.Null && !v.Unknown { - for k, a := range v.Elems { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSRegions", "github_com_hashicorp_terraform_plugin_framework_types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.AWSRegions[k] = t - } - } - } - } - } - } - { - a, ok := tf.Attrs["aws_role"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Allow.AWSRole"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSRole", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.AWSRole = t - } - } - } - { - a, ok := tf.Attrs["aws_arn"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Allow.AWSARN"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSARN", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.AWSARN = t - } - } - } - } - obj.Allow[k] = t - } - } - } - } - } - } - { - a, ok := tf.Attrs["aws_iid_ttl"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.AWSIIDTTL"}) - } else { - v, ok := a.(DurationValue) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.AWSIIDTTL", "DurationValue"}) - } else { - var t github_com_gravitational_teleport_api_types.Duration - if !v.Null && !v.Unknown { - t = github_com_gravitational_teleport_api_types.Duration(v.Value) - } - obj.AWSIIDTTL = t - } - } - } - { - a, ok := tf.Attrs["join_method"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.JoinMethod"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.JoinMethod", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t github_com_gravitational_teleport_api_types.JoinMethod - if !v.Null && !v.Unknown { - t = github_com_gravitational_teleport_api_types.JoinMethod(v.Value) - } - obj.JoinMethod = t - } - } - } - { - a, ok := tf.Attrs["bot_name"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.BotName"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.BotName", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.BotName = t - } - } - } - { - a, ok := tf.Attrs["suggested_labels"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.SuggestedLabels"}) - } - CopyFromLabels(diags, a, &obj.SuggestedLabels) - } - { - a, ok := tf.Attrs["github"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) - } else { - obj.GitHub = nil - if !v.Null && !v.Unknown { - tf := v - obj.GitHub = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GitHub{} - obj := obj.GitHub - { - a, ok := tf.Attrs["allow"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow", "github.com/hashicorp/terraform-plugin-framework/types.List"}) - } else { - obj.Allow = make([]*github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GitHub_Rule, len(v.Elems)) - if !v.Null && !v.Unknown { - for k, a := range v.Elems { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow", "github_com_hashicorp_terraform_plugin_framework_types.Object"}) - } else { - var t *github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GitHub_Rule - if !v.Null && !v.Unknown { - tf := v - t = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GitHub_Rule{} - obj := t - { - a, ok := tf.Attrs["sub"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Sub"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Sub", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Sub = t - } - } - } - { - a, ok := tf.Attrs["repository"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Repository"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Repository", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Repository = t - } - } - } - { - a, ok := tf.Attrs["repository_owner"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.RepositoryOwner"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.RepositoryOwner", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.RepositoryOwner = t - } - } - } - { - a, ok := tf.Attrs["workflow"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Workflow"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Workflow", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Workflow = t - } - } - } - { - a, ok := tf.Attrs["environment"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Environment"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Environment", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Environment = t - } - } - } - { - a, ok := tf.Attrs["actor"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Actor"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Actor", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Actor = t - } - } - } - { - a, ok := tf.Attrs["ref"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Ref"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Ref", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Ref = t - } - } - } - { - a, ok := tf.Attrs["ref_type"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.RefType"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.RefType", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.RefType = t - } - } - } - } - obj.Allow[k] = t - } - } - } - } - } - } - { - a, ok := tf.Attrs["enterprise_server_host"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.EnterpriseServerHost"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.EnterpriseServerHost", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.EnterpriseServerHost = t - } - } - } - { - a, ok := tf.Attrs["enterprise_slug"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitHub.EnterpriseSlug"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.EnterpriseSlug", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.EnterpriseSlug = t - } - } - } - } - } - } - } - { - a, ok := tf.Attrs["circleci"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.CircleCI"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) - } else { - obj.CircleCI = nil - if !v.Null && !v.Unknown { - tf := v - obj.CircleCI = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2CircleCI{} - obj := obj.CircleCI - { - a, ok := tf.Attrs["allow"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.CircleCI.Allow"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI.Allow", "github.com/hashicorp/terraform-plugin-framework/types.List"}) - } else { - obj.Allow = make([]*github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2CircleCI_Rule, len(v.Elems)) - if !v.Null && !v.Unknown { - for k, a := range v.Elems { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI.Allow", "github_com_hashicorp_terraform_plugin_framework_types.Object"}) - } else { - var t *github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2CircleCI_Rule - if !v.Null && !v.Unknown { - tf := v - t = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2CircleCI_Rule{} - obj := t - { - a, ok := tf.Attrs["project_id"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.CircleCI.Allow.ProjectID"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI.Allow.ProjectID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.ProjectID = t - } - } - } - { - a, ok := tf.Attrs["context_id"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.CircleCI.Allow.ContextID"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI.Allow.ContextID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.ContextID = t - } - } - } - } - obj.Allow[k] = t - } - } - } - } - } - } - { - a, ok := tf.Attrs["organization_id"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.CircleCI.OrganizationID"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI.OrganizationID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.OrganizationID = t - } - } - } - } - } - } - } - { - a, ok := tf.Attrs["suggested_agent_matcher_labels"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.SuggestedAgentMatcherLabels"}) - } - CopyFromLabels(diags, a, &obj.SuggestedAgentMatcherLabels) - } - { - a, ok := tf.Attrs["kubernetes"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Kubernetes"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) - } else { - obj.Kubernetes = nil - if !v.Null && !v.Unknown { - tf := v - obj.Kubernetes = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Kubernetes{} - obj := obj.Kubernetes - { - a, ok := tf.Attrs["allow"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.Allow"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.Allow", "github.com/hashicorp/terraform-plugin-framework/types.List"}) - } else { - obj.Allow = make([]*github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Kubernetes_Rule, len(v.Elems)) - if !v.Null && !v.Unknown { - for k, a := range v.Elems { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.Allow", "github_com_hashicorp_terraform_plugin_framework_types.Object"}) - } else { - var t *github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Kubernetes_Rule - if !v.Null && !v.Unknown { - tf := v - t = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Kubernetes_Rule{} - obj := t - { - a, ok := tf.Attrs["service_account"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.Allow.ServiceAccount"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.Allow.ServiceAccount", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.ServiceAccount = t - } - } - } - } - obj.Allow[k] = t - } - } - } - } - } - } - { - a, ok := tf.Attrs["type"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.Type"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.Type", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t github_com_gravitational_teleport_api_types.KubernetesJoinType - if !v.Null && !v.Unknown { - t = github_com_gravitational_teleport_api_types.KubernetesJoinType(v.Value) - } - obj.Type = t - } - } - } - { - a, ok := tf.Attrs["static_jwks"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.StaticJWKS"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.StaticJWKS", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) - } else { - obj.StaticJWKS = nil - if !v.Null && !v.Unknown { - tf := v - obj.StaticJWKS = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Kubernetes_StaticJWKSConfig{} - obj := obj.StaticJWKS - { - a, ok := tf.Attrs["jwks"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.StaticJWKS.JWKS"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.StaticJWKS.JWKS", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.JWKS = t - } - } - } - } - } - } - } - } - } - } - } - { - a, ok := tf.Attrs["azure"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Azure"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Azure", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) - } else { - obj.Azure = nil - if !v.Null && !v.Unknown { - tf := v - obj.Azure = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Azure{} - obj := obj.Azure - { - a, ok := tf.Attrs["allow"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Azure.Allow"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Azure.Allow", "github.com/hashicorp/terraform-plugin-framework/types.List"}) - } else { - obj.Allow = make([]*github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Azure_Rule, len(v.Elems)) - if !v.Null && !v.Unknown { - for k, a := range v.Elems { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Azure.Allow", "github_com_hashicorp_terraform_plugin_framework_types.Object"}) - } else { - var t *github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Azure_Rule - if !v.Null && !v.Unknown { - tf := v - t = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Azure_Rule{} - obj := t - { - a, ok := tf.Attrs["subscription"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Azure.Allow.Subscription"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Azure.Allow.Subscription", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Subscription = t - } - } - } - { - a, ok := tf.Attrs["resource_groups"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Azure.Allow.ResourceGroups"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Azure.Allow.ResourceGroups", "github.com/hashicorp/terraform-plugin-framework/types.List"}) - } else { - obj.ResourceGroups = make([]string, len(v.Elems)) - if !v.Null && !v.Unknown { - for k, a := range v.Elems { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Azure.Allow.ResourceGroups", "github_com_hashicorp_terraform_plugin_framework_types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.ResourceGroups[k] = t - } - } - } - } - } - } - } - obj.Allow[k] = t - } - } - } - } - } - } - } - } - } - } - { - a, ok := tf.Attrs["gitlab"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) - } else { - obj.GitLab = nil - if !v.Null && !v.Unknown { - tf := v - obj.GitLab = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GitLab{} - obj := obj.GitLab - { - a, ok := tf.Attrs["allow"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow", "github.com/hashicorp/terraform-plugin-framework/types.List"}) - } else { - obj.Allow = make([]*github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GitLab_Rule, len(v.Elems)) - if !v.Null && !v.Unknown { - for k, a := range v.Elems { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow", "github_com_hashicorp_terraform_plugin_framework_types.Object"}) - } else { - var t *github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GitLab_Rule - if !v.Null && !v.Unknown { - tf := v - t = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GitLab_Rule{} - obj := t - { - a, ok := tf.Attrs["sub"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Sub"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Sub", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Sub = t - } - } - } - { - a, ok := tf.Attrs["ref"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Ref"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Ref", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Ref = t - } - } - } - { - a, ok := tf.Attrs["ref_type"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.RefType"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.RefType", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.RefType = t - } - } - } - { - a, ok := tf.Attrs["namespace_path"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.NamespacePath"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.NamespacePath", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.NamespacePath = t - } - } - } - { - a, ok := tf.Attrs["project_path"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectPath"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectPath", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.ProjectPath = t - } - } - } - { - a, ok := tf.Attrs["pipeline_source"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.PipelineSource"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.PipelineSource", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.PipelineSource = t - } - } - } - { - a, ok := tf.Attrs["environment"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Environment"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Environment", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Environment = t - } - } - } - { - a, ok := tf.Attrs["user_login"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserLogin"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserLogin", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.UserLogin = t - } - } - } - { - a, ok := tf.Attrs["user_id"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserID"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.UserID = t - } - } - } - { - a, ok := tf.Attrs["user_email"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserEmail"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserEmail", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.UserEmail = t - } - } - } - { - a, ok := tf.Attrs["ref_protected"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.RefProtected"}) - } - CopyFromBoolOption(diags, a, &obj.RefProtected) - } - { - a, ok := tf.Attrs["environment_protected"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.EnvironmentProtected"}) - } - CopyFromBoolOption(diags, a, &obj.EnvironmentProtected) - } - { - a, ok := tf.Attrs["ci_config_sha"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigSHA"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigSHA", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.CIConfigSHA = t - } - } - } - { - a, ok := tf.Attrs["ci_config_ref_uri"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigRefURI"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigRefURI", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.CIConfigRefURI = t - } - } - } - { - a, ok := tf.Attrs["deployment_tier"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.DeploymentTier"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.DeploymentTier", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.DeploymentTier = t - } - } - } - { - a, ok := tf.Attrs["project_visibility"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectVisibility"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectVisibility", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.ProjectVisibility = t - } - } - } - } - obj.Allow[k] = t - } - } - } - } - } - } - { - a, ok := tf.Attrs["domain"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GitLab.Domain"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Domain", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Domain = t - } - } - } - } - } - } - } - { - a, ok := tf.Attrs["gcp"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GCP"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GCP", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) - } else { - obj.GCP = nil - if !v.Null && !v.Unknown { - tf := v - obj.GCP = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GCP{} - obj := obj.GCP - { - a, ok := tf.Attrs["allow"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GCP.Allow"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow", "github.com/hashicorp/terraform-plugin-framework/types.List"}) - } else { - obj.Allow = make([]*github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GCP_Rule, len(v.Elems)) - if !v.Null && !v.Unknown { - for k, a := range v.Elems { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow", "github_com_hashicorp_terraform_plugin_framework_types.Object"}) - } else { - var t *github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GCP_Rule - if !v.Null && !v.Unknown { - tf := v - t = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2GCP_Rule{} - obj := t - { - a, ok := tf.Attrs["project_ids"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GCP.Allow.ProjectIDs"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.ProjectIDs", "github.com/hashicorp/terraform-plugin-framework/types.List"}) - } else { - obj.ProjectIDs = make([]string, len(v.Elems)) - if !v.Null && !v.Unknown { - for k, a := range v.Elems { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.ProjectIDs", "github_com_hashicorp_terraform_plugin_framework_types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.ProjectIDs[k] = t - } - } - } - } - } - } - { - a, ok := tf.Attrs["locations"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GCP.Allow.Locations"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.Locations", "github.com/hashicorp/terraform-plugin-framework/types.List"}) - } else { - obj.Locations = make([]string, len(v.Elems)) - if !v.Null && !v.Unknown { - for k, a := range v.Elems { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.Locations", "github_com_hashicorp_terraform_plugin_framework_types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Locations[k] = t - } - } - } - } - } - } - { - a, ok := tf.Attrs["service_accounts"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.GCP.Allow.ServiceAccounts"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.ServiceAccounts", "github.com/hashicorp/terraform-plugin-framework/types.List"}) - } else { - obj.ServiceAccounts = make([]string, len(v.Elems)) - if !v.Null && !v.Unknown { - for k, a := range v.Elems { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.ServiceAccounts", "github_com_hashicorp_terraform_plugin_framework_types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.ServiceAccounts[k] = t - } - } - } - } - } - } - } - obj.Allow[k] = t - } - } - } - } - } - } - } - } - } - } - { - a, ok := tf.Attrs["spacelift"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Spacelift"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) - } else { - obj.Spacelift = nil - if !v.Null && !v.Unknown { - tf := v - obj.Spacelift = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Spacelift{} - obj := obj.Spacelift - { - a, ok := tf.Attrs["allow"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow", "github.com/hashicorp/terraform-plugin-framework/types.List"}) - } else { - obj.Allow = make([]*github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Spacelift_Rule, len(v.Elems)) - if !v.Null && !v.Unknown { - for k, a := range v.Elems { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow", "github_com_hashicorp_terraform_plugin_framework_types.Object"}) - } else { - var t *github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Spacelift_Rule - if !v.Null && !v.Unknown { - tf := v - t = &github_com_gravitational_teleport_api_types.ProvisionTokenSpecV2Spacelift_Rule{} - obj := t - { - a, ok := tf.Attrs["space_id"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.SpaceID"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.SpaceID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.SpaceID = t - } - } - } - { - a, ok := tf.Attrs["caller_id"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerID"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.CallerID = t - } - } - } - { - a, ok := tf.Attrs["caller_type"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerType"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerType", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.CallerType = t - } - } - } - { - a, ok := tf.Attrs["scope"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.Scope"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.Scope", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Scope = t - } - } - } - } - obj.Allow[k] = t - } - } - } - } - } - } - { - a, ok := tf.Attrs["hostname"] - if !ok { - diags.Append(attrReadMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Hostname"}) - } else { - v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrReadConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Hostname", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } else { - var t string - if !v.Null && !v.Unknown { - t = string(v.Value) - } - obj.Hostname = t - } - } - } - } - } - } - } - } - } - } - } - return diags -} - -// CopyProvisionTokenV2ToTerraform copies contents of the source Terraform object into a target struct -func CopyProvisionTokenV2ToTerraform(ctx context.Context, obj *github_com_gravitational_teleport_api_types.ProvisionTokenV2, tf *github_com_hashicorp_terraform_plugin_framework_types.Object) github_com_hashicorp_terraform_plugin_framework_diag.Diagnostics { - var diags github_com_hashicorp_terraform_plugin_framework_diag.Diagnostics - tf.Null = false - tf.Unknown = false - if tf.Attrs == nil { - tf.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value) - } - { - t, ok := tf.AttrTypes["kind"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Kind"}) - } else { - v, ok := tf.Attrs["kind"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Kind", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Kind", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Kind) == "" - } - v.Value = string(obj.Kind) - v.Unknown = false - tf.Attrs["kind"] = v - } - } - { - t, ok := tf.AttrTypes["sub_kind"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.SubKind"}) - } else { - v, ok := tf.Attrs["sub_kind"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.SubKind", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.SubKind", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.SubKind) == "" - } - v.Value = string(obj.SubKind) - v.Unknown = false - tf.Attrs["sub_kind"] = v - } - } - { - t, ok := tf.AttrTypes["version"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Version"}) - } else { - v, ok := tf.Attrs["version"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Version", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Version", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Version) == "" - } - v.Value = string(obj.Version) - v.Unknown = false - tf.Attrs["version"] = v - } - } - { - a, ok := tf.AttrTypes["metadata"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Metadata"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Metadata", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) - } else { - v, ok := tf.Attrs["metadata"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - { - obj := obj.Metadata - tf := &v - { - t, ok := tf.AttrTypes["name"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Metadata.Name"}) - } else { - v, ok := tf.Attrs["name"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Metadata.Name", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Metadata.Name", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Name) == "" - } - v.Value = string(obj.Name) - v.Unknown = false - tf.Attrs["name"] = v - } - } - { - t, ok := tf.AttrTypes["namespace"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Metadata.Namespace"}) - } else { - v, ok := tf.Attrs["namespace"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Metadata.Namespace", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Metadata.Namespace", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Namespace) == "" - } - v.Value = string(obj.Namespace) - v.Unknown = false - tf.Attrs["namespace"] = v - } - } - { - t, ok := tf.AttrTypes["description"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Metadata.Description"}) - } else { - v, ok := tf.Attrs["description"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Metadata.Description", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Metadata.Description", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Description) == "" - } - v.Value = string(obj.Description) - v.Unknown = false - tf.Attrs["description"] = v - } - } - { - a, ok := tf.AttrTypes["labels"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Metadata.Labels"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.MapType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Metadata.Labels", "github.com/hashicorp/terraform-plugin-framework/types.MapType"}) - } else { - c, ok := tf.Attrs["labels"].(github_com_hashicorp_terraform_plugin_framework_types.Map) - if !ok { - c = github_com_hashicorp_terraform_plugin_framework_types.Map{ - - ElemType: o.ElemType, - Elems: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Labels)), - Null: true, - } - } else { - if c.Elems == nil { - c.Elems = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Labels)) - } - } - if obj.Labels != nil { - t := o.ElemType - for k, a := range obj.Labels { - v, ok := tf.Attrs["labels"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Metadata.Labels", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Metadata.Labels", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = false - } - v.Value = string(a) - v.Unknown = false - c.Elems[k] = v - } - if len(obj.Labels) > 0 { - c.Null = false - } - } - c.Unknown = false - tf.Attrs["labels"] = c - } - } - } - { - t, ok := tf.AttrTypes["expires"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Metadata.Expires"}) - } else { - v, ok := tf.Attrs["expires"].(TimeValue) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Metadata.Expires", err}) - } - v, ok = i.(TimeValue) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Metadata.Expires", "TimeValue"}) - } - v.Null = false - } - if obj.Expires == nil { - v.Null = true - } else { - v.Null = false - v.Value = time.Time(*obj.Expires) - } - v.Unknown = false - tf.Attrs["expires"] = v - } - } - { - t, ok := tf.AttrTypes["revision"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Metadata.Revision"}) - } else { - v, ok := tf.Attrs["revision"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Metadata.Revision", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Metadata.Revision", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Revision) == "" - } - v.Value = string(obj.Revision) - v.Unknown = false - tf.Attrs["revision"] = v - } - } - } - v.Unknown = false - tf.Attrs["metadata"] = v - } - } - } - { - a, ok := tf.AttrTypes["spec"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) - } else { - v, ok := tf.Attrs["spec"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - { - obj := obj.Spec - tf := &v - { - a, ok := tf.AttrTypes["roles"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Roles"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Roles", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) - } else { - c, ok := tf.Attrs["roles"].(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - c = github_com_hashicorp_terraform_plugin_framework_types.List{ - - ElemType: o.ElemType, - Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Roles)), - Null: true, - } - } else { - if c.Elems == nil { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Roles)) - } - } - if obj.Roles != nil { - t := o.ElemType - if len(obj.Roles) != len(c.Elems) { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Roles)) - } - for k, a := range obj.Roles { - v, ok := tf.Attrs["roles"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Roles", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Roles", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(a) == "" - } - v.Value = string(a) - v.Unknown = false - c.Elems[k] = v - } - if len(obj.Roles) > 0 { - c.Null = false - } - } - c.Unknown = false - tf.Attrs["roles"] = c - } - } - } - { - a, ok := tf.AttrTypes["allow"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Allow"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Allow", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) - } else { - c, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - c = github_com_hashicorp_terraform_plugin_framework_types.List{ - - ElemType: o.ElemType, - Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)), - Null: true, - } - } else { - if c.Elems == nil { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) - } - } - if obj.Allow != nil { - o := o.ElemType.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) - if len(obj.Allow) != len(c.Elems) { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) - } - for k, a := range obj.Allow { - v, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - if a == nil { - v.Null = true - } else { - obj := a - tf := &v - { - t, ok := tf.AttrTypes["aws_account"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Allow.AWSAccount"}) - } else { - v, ok := tf.Attrs["aws_account"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Allow.AWSAccount", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSAccount", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.AWSAccount) == "" - } - v.Value = string(obj.AWSAccount) - v.Unknown = false - tf.Attrs["aws_account"] = v - } - } - { - a, ok := tf.AttrTypes["aws_regions"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Allow.AWSRegions"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSRegions", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) - } else { - c, ok := tf.Attrs["aws_regions"].(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - c = github_com_hashicorp_terraform_plugin_framework_types.List{ - - ElemType: o.ElemType, - Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.AWSRegions)), - Null: true, - } - } else { - if c.Elems == nil { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.AWSRegions)) - } - } - if obj.AWSRegions != nil { - t := o.ElemType - if len(obj.AWSRegions) != len(c.Elems) { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.AWSRegions)) - } - for k, a := range obj.AWSRegions { - v, ok := tf.Attrs["aws_regions"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Allow.AWSRegions", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSRegions", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(a) == "" - } - v.Value = string(a) - v.Unknown = false - c.Elems[k] = v - } - if len(obj.AWSRegions) > 0 { - c.Null = false - } - } - c.Unknown = false - tf.Attrs["aws_regions"] = c - } - } - } - { - t, ok := tf.AttrTypes["aws_role"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Allow.AWSRole"}) - } else { - v, ok := tf.Attrs["aws_role"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Allow.AWSRole", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSRole", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.AWSRole) == "" - } - v.Value = string(obj.AWSRole) - v.Unknown = false - tf.Attrs["aws_role"] = v - } - } - { - t, ok := tf.AttrTypes["aws_arn"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Allow.AWSARN"}) - } else { - v, ok := tf.Attrs["aws_arn"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Allow.AWSARN", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Allow.AWSARN", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.AWSARN) == "" - } - v.Value = string(obj.AWSARN) - v.Unknown = false - tf.Attrs["aws_arn"] = v - } - } - } - v.Unknown = false - c.Elems[k] = v - } - if len(obj.Allow) > 0 { - c.Null = false - } - } - c.Unknown = false - tf.Attrs["allow"] = c - } - } - } - { - t, ok := tf.AttrTypes["aws_iid_ttl"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.AWSIIDTTL"}) - } else { - v, ok := tf.Attrs["aws_iid_ttl"].(DurationValue) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.AWSIIDTTL", err}) - } - v, ok = i.(DurationValue) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.AWSIIDTTL", "DurationValue"}) - } - v.Null = false - } - v.Value = time.Duration(obj.AWSIIDTTL) - v.Unknown = false - tf.Attrs["aws_iid_ttl"] = v - } - } - { - t, ok := tf.AttrTypes["join_method"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.JoinMethod"}) - } else { - v, ok := tf.Attrs["join_method"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.JoinMethod", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.JoinMethod", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.JoinMethod) == "" - } - v.Value = string(obj.JoinMethod) - v.Unknown = false - tf.Attrs["join_method"] = v - } - } - { - t, ok := tf.AttrTypes["bot_name"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.BotName"}) - } else { - v, ok := tf.Attrs["bot_name"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.BotName", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.BotName", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.BotName) == "" - } - v.Value = string(obj.BotName) - v.Unknown = false - tf.Attrs["bot_name"] = v - } - } - { - t, ok := tf.AttrTypes["suggested_labels"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.SuggestedLabels"}) - } else { - v := CopyToLabels(diags, obj.SuggestedLabels, t, tf.Attrs["suggested_labels"]) - tf.Attrs["suggested_labels"] = v - } - } - { - a, ok := tf.AttrTypes["github"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) - } else { - v, ok := tf.Attrs["github"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - if obj.GitHub == nil { - v.Null = true - } else { - obj := obj.GitHub - tf := &v - { - a, ok := tf.AttrTypes["allow"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) - } else { - c, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - c = github_com_hashicorp_terraform_plugin_framework_types.List{ - - ElemType: o.ElemType, - Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)), - Null: true, - } - } else { - if c.Elems == nil { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) - } - } - if obj.Allow != nil { - o := o.ElemType.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) - if len(obj.Allow) != len(c.Elems) { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) - } - for k, a := range obj.Allow { - v, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - if a == nil { - v.Null = true - } else { - obj := a - tf := &v - { - t, ok := tf.AttrTypes["sub"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Sub"}) - } else { - v, ok := tf.Attrs["sub"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.Allow.Sub", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Sub", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Sub) == "" - } - v.Value = string(obj.Sub) - v.Unknown = false - tf.Attrs["sub"] = v - } - } - { - t, ok := tf.AttrTypes["repository"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Repository"}) - } else { - v, ok := tf.Attrs["repository"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.Allow.Repository", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Repository", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Repository) == "" - } - v.Value = string(obj.Repository) - v.Unknown = false - tf.Attrs["repository"] = v - } - } - { - t, ok := tf.AttrTypes["repository_owner"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.RepositoryOwner"}) - } else { - v, ok := tf.Attrs["repository_owner"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.Allow.RepositoryOwner", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.RepositoryOwner", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.RepositoryOwner) == "" - } - v.Value = string(obj.RepositoryOwner) - v.Unknown = false - tf.Attrs["repository_owner"] = v - } - } - { - t, ok := tf.AttrTypes["workflow"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Workflow"}) - } else { - v, ok := tf.Attrs["workflow"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.Allow.Workflow", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Workflow", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Workflow) == "" - } - v.Value = string(obj.Workflow) - v.Unknown = false - tf.Attrs["workflow"] = v - } - } - { - t, ok := tf.AttrTypes["environment"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Environment"}) - } else { - v, ok := tf.Attrs["environment"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.Allow.Environment", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Environment", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Environment) == "" - } - v.Value = string(obj.Environment) - v.Unknown = false - tf.Attrs["environment"] = v - } - } - { - t, ok := tf.AttrTypes["actor"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Actor"}) - } else { - v, ok := tf.Attrs["actor"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.Allow.Actor", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Actor", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Actor) == "" - } - v.Value = string(obj.Actor) - v.Unknown = false - tf.Attrs["actor"] = v - } - } - { - t, ok := tf.AttrTypes["ref"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Ref"}) - } else { - v, ok := tf.Attrs["ref"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.Allow.Ref", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.Ref", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Ref) == "" - } - v.Value = string(obj.Ref) - v.Unknown = false - tf.Attrs["ref"] = v - } - } - { - t, ok := tf.AttrTypes["ref_type"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.Allow.RefType"}) - } else { - v, ok := tf.Attrs["ref_type"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.Allow.RefType", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.Allow.RefType", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.RefType) == "" - } - v.Value = string(obj.RefType) - v.Unknown = false - tf.Attrs["ref_type"] = v - } - } - } - v.Unknown = false - c.Elems[k] = v - } - if len(obj.Allow) > 0 { - c.Null = false - } - } - c.Unknown = false - tf.Attrs["allow"] = c - } - } - } - { - t, ok := tf.AttrTypes["enterprise_server_host"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.EnterpriseServerHost"}) - } else { - v, ok := tf.Attrs["enterprise_server_host"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.EnterpriseServerHost", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.EnterpriseServerHost", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.EnterpriseServerHost) == "" - } - v.Value = string(obj.EnterpriseServerHost) - v.Unknown = false - tf.Attrs["enterprise_server_host"] = v - } - } - { - t, ok := tf.AttrTypes["enterprise_slug"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitHub.EnterpriseSlug"}) - } else { - v, ok := tf.Attrs["enterprise_slug"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitHub.EnterpriseSlug", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitHub.EnterpriseSlug", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.EnterpriseSlug) == "" - } - v.Value = string(obj.EnterpriseSlug) - v.Unknown = false - tf.Attrs["enterprise_slug"] = v - } - } - } - v.Unknown = false - tf.Attrs["github"] = v - } - } - } - { - a, ok := tf.AttrTypes["circleci"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.CircleCI"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) - } else { - v, ok := tf.Attrs["circleci"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - if obj.CircleCI == nil { - v.Null = true - } else { - obj := obj.CircleCI - tf := &v - { - a, ok := tf.AttrTypes["allow"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.CircleCI.Allow"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI.Allow", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) - } else { - c, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - c = github_com_hashicorp_terraform_plugin_framework_types.List{ - - ElemType: o.ElemType, - Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)), - Null: true, - } - } else { - if c.Elems == nil { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) - } - } - if obj.Allow != nil { - o := o.ElemType.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) - if len(obj.Allow) != len(c.Elems) { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) - } - for k, a := range obj.Allow { - v, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - if a == nil { - v.Null = true - } else { - obj := a - tf := &v - { - t, ok := tf.AttrTypes["project_id"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.CircleCI.Allow.ProjectID"}) - } else { - v, ok := tf.Attrs["project_id"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.CircleCI.Allow.ProjectID", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI.Allow.ProjectID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.ProjectID) == "" - } - v.Value = string(obj.ProjectID) - v.Unknown = false - tf.Attrs["project_id"] = v - } - } - { - t, ok := tf.AttrTypes["context_id"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.CircleCI.Allow.ContextID"}) - } else { - v, ok := tf.Attrs["context_id"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.CircleCI.Allow.ContextID", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI.Allow.ContextID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.ContextID) == "" - } - v.Value = string(obj.ContextID) - v.Unknown = false - tf.Attrs["context_id"] = v - } - } - } - v.Unknown = false - c.Elems[k] = v - } - if len(obj.Allow) > 0 { - c.Null = false - } - } - c.Unknown = false - tf.Attrs["allow"] = c - } - } - } - { - t, ok := tf.AttrTypes["organization_id"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.CircleCI.OrganizationID"}) - } else { - v, ok := tf.Attrs["organization_id"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.CircleCI.OrganizationID", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.CircleCI.OrganizationID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.OrganizationID) == "" - } - v.Value = string(obj.OrganizationID) - v.Unknown = false - tf.Attrs["organization_id"] = v - } - } - } - v.Unknown = false - tf.Attrs["circleci"] = v - } - } - } - { - t, ok := tf.AttrTypes["suggested_agent_matcher_labels"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.SuggestedAgentMatcherLabels"}) - } else { - v := CopyToLabels(diags, obj.SuggestedAgentMatcherLabels, t, tf.Attrs["suggested_agent_matcher_labels"]) - tf.Attrs["suggested_agent_matcher_labels"] = v - } - } - { - a, ok := tf.AttrTypes["kubernetes"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Kubernetes"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) - } else { - v, ok := tf.Attrs["kubernetes"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - if obj.Kubernetes == nil { - v.Null = true - } else { - obj := obj.Kubernetes - tf := &v - { - a, ok := tf.AttrTypes["allow"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.Allow"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.Allow", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) - } else { - c, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - c = github_com_hashicorp_terraform_plugin_framework_types.List{ - - ElemType: o.ElemType, - Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)), - Null: true, - } - } else { - if c.Elems == nil { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) - } - } - if obj.Allow != nil { - o := o.ElemType.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) - if len(obj.Allow) != len(c.Elems) { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) - } - for k, a := range obj.Allow { - v, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - if a == nil { - v.Null = true - } else { - obj := a - tf := &v - { - t, ok := tf.AttrTypes["service_account"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.Allow.ServiceAccount"}) - } else { - v, ok := tf.Attrs["service_account"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Kubernetes.Allow.ServiceAccount", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.Allow.ServiceAccount", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.ServiceAccount) == "" - } - v.Value = string(obj.ServiceAccount) - v.Unknown = false - tf.Attrs["service_account"] = v - } - } - } - v.Unknown = false - c.Elems[k] = v - } - if len(obj.Allow) > 0 { - c.Null = false - } - } - c.Unknown = false - tf.Attrs["allow"] = c - } - } - } - { - t, ok := tf.AttrTypes["type"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.Type"}) - } else { - v, ok := tf.Attrs["type"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Kubernetes.Type", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.Type", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Type) == "" - } - v.Value = string(obj.Type) - v.Unknown = false - tf.Attrs["type"] = v - } - } - { - a, ok := tf.AttrTypes["static_jwks"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.StaticJWKS"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.StaticJWKS", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) - } else { - v, ok := tf.Attrs["static_jwks"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - if obj.StaticJWKS == nil { - v.Null = true - } else { - obj := obj.StaticJWKS - tf := &v - { - t, ok := tf.AttrTypes["jwks"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Kubernetes.StaticJWKS.JWKS"}) - } else { - v, ok := tf.Attrs["jwks"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Kubernetes.StaticJWKS.JWKS", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Kubernetes.StaticJWKS.JWKS", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.JWKS) == "" - } - v.Value = string(obj.JWKS) - v.Unknown = false - tf.Attrs["jwks"] = v - } - } - } - v.Unknown = false - tf.Attrs["static_jwks"] = v - } - } - } - } - v.Unknown = false - tf.Attrs["kubernetes"] = v - } - } - } - { - a, ok := tf.AttrTypes["azure"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Azure"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Azure", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) - } else { - v, ok := tf.Attrs["azure"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - if obj.Azure == nil { - v.Null = true - } else { - obj := obj.Azure - tf := &v - { - a, ok := tf.AttrTypes["allow"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Azure.Allow"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Azure.Allow", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) - } else { - c, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - c = github_com_hashicorp_terraform_plugin_framework_types.List{ - - ElemType: o.ElemType, - Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)), - Null: true, - } - } else { - if c.Elems == nil { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) - } - } - if obj.Allow != nil { - o := o.ElemType.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) - if len(obj.Allow) != len(c.Elems) { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) - } - for k, a := range obj.Allow { - v, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - if a == nil { - v.Null = true - } else { - obj := a - tf := &v - { - t, ok := tf.AttrTypes["subscription"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Azure.Allow.Subscription"}) - } else { - v, ok := tf.Attrs["subscription"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Azure.Allow.Subscription", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Azure.Allow.Subscription", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Subscription) == "" - } - v.Value = string(obj.Subscription) - v.Unknown = false - tf.Attrs["subscription"] = v - } - } - { - a, ok := tf.AttrTypes["resource_groups"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Azure.Allow.ResourceGroups"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Azure.Allow.ResourceGroups", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) - } else { - c, ok := tf.Attrs["resource_groups"].(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - c = github_com_hashicorp_terraform_plugin_framework_types.List{ - - ElemType: o.ElemType, - Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.ResourceGroups)), - Null: true, - } - } else { - if c.Elems == nil { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.ResourceGroups)) - } - } - if obj.ResourceGroups != nil { - t := o.ElemType - if len(obj.ResourceGroups) != len(c.Elems) { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.ResourceGroups)) - } - for k, a := range obj.ResourceGroups { - v, ok := tf.Attrs["resource_groups"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Azure.Allow.ResourceGroups", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Azure.Allow.ResourceGroups", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(a) == "" - } - v.Value = string(a) - v.Unknown = false - c.Elems[k] = v - } - if len(obj.ResourceGroups) > 0 { - c.Null = false - } - } - c.Unknown = false - tf.Attrs["resource_groups"] = c - } - } - } - } - v.Unknown = false - c.Elems[k] = v - } - if len(obj.Allow) > 0 { - c.Null = false - } - } - c.Unknown = false - tf.Attrs["allow"] = c - } - } - } - } - v.Unknown = false - tf.Attrs["azure"] = v - } - } - } - { - a, ok := tf.AttrTypes["gitlab"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) - } else { - v, ok := tf.Attrs["gitlab"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - if obj.GitLab == nil { - v.Null = true - } else { - obj := obj.GitLab - tf := &v - { - a, ok := tf.AttrTypes["allow"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) - } else { - c, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - c = github_com_hashicorp_terraform_plugin_framework_types.List{ - - ElemType: o.ElemType, - Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)), - Null: true, - } - } else { - if c.Elems == nil { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) - } - } - if obj.Allow != nil { - o := o.ElemType.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) - if len(obj.Allow) != len(c.Elems) { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) - } - for k, a := range obj.Allow { - v, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - if a == nil { - v.Null = true - } else { - obj := a - tf := &v - { - t, ok := tf.AttrTypes["sub"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Sub"}) - } else { - v, ok := tf.Attrs["sub"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.Sub", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Sub", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Sub) == "" - } - v.Value = string(obj.Sub) - v.Unknown = false - tf.Attrs["sub"] = v - } - } - { - t, ok := tf.AttrTypes["ref"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Ref"}) - } else { - v, ok := tf.Attrs["ref"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.Ref", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Ref", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Ref) == "" - } - v.Value = string(obj.Ref) - v.Unknown = false - tf.Attrs["ref"] = v - } - } - { - t, ok := tf.AttrTypes["ref_type"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.RefType"}) - } else { - v, ok := tf.Attrs["ref_type"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.RefType", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.RefType", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.RefType) == "" - } - v.Value = string(obj.RefType) - v.Unknown = false - tf.Attrs["ref_type"] = v - } - } - { - t, ok := tf.AttrTypes["namespace_path"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.NamespacePath"}) - } else { - v, ok := tf.Attrs["namespace_path"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.NamespacePath", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.NamespacePath", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.NamespacePath) == "" - } - v.Value = string(obj.NamespacePath) - v.Unknown = false - tf.Attrs["namespace_path"] = v - } - } - { - t, ok := tf.AttrTypes["project_path"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectPath"}) - } else { - v, ok := tf.Attrs["project_path"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectPath", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectPath", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.ProjectPath) == "" - } - v.Value = string(obj.ProjectPath) - v.Unknown = false - tf.Attrs["project_path"] = v - } - } - { - t, ok := tf.AttrTypes["pipeline_source"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.PipelineSource"}) - } else { - v, ok := tf.Attrs["pipeline_source"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.PipelineSource", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.PipelineSource", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.PipelineSource) == "" - } - v.Value = string(obj.PipelineSource) - v.Unknown = false - tf.Attrs["pipeline_source"] = v - } - } - { - t, ok := tf.AttrTypes["environment"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Environment"}) - } else { - v, ok := tf.Attrs["environment"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.Environment", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.Environment", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Environment) == "" - } - v.Value = string(obj.Environment) - v.Unknown = false - tf.Attrs["environment"] = v - } - } - { - t, ok := tf.AttrTypes["user_login"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserLogin"}) - } else { - v, ok := tf.Attrs["user_login"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.UserLogin", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserLogin", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.UserLogin) == "" - } - v.Value = string(obj.UserLogin) - v.Unknown = false - tf.Attrs["user_login"] = v - } - } - { - t, ok := tf.AttrTypes["user_id"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserID"}) - } else { - v, ok := tf.Attrs["user_id"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.UserID", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.UserID) == "" - } - v.Value = string(obj.UserID) - v.Unknown = false - tf.Attrs["user_id"] = v - } - } - { - t, ok := tf.AttrTypes["user_email"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserEmail"}) - } else { - v, ok := tf.Attrs["user_email"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.UserEmail", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.UserEmail", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.UserEmail) == "" - } - v.Value = string(obj.UserEmail) - v.Unknown = false - tf.Attrs["user_email"] = v - } - } - { - t, ok := tf.AttrTypes["ref_protected"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.RefProtected"}) - } else { - v := CopyToBoolOption(diags, obj.RefProtected, t, tf.Attrs["ref_protected"]) - tf.Attrs["ref_protected"] = v - } - } - { - t, ok := tf.AttrTypes["environment_protected"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.EnvironmentProtected"}) - } else { - v := CopyToBoolOption(diags, obj.EnvironmentProtected, t, tf.Attrs["environment_protected"]) - tf.Attrs["environment_protected"] = v - } - } - { - t, ok := tf.AttrTypes["ci_config_sha"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigSHA"}) - } else { - v, ok := tf.Attrs["ci_config_sha"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigSHA", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigSHA", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.CIConfigSHA) == "" - } - v.Value = string(obj.CIConfigSHA) - v.Unknown = false - tf.Attrs["ci_config_sha"] = v - } - } - { - t, ok := tf.AttrTypes["ci_config_ref_uri"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigRefURI"}) - } else { - v, ok := tf.Attrs["ci_config_ref_uri"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigRefURI", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.CIConfigRefURI", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.CIConfigRefURI) == "" - } - v.Value = string(obj.CIConfigRefURI) - v.Unknown = false - tf.Attrs["ci_config_ref_uri"] = v - } - } - { - t, ok := tf.AttrTypes["deployment_tier"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.DeploymentTier"}) - } else { - v, ok := tf.Attrs["deployment_tier"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.DeploymentTier", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.DeploymentTier", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.DeploymentTier) == "" - } - v.Value = string(obj.DeploymentTier) - v.Unknown = false - tf.Attrs["deployment_tier"] = v - } - } - { - t, ok := tf.AttrTypes["project_visibility"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectVisibility"}) - } else { - v, ok := tf.Attrs["project_visibility"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectVisibility", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Allow.ProjectVisibility", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.ProjectVisibility) == "" - } - v.Value = string(obj.ProjectVisibility) - v.Unknown = false - tf.Attrs["project_visibility"] = v - } - } - } - v.Unknown = false - c.Elems[k] = v - } - if len(obj.Allow) > 0 { - c.Null = false - } - } - c.Unknown = false - tf.Attrs["allow"] = c - } - } - } - { - t, ok := tf.AttrTypes["domain"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GitLab.Domain"}) - } else { - v, ok := tf.Attrs["domain"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GitLab.Domain", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GitLab.Domain", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.Domain) == "" - } - v.Value = string(obj.Domain) - v.Unknown = false - tf.Attrs["domain"] = v - } - } - } - v.Unknown = false - tf.Attrs["gitlab"] = v - } - } - } - { - a, ok := tf.AttrTypes["gcp"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GCP"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GCP", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) - } else { - v, ok := tf.Attrs["gcp"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - if obj.GCP == nil { - v.Null = true - } else { - obj := obj.GCP - tf := &v - { - a, ok := tf.AttrTypes["allow"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GCP.Allow"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) - } else { - c, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - c = github_com_hashicorp_terraform_plugin_framework_types.List{ - - ElemType: o.ElemType, - Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)), - Null: true, - } - } else { - if c.Elems == nil { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) - } - } - if obj.Allow != nil { - o := o.ElemType.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) - if len(obj.Allow) != len(c.Elems) { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) - } - for k, a := range obj.Allow { - v, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - if a == nil { - v.Null = true - } else { - obj := a - tf := &v - { - a, ok := tf.AttrTypes["project_ids"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GCP.Allow.ProjectIDs"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.ProjectIDs", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) - } else { - c, ok := tf.Attrs["project_ids"].(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - c = github_com_hashicorp_terraform_plugin_framework_types.List{ - - ElemType: o.ElemType, - Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.ProjectIDs)), - Null: true, - } - } else { - if c.Elems == nil { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.ProjectIDs)) - } - } - if obj.ProjectIDs != nil { - t := o.ElemType - if len(obj.ProjectIDs) != len(c.Elems) { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.ProjectIDs)) - } - for k, a := range obj.ProjectIDs { - v, ok := tf.Attrs["project_ids"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GCP.Allow.ProjectIDs", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.ProjectIDs", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(a) == "" - } - v.Value = string(a) - v.Unknown = false - c.Elems[k] = v - } - if len(obj.ProjectIDs) > 0 { - c.Null = false - } - } - c.Unknown = false - tf.Attrs["project_ids"] = c - } - } - } - { - a, ok := tf.AttrTypes["locations"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GCP.Allow.Locations"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.Locations", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) - } else { - c, ok := tf.Attrs["locations"].(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - c = github_com_hashicorp_terraform_plugin_framework_types.List{ - - ElemType: o.ElemType, - Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Locations)), - Null: true, - } - } else { - if c.Elems == nil { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Locations)) - } - } - if obj.Locations != nil { - t := o.ElemType - if len(obj.Locations) != len(c.Elems) { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Locations)) - } - for k, a := range obj.Locations { - v, ok := tf.Attrs["locations"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GCP.Allow.Locations", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.Locations", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(a) == "" - } - v.Value = string(a) - v.Unknown = false - c.Elems[k] = v - } - if len(obj.Locations) > 0 { - c.Null = false - } - } - c.Unknown = false - tf.Attrs["locations"] = c - } - } - } - { - a, ok := tf.AttrTypes["service_accounts"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.GCP.Allow.ServiceAccounts"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.ServiceAccounts", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) - } else { - c, ok := tf.Attrs["service_accounts"].(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - c = github_com_hashicorp_terraform_plugin_framework_types.List{ - - ElemType: o.ElemType, - Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.ServiceAccounts)), - Null: true, - } - } else { - if c.Elems == nil { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.ServiceAccounts)) - } - } - if obj.ServiceAccounts != nil { - t := o.ElemType - if len(obj.ServiceAccounts) != len(c.Elems) { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.ServiceAccounts)) - } - for k, a := range obj.ServiceAccounts { - v, ok := tf.Attrs["service_accounts"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.GCP.Allow.ServiceAccounts", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.GCP.Allow.ServiceAccounts", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(a) == "" - } - v.Value = string(a) - v.Unknown = false - c.Elems[k] = v - } - if len(obj.ServiceAccounts) > 0 { - c.Null = false - } - } - c.Unknown = false - tf.Attrs["service_accounts"] = c - } - } - } - } - v.Unknown = false - c.Elems[k] = v - } - if len(obj.Allow) > 0 { - c.Null = false - } - } - c.Unknown = false - tf.Attrs["allow"] = c - } - } - } - } - v.Unknown = false - tf.Attrs["gcp"] = v - } - } - } - { - a, ok := tf.AttrTypes["spacelift"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Spacelift"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) - } else { - v, ok := tf.Attrs["spacelift"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - if obj.Spacelift == nil { - v.Null = true - } else { - obj := obj.Spacelift - tf := &v - { - a, ok := tf.AttrTypes["allow"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow"}) - } else { - o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) - } else { - c, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.List) - if !ok { - c = github_com_hashicorp_terraform_plugin_framework_types.List{ - - ElemType: o.ElemType, - Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)), - Null: true, - } - } else { - if c.Elems == nil { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) - } - } - if obj.Allow != nil { - o := o.ElemType.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) - if len(obj.Allow) != len(c.Elems) { - c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.Allow)) - } - for k, a := range obj.Allow { - v, ok := tf.Attrs["allow"].(github_com_hashicorp_terraform_plugin_framework_types.Object) - if !ok { - v = github_com_hashicorp_terraform_plugin_framework_types.Object{ - - AttrTypes: o.AttrTypes, - Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), - } - } else { - if v.Attrs == nil { - v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) - } - } - if a == nil { - v.Null = true - } else { - obj := a - tf := &v - { - t, ok := tf.AttrTypes["space_id"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.SpaceID"}) - } else { - v, ok := tf.Attrs["space_id"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Spacelift.Allow.SpaceID", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.SpaceID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.SpaceID) == "" - } - v.Value = string(obj.SpaceID) - v.Unknown = false - tf.Attrs["space_id"] = v - } - } - { - t, ok := tf.AttrTypes["caller_id"] - if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerID"}) - } else { - v, ok := tf.Attrs["caller_id"].(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) - if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerID", err}) - } - v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) - if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) - } - v.Null = string(obj.CallerID) == "" - } - v.Value = string(obj.CallerID) - v.Unknown = false - tf.Attrs["caller_id"] = v - } + for k, a := range obj.Headers { + v, ok := tf.Attrs["headers"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) } + } + if a == nil { + v.Null = true + } else { + obj := a + tf := &v { - t, ok := tf.AttrTypes["caller_type"] + t, ok := tf.AttrTypes["name"] if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerType"}) + diags.Append(attrWriteMissingDiag{"AppV3.Spec.Rewrite.Headers.Name"}) } else { - v, ok := tf.Attrs["caller_type"].(github_com_hashicorp_terraform_plugin_framework_types.String) + v, ok := tf.Attrs["name"].(github_com_hashicorp_terraform_plugin_framework_types.String) if !ok { i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerType", err}) + diags.Append(attrWriteGeneralError{"AppV3.Spec.Rewrite.Headers.Name", err}) } v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.CallerType", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + diags.Append(attrWriteConversionFailureDiag{"AppV3.Spec.Rewrite.Headers.Name", "github.com/hashicorp/terraform-plugin-framework/types.String"}) } - v.Null = string(obj.CallerType) == "" + v.Null = string(obj.Name) == "" } - v.Value = string(obj.CallerType) + v.Value = string(obj.Name) v.Unknown = false - tf.Attrs["caller_type"] = v + tf.Attrs["name"] = v } } { - t, ok := tf.AttrTypes["scope"] + t, ok := tf.AttrTypes["value"] if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.Scope"}) + diags.Append(attrWriteMissingDiag{"AppV3.Spec.Rewrite.Headers.Value"}) } else { - v, ok := tf.Attrs["scope"].(github_com_hashicorp_terraform_plugin_framework_types.String) + v, ok := tf.Attrs["value"].(github_com_hashicorp_terraform_plugin_framework_types.String) if !ok { i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Spacelift.Allow.Scope", err}) + diags.Append(attrWriteGeneralError{"AppV3.Spec.Rewrite.Headers.Value", err}) } v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Allow.Scope", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + diags.Append(attrWriteConversionFailureDiag{"AppV3.Spec.Rewrite.Headers.Value", "github.com/hashicorp/terraform-plugin-framework/types.String"}) } - v.Null = string(obj.Scope) == "" + v.Null = string(obj.Value) == "" } - v.Value = string(obj.Scope) + v.Value = string(obj.Value) v.Unknown = false - tf.Attrs["scope"] = v + tf.Attrs["value"] = v } } } v.Unknown = false c.Elems[k] = v } - if len(obj.Allow) > 0 { + if len(obj.Headers) > 0 { c.Null = false } } c.Unknown = false - tf.Attrs["allow"] = c + tf.Attrs["headers"] = c + } + } + } + { + t, ok := tf.AttrTypes["jwt_claims"] + if !ok { + diags.Append(attrWriteMissingDiag{"AppV3.Spec.Rewrite.JWTClaims"}) + } else { + v, ok := tf.Attrs["jwt_claims"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"AppV3.Spec.Rewrite.JWTClaims", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"AppV3.Spec.Rewrite.JWTClaims", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.JWTClaims) == "" } + v.Value = string(obj.JWTClaims) + v.Unknown = false + tf.Attrs["jwt_claims"] = v } } + } + v.Unknown = false + tf.Attrs["rewrite"] = v + } + } + } + { + a, ok := tf.AttrTypes["aws"] + if !ok { + diags.Append(attrWriteMissingDiag{"AppV3.Spec.AWS"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"AppV3.Spec.AWS", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) + } else { + v, ok := tf.Attrs["aws"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + if obj.AWS == nil { + v.Null = true + } else { + obj := obj.AWS + tf := &v { - t, ok := tf.AttrTypes["hostname"] + t, ok := tf.AttrTypes["external_id"] if !ok { - diags.Append(attrWriteMissingDiag{"ProvisionTokenV2.Spec.Spacelift.Hostname"}) + diags.Append(attrWriteMissingDiag{"AppV3.Spec.AWS.ExternalID"}) } else { - v, ok := tf.Attrs["hostname"].(github_com_hashicorp_terraform_plugin_framework_types.String) + v, ok := tf.Attrs["external_id"].(github_com_hashicorp_terraform_plugin_framework_types.String) if !ok { i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) if err != nil { - diags.Append(attrWriteGeneralError{"ProvisionTokenV2.Spec.Spacelift.Hostname", err}) + diags.Append(attrWriteGeneralError{"AppV3.Spec.AWS.ExternalID", err}) } v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) if !ok { - diags.Append(attrWriteConversionFailureDiag{"ProvisionTokenV2.Spec.Spacelift.Hostname", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + diags.Append(attrWriteConversionFailureDiag{"AppV3.Spec.AWS.ExternalID", "github.com/hashicorp/terraform-plugin-framework/types.String"}) } - v.Null = string(obj.Hostname) == "" + v.Null = string(obj.ExternalID) == "" } - v.Value = string(obj.Hostname) + v.Value = string(obj.ExternalID) v.Unknown = false - tf.Attrs["hostname"] = v + tf.Attrs["external_id"] = v } } } v.Unknown = false - tf.Attrs["spacelift"] = v + tf.Attrs["aws"] = v + } + } + } + { + t, ok := tf.AttrTypes["cloud"] + if !ok { + diags.Append(attrWriteMissingDiag{"AppV3.Spec.Cloud"}) + } else { + v, ok := tf.Attrs["cloud"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"AppV3.Spec.Cloud", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"AppV3.Spec.Cloud", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Cloud) == "" + } + v.Value = string(obj.Cloud) + v.Unknown = false + tf.Attrs["cloud"] = v + } + } + { + a, ok := tf.AttrTypes["user_groups"] + if !ok { + diags.Append(attrWriteMissingDiag{"AppV3.Spec.UserGroups"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ListType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"AppV3.Spec.UserGroups", "github.com/hashicorp/terraform-plugin-framework/types.ListType"}) + } else { + c, ok := tf.Attrs["user_groups"].(github_com_hashicorp_terraform_plugin_framework_types.List) + if !ok { + c = github_com_hashicorp_terraform_plugin_framework_types.List{ + + ElemType: o.ElemType, + Elems: make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.UserGroups)), + Null: true, + } + } else { + if c.Elems == nil { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.UserGroups)) + } + } + if obj.UserGroups != nil { + t := o.ElemType + if len(obj.UserGroups) != len(c.Elems) { + c.Elems = make([]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(obj.UserGroups)) + } + for k, a := range obj.UserGroups { + v, ok := tf.Attrs["user_groups"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"AppV3.Spec.UserGroups", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"AppV3.Spec.UserGroups", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(a) == "" + } + v.Value = string(a) + v.Unknown = false + c.Elems[k] = v + } + if len(obj.UserGroups) > 0 { + c.Null = false + } + } + c.Unknown = false + tf.Attrs["user_groups"] = c + } + } + } + { + t, ok := tf.AttrTypes["integration"] + if !ok { + diags.Append(attrWriteMissingDiag{"AppV3.Spec.Integration"}) + } else { + v, ok := tf.Attrs["integration"].(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"AppV3.Spec.Integration", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.String) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"AppV3.Spec.Integration", "github.com/hashicorp/terraform-plugin-framework/types.String"}) + } + v.Null = string(obj.Integration) == "" } + v.Value = string(obj.Integration) + v.Unknown = false + tf.Attrs["integration"] = v } } } @@ -30556,6 +26324,40 @@ func CopyUserV2FromTerraform(_ context.Context, tf github_com_hashicorp_terrafor } } } + { + a, ok := tf.Attrs["status"] + if !ok { + diags.Append(attrReadMissingDiag{"UserV2.Status"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + diags.Append(attrReadConversionFailureDiag{"UserV2.Status", "github.com/hashicorp/terraform-plugin-framework/types.Object"}) + } else { + obj.Status = github_com_gravitational_teleport_api_types.UserStatusV2{} + if !v.Null && !v.Unknown { + tf := v + obj := &obj.Status + { + a, ok := tf.Attrs["password_state"] + if !ok { + diags.Append(attrReadMissingDiag{"UserV2.Status.password_state"}) + } else { + v, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.Int64) + if !ok { + diags.Append(attrReadConversionFailureDiag{"UserV2.Status.password_state", "github.com/hashicorp/terraform-plugin-framework/types.Int64"}) + } else { + var t github_com_gravitational_teleport_api_types.PasswordState + if !v.Null && !v.Unknown { + t = github_com_gravitational_teleport_api_types.PasswordState(v.Value) + } + obj.PasswordState = t + } + } + } + } + } + } + } return diags } @@ -31273,6 +27075,58 @@ func CopyUserV2ToTerraform(ctx context.Context, obj *github_com_gravitational_te } } } + { + a, ok := tf.AttrTypes["status"] + if !ok { + diags.Append(attrWriteMissingDiag{"UserV2.Status"}) + } else { + o, ok := a.(github_com_hashicorp_terraform_plugin_framework_types.ObjectType) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"UserV2.Status", "github.com/hashicorp/terraform-plugin-framework/types.ObjectType"}) + } else { + v, ok := tf.Attrs["status"].(github_com_hashicorp_terraform_plugin_framework_types.Object) + if !ok { + v = github_com_hashicorp_terraform_plugin_framework_types.Object{ + + AttrTypes: o.AttrTypes, + Attrs: make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(o.AttrTypes)), + } + } else { + if v.Attrs == nil { + v.Attrs = make(map[string]github_com_hashicorp_terraform_plugin_framework_attr.Value, len(tf.AttrTypes)) + } + } + { + obj := obj.Status + tf := &v + { + t, ok := tf.AttrTypes["password_state"] + if !ok { + diags.Append(attrWriteMissingDiag{"UserV2.Status.password_state"}) + } else { + v, ok := tf.Attrs["password_state"].(github_com_hashicorp_terraform_plugin_framework_types.Int64) + if !ok { + i, err := t.ValueFromTerraform(ctx, github_com_hashicorp_terraform_plugin_go_tftypes.NewValue(t.TerraformType(ctx), nil)) + if err != nil { + diags.Append(attrWriteGeneralError{"UserV2.Status.password_state", err}) + } + v, ok = i.(github_com_hashicorp_terraform_plugin_framework_types.Int64) + if !ok { + diags.Append(attrWriteConversionFailureDiag{"UserV2.Status.password_state", "github.com/hashicorp/terraform-plugin-framework/types.Int64"}) + } + v.Null = int64(obj.PasswordState) == 0 + } + v.Value = int64(obj.PasswordState) + v.Unknown = false + tf.Attrs["password_state"] = v + } + } + } + v.Unknown = false + tf.Attrs["status"] = v + } + } + } return diags }