From 935feb0dc6600cdf4e8a9f216ac7a5193d84bd95 Mon Sep 17 00:00:00 2001 From: Andrew Burke Date: Fri, 20 Sep 2024 13:40:33 -0700 Subject: [PATCH] Make version required --- .../data-sources/static_host_user.mdx | 2 +- .../resources/static_host_user.mdx | 44 +++++++++---------- .../protoc-gen-terraform-statichostuser.yaml | 1 + .../v2/statichostuser_terraform.go | 2 +- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/docs/pages/reference/terraform-provider/data-sources/static_host_user.mdx b/docs/pages/reference/terraform-provider/data-sources/static_host_user.mdx index 59f464fbddff3..b3bf7d24c2a3b 100644 --- a/docs/pages/reference/terraform-provider/data-sources/static_host_user.mdx +++ b/docs/pages/reference/terraform-provider/data-sources/static_host_user.mdx @@ -17,11 +17,11 @@ description: This page describes the supported values of the teleport_static_hos - `metadata` (Attributes) metadata is resource metadata. (see [below for nested schema](#nested-schema-for-metadata)) - `spec` (Attributes) spec is the static host user spec. (see [below for nested schema](#nested-schema-for-spec)) +- `version` (String) version is the resource version. It must be specified. Supported values are: `v2`. ### Optional - `sub_kind` (String) sub_kind 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`. ### Nested Schema for `metadata` diff --git a/docs/pages/reference/terraform-provider/resources/static_host_user.mdx b/docs/pages/reference/terraform-provider/resources/static_host_user.mdx index 09cc1a3bfc2d6..5135e050ee35d 100644 --- a/docs/pages/reference/terraform-provider/resources/static_host_user.mdx +++ b/docs/pages/reference/terraform-provider/resources/static_host_user.mdx @@ -12,28 +12,28 @@ description: This page describes the supported values of the teleport_static_hos ```hcl resource "teleport_static_host_user" "test" { - version = "v2" - metadata = { - name = "test" - } - spec = { - matchers = [ - { - node_labels = [ - { - name = "foo" - values = ["bar"] - } - ] - node_labels_expression = "labels.foo == \"bar\"" - groups = ["foo", "bar"] - sudoers = ["abcd1234"] - uid = 1234 - gid = 1234 - default_shell = "/bin/bash" - } + version = "v2" + metadata = { + name = "test" + } + spec = { + matchers = [ + { + node_labels = [ + { + name = "foo" + values = ["bar"] + } ] - } + node_labels_expression = "labels.foo == \"bar\"" + groups = ["foo", "bar"] + sudoers = ["abcd1234"] + uid = 1234 + gid = 1234 + default_shell = "/bin/bash" + } + ] + } } ``` @@ -44,11 +44,11 @@ resource "teleport_static_host_user" "test" { - `metadata` (Attributes) metadata is resource metadata. (see [below for nested schema](#nested-schema-for-metadata)) - `spec` (Attributes) spec is the static host user spec. (see [below for nested schema](#nested-schema-for-spec)) +- `version` (String) version is the resource version. It must be specified. Supported values are: `v2`. ### Optional - `sub_kind` (String) sub_kind 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`. ### Nested Schema for `metadata` diff --git a/integrations/terraform/protoc-gen-terraform-statichostuser.yaml b/integrations/terraform/protoc-gen-terraform-statichostuser.yaml index fe4945dca9f1b..f2e2330394307 100644 --- a/integrations/terraform/protoc-gen-terraform-statichostuser.yaml +++ b/integrations/terraform/protoc-gen-terraform-statichostuser.yaml @@ -42,6 +42,7 @@ computed_fields: # These fields will be marked as Required: true required_fields: + - "StaticHostUser.version" - "StaticHostUser.metadata" - "StaticHostUser.metadata.name" - "StaticHostUser.spec" diff --git a/integrations/terraform/tfschema/userprovisioning/v2/statichostuser_terraform.go b/integrations/terraform/tfschema/userprovisioning/v2/statichostuser_terraform.go index 2d8cfbca9c525..5260578c3986b 100644 --- a/integrations/terraform/tfschema/userprovisioning/v2/statichostuser_terraform.go +++ b/integrations/terraform/tfschema/userprovisioning/v2/statichostuser_terraform.go @@ -156,7 +156,7 @@ func GenSchemaStaticHostUser(ctx context.Context) (github_com_hashicorp_terrafor }, "version": { Description: "version is the resource version. It must be specified. Supported values are: `v2`.", - Optional: true, + Required: true, Type: github_com_hashicorp_terraform_plugin_framework_types.StringType, }, }}, nil