From 624cbae51de021a48f44f883823e40e7dde19626 Mon Sep 17 00:00:00 2001 From: David Szabo Date: Thu, 2 May 2024 17:57:03 +0200 Subject: [PATCH] CDPCP-11953 Added workload password to machine user resource - Added a sensitive field called workload_password to machine user schema. It is updateable - Added missing IAM examples - Added missing doc template files --- docs/data-sources/environments_keytab.md | 7 +-- docs/resources/datahub_azure_cluster.md | 7 +-- docs/resources/datahub_gcp_cluster.md | 7 +-- docs/resources/datalake_gcp_datalake.md | 7 +-- .../environments_azure_environment.md | 4 +- .../environments_azure_image_terms.md | 7 +-- docs/resources/environments_gcp_credential.md | 7 +-- .../resources/environments_gcp_environment.md | 7 +-- .../environments_proxy_configuration.md | 7 +-- docs/resources/iam_machine_user.md | 42 +++++++++++++-- .../iam_machine_user_group_assignment.md | 49 ++++++++++++++++++ ...m_machine_user_resource_role_assignment.md | 51 +++++++++++++++++++ .../iam_machine_user_role_assignment.md | 49 ++++++++++++++++++ .../resources/machine_user_role_assignment.md | 27 ---------- docs/resources/operational_database.md | 8 +-- .../resource.tf | 4 +- .../cdp_iam_machine_user/resource.tf | 28 ++++++++++ .../resource.tf | 22 ++++++++ .../resource.tf | 23 +++++++++ .../resource.tf | 6 +-- .../with_all_parameters/resource.tf | 8 +-- provider/provider.go | 1 + provider/provider_test.go | 1 + resources/iam/model_machine_user.go | 1 + .../model_machine_user_group_assignment.go | 6 +-- resources/iam/resource_machine_user.go | 43 +++++++++++++++- .../resource_machine_user_group_assignment.go | 14 ++--- ...urce_machine_user_group_assignment_test.go | 4 +- ...e_machine_user_resource_role_assignment.go | 2 +- .../resource_machine_user_role_assignment.go | 2 +- resources/iam/schema_machine_user.go | 13 ++++- .../schema_macine_user_group_assignment.go | 4 +- .../data-sources/environments_keytab.md.tmpl | 26 ++++++++++ .../resources/datahub_azure_cluster.md.tmpl | 26 ++++++++++ .../resources/datahub_gcp_cluster.md.tmpl | 26 ++++++++++ .../resources/datalake_gcp_datalake.md.tmpl | 26 ++++++++++ .../environments_azure_image_terms.md.tmpl | 26 ++++++++++ .../environments_gcp_credential.md.tmpl | 26 ++++++++++ .../environments_gcp_environment.md.tmpl | 26 ++++++++++ .../environments_proxy_configuration.md.tmpl | 26 ++++++++++ templates/resources/iam_machine_user.md.tmpl | 26 ++++++++++ .../iam_machine_user_group_assignment.md.tmpl | 26 ++++++++++ ...hine_user_resource_role_assignment.md.tmpl | 26 ++++++++++ .../iam_machine_user_role_assignment.md.tmpl | 26 ++++++++++ 44 files changed, 674 insertions(+), 106 deletions(-) create mode 100644 docs/resources/iam_machine_user_group_assignment.md create mode 100644 docs/resources/iam_machine_user_resource_role_assignment.md create mode 100644 docs/resources/iam_machine_user_role_assignment.md delete mode 100644 docs/resources/machine_user_role_assignment.md create mode 100644 examples/resources/cdp_iam_machine_user/resource.tf create mode 100644 examples/resources/cdp_iam_machine_user_group_assignment/resource.tf create mode 100644 examples/resources/cdp_iam_machine_user_resource_role_assignment/resource.tf create mode 100644 templates/data-sources/environments_keytab.md.tmpl create mode 100644 templates/resources/datahub_azure_cluster.md.tmpl create mode 100644 templates/resources/datahub_gcp_cluster.md.tmpl create mode 100644 templates/resources/datalake_gcp_datalake.md.tmpl create mode 100644 templates/resources/environments_azure_image_terms.md.tmpl create mode 100644 templates/resources/environments_gcp_credential.md.tmpl create mode 100644 templates/resources/environments_gcp_environment.md.tmpl create mode 100644 templates/resources/environments_proxy_configuration.md.tmpl create mode 100644 templates/resources/iam_machine_user.md.tmpl create mode 100644 templates/resources/iam_machine_user_group_assignment.md.tmpl create mode 100644 templates/resources/iam_machine_user_resource_role_assignment.md.tmpl create mode 100644 templates/resources/iam_machine_user_role_assignment.md.tmpl diff --git a/docs/data-sources/environments_keytab.md b/docs/data-sources/environments_keytab.md index 3f9ace83..6719c0f9 100644 --- a/docs/data-sources/environments_keytab.md +++ b/docs/data-sources/environments_keytab.md @@ -1,7 +1,6 @@ --- -# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "cdp_environments_keytab Data Source - terraform-provider-cdp" -subcategory: "" +subcategory: "environments" description: |- --- @@ -25,6 +24,4 @@ description: |- ### Read-Only -- `keytab` (String) The contents of the keytab encoded as a base64 string. - - +- `keytab` (String) The contents of the keytab encoded as a base64 string. \ No newline at end of file diff --git a/docs/resources/datahub_azure_cluster.md b/docs/resources/datahub_azure_cluster.md index fd6fb47b..3e2cd60f 100644 --- a/docs/resources/datahub_azure_cluster.md +++ b/docs/resources/datahub_azure_cluster.md @@ -1,7 +1,6 @@ --- -# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "cdp_datahub_azure_cluster Resource - terraform-provider-cdp" -subcategory: "" +subcategory: "datahub" description: |- Creates an Azure Data hub cluster. --- @@ -291,6 +290,4 @@ Required: Optional: -- `polling_timeout` (Number) Timeout value in minutes that specifies for how long should the polling go for resource creation/deletion. - - +- `polling_timeout` (Number) Timeout value in minutes that specifies for how long should the polling go for resource creation/deletion. \ No newline at end of file diff --git a/docs/resources/datahub_gcp_cluster.md b/docs/resources/datahub_gcp_cluster.md index 1b5ed2aa..c7a38821 100644 --- a/docs/resources/datahub_gcp_cluster.md +++ b/docs/resources/datahub_gcp_cluster.md @@ -1,7 +1,6 @@ --- -# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "cdp_datahub_gcp_cluster Resource - terraform-provider-cdp" -subcategory: "" +subcategory: "datahub" description: |- Creates an GCP Data hub cluster. --- @@ -104,6 +103,4 @@ Required: Optional: -- `polling_timeout` (Number) Timeout value in minutes that specifies for how long should the polling go for resource creation/deletion. - - +- `polling_timeout` (Number) Timeout value in minutes that specifies for how long should the polling go for resource creation/deletion. \ No newline at end of file diff --git a/docs/resources/datalake_gcp_datalake.md b/docs/resources/datalake_gcp_datalake.md index 20f72804..8afdb6ee 100644 --- a/docs/resources/datalake_gcp_datalake.md +++ b/docs/resources/datalake_gcp_datalake.md @@ -1,7 +1,6 @@ --- -# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "cdp_datalake_gcp_datalake Resource - terraform-provider-cdp" -subcategory: "" +subcategory: "datalake" description: |- A Data Lake is a service which provides a protective ring around the data stored in a cloud object store, including authentication, authorization, and governance support. --- @@ -129,6 +128,4 @@ Optional: Required: - `instance_group_name` (String) The name of the designated instance group. -- `recipe_names` (Set of String) The set of recipe names that are going to be applied on the given instance group. - - +- `recipe_names` (Set of String) The set of recipe names that are going to be applied on the given instance group. \ No newline at end of file diff --git a/docs/resources/environments_azure_environment.md b/docs/resources/environments_azure_environment.md index bad734b1..aef3ba7f 100644 --- a/docs/resources/environments_azure_environment.md +++ b/docs/resources/environments_azure_environment.md @@ -50,9 +50,9 @@ resource "cdp_environments_azure_environment" "example-env" { storage_location_base = "abfs://rgname-fs@rgname-storage.dfs.core.windows.net" managed_identity = "/subscriptions/123e4567-e89b-12d3-a456-426614174000/resourcegroups/my-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/logger" } - resource_group_name = "rg-name" + resource_group_name = "rg-name" encryption_user_managed_identity = "some-identity" - use_public_ip = true + use_public_ip = true } output "environment_name" { diff --git a/docs/resources/environments_azure_image_terms.md b/docs/resources/environments_azure_image_terms.md index 99cd6165..824c3fcd 100644 --- a/docs/resources/environments_azure_image_terms.md +++ b/docs/resources/environments_azure_image_terms.md @@ -1,7 +1,6 @@ --- -# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "cdp_environments_azure_image_terms Resource - terraform-provider-cdp" -subcategory: "" +subcategory: "environments" description: |- Updates account level Azure Marketplace image policy. CDP is capable to automatically accept Azure Marketplace image terms during cluster deployment. You can use this setting in your account to opt in or opt out this behaviour. --- @@ -21,6 +20,4 @@ Updates account level Azure Marketplace image policy. CDP is capable to automati ### Read-Only -- `id` (String) The ID of this resource. - - +- `id` (String) The ID of this resource. \ No newline at end of file diff --git a/docs/resources/environments_gcp_credential.md b/docs/resources/environments_gcp_credential.md index 838ad549..8220ebf1 100644 --- a/docs/resources/environments_gcp_credential.md +++ b/docs/resources/environments_gcp_credential.md @@ -1,7 +1,6 @@ --- -# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "cdp_environments_gcp_credential Resource - terraform-provider-cdp" -subcategory: "" +subcategory: "environments" description: |- The GCP credential is used for authorization to provision resources such as compute instances within your cloud provider account. --- @@ -62,6 +61,4 @@ output "credential_key" { ### Read-Only - `crn` (String) -- `id` (String) The ID of this resource. - - +- `id` (String) The ID of this resource. \ No newline at end of file diff --git a/docs/resources/environments_gcp_environment.md b/docs/resources/environments_gcp_environment.md index 50a5c37b..86a25308 100644 --- a/docs/resources/environments_gcp_environment.md +++ b/docs/resources/environments_gcp_environment.md @@ -1,7 +1,6 @@ --- -# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "cdp_environments_gcp_environment Resource - terraform-provider-cdp" -subcategory: "" +subcategory: "environments" description: |- The environment is a logical entity that represents the association of your user account with multiple compute resources using which you can provision and manage workloads. --- @@ -184,6 +183,4 @@ Optional: Optional: - `default_security_group_id` (String) Firewall rule for other hosts. -- `security_group_id_for_knox` (String) Firewall rule for Knox hosts. - - +- `security_group_id_for_knox` (String) Firewall rule for Knox hosts. \ No newline at end of file diff --git a/docs/resources/environments_proxy_configuration.md b/docs/resources/environments_proxy_configuration.md index 0f3028f5..41069d8d 100644 --- a/docs/resources/environments_proxy_configuration.md +++ b/docs/resources/environments_proxy_configuration.md @@ -1,7 +1,6 @@ --- -# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "cdp_environments_proxy_configuration Resource - terraform-provider-cdp" -subcategory: "" +subcategory: "environments" description: |- --- @@ -31,6 +30,4 @@ description: |- ### Read-Only -- `id` (String) The ID of this resource. - - +- `id` (String) The ID of this resource. \ No newline at end of file diff --git a/docs/resources/iam_machine_user.md b/docs/resources/iam_machine_user.md index 45de62ea..7f13980e 100644 --- a/docs/resources/iam_machine_user.md +++ b/docs/resources/iam_machine_user.md @@ -1,7 +1,6 @@ --- -# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "cdp_iam_machine_user Resource - terraform-provider-cdp" -subcategory: "" +subcategory: "iam" description: |- --- @@ -10,7 +9,38 @@ description: |- +## Example Usage +```terraform +## Copyright 2024 Cloudera. All Rights Reserved. +# +# This file is 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. +# +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS +# OF ANY KIND, either express or implied. Refer to the License for the specific +# permissions and limitations governing your use of the file. + +variable "password" { + type = string +} + +resource "cdp_iam_machine_user" "example" { + name = "example" + + # Optional + workload_password = var.password +} + +output "machine_user" { + value = cdp_iam_machine_user.example.name +} + +output "password_expiration_date" { + value = cdp_iam_machine_user.example.workload_password_details.expiration_date +} +``` ## Schema @@ -19,6 +49,10 @@ description: |- - `name` (String) +### Optional + +- `workload_password` (String, Sensitive) + ### Read-Only - `azure_cloud_identities` (Attributes Set) (see [below for nested schema](#nestedatt--azure_cloud_identities)) @@ -44,6 +78,4 @@ Read-Only: - `expiration_date` (String) - `is_password_set` (Boolean) -- `min_lifetime_date` (String) - - +- `min_lifetime_date` (String) \ No newline at end of file diff --git a/docs/resources/iam_machine_user_group_assignment.md b/docs/resources/iam_machine_user_group_assignment.md new file mode 100644 index 00000000..dbab93e9 --- /dev/null +++ b/docs/resources/iam_machine_user_group_assignment.md @@ -0,0 +1,49 @@ +--- +page_title: "cdp_iam_machine_user_group_assignment Resource - terraform-provider-cdp" +subcategory: "iam" +description: |- + +--- + +# cdp_iam_machine_user_group_assignment (Resource) + + + +## Example Usage + +```terraform +## Copyright 2024 Cloudera. All Rights Reserved. +# +# This file is 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. +# +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS +# OF ANY KIND, either express or implied. Refer to the License for the specific +# permissions and limitations governing your use of the file. + +resource "cdp_iam_machine_user_group_assignment" "example" { + machine_user = "example" + group = "some-group" +} + +output "machine_user" { + value = cdp_iam_machine_user_group_assignment.example.machine_user +} + +output "role" { + value = cdp_iam_machine_user_group_assignment.example.group +} +``` + + +## Schema + +### Required + +- `group` (String) +- `machine_user` (String) + +### Read-Only + +- `id` (String) The ID of this resource. \ No newline at end of file diff --git a/docs/resources/iam_machine_user_resource_role_assignment.md b/docs/resources/iam_machine_user_resource_role_assignment.md new file mode 100644 index 00000000..e886577c --- /dev/null +++ b/docs/resources/iam_machine_user_resource_role_assignment.md @@ -0,0 +1,51 @@ +--- +page_title: "cdp_iam_machine_user_resource_role_assignment Resource - terraform-provider-cdp" +subcategory: "iam" +description: |- + +--- + +# cdp_iam_machine_user_resource_role_assignment (Resource) + + + +## Example Usage + +```terraform +## Copyright 2024 Cloudera. All Rights Reserved. +# +# This file is 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. +# +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS +# OF ANY KIND, either express or implied. Refer to the License for the specific +# permissions and limitations governing your use of the file. + +resource "cdp_iam_machine_user_resource_role_assignment" "example" { + machine_user = "example" + resource_crn = "crn:cdp:environments:us-west-1:00000000-0000-0000-0000-000000000000:environment:00000000-0000-0000-0000-000000000000" + resource_role_crn = "crn:altus:iam:us-west-1:altus:resourceRole:EnvironmentUser" +} + +output "machine_use" { + value = cdp_iam_machine_user_resource_role_assignment.example.machine_user +} + +output "resource_role_crn" { + value = cdp_iam_machine_user_resource_role_assignment.example.resource_role_crn +} +``` + + +## Schema + +### Required + +- `machine_user` (String) The machine user the role is assigned to. Can be the machine user’s name or CRN. +- `resource_crn` (String) The resource for which the resource role rights are granted. +- `resource_role_crn` (String) The CRN of the resource role to assign to the machine user. + +### Read-Only + +- `id` (String) The ID of this resource. \ No newline at end of file diff --git a/docs/resources/iam_machine_user_role_assignment.md b/docs/resources/iam_machine_user_role_assignment.md new file mode 100644 index 00000000..2d833a1d --- /dev/null +++ b/docs/resources/iam_machine_user_role_assignment.md @@ -0,0 +1,49 @@ +--- +page_title: "cdp_iam_machine_user_role_assignment Resource - terraform-provider-cdp" +subcategory: "iam" +description: |- + +--- + +# cdp_iam_machine_user_role_assignment (Resource) + + + +## Example Usage + +```terraform +## Copyright 2024 Cloudera. All Rights Reserved. +# +# This file is 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. +# +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS +# OF ANY KIND, either express or implied. Refer to the License for the specific +# permissions and limitations governing your use of the file. + +resource "cdp_iam_machine_user_role_assignment" "example" { + machine_user = "example" + role = "some-role" +} + +output "machine_use" { + value = cdp_iam_machine_user_role_assignment.example.machine_user +} + +output "role" { + value = cdp_iam_machine_user_role_assignment.example.role +} +``` + + +## Schema + +### Required + +- `machine_user` (String) The machine user the role is assigned to. Can be the machine user’s name or CRN. +- `role` (String) The role to assign to the machine user. Can be the role’s name or CRN. + +### Read-Only + +- `id` (String) The ID of this resource. \ No newline at end of file diff --git a/docs/resources/machine_user_role_assignment.md b/docs/resources/machine_user_role_assignment.md deleted file mode 100644 index fee5d385..00000000 --- a/docs/resources/machine_user_role_assignment.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "cdp_machine_user_role_assignment Resource - terraform-provider-cdp" -subcategory: "" -description: |- - ---- - -# cdp_machine_user_role_assignment (Resource) - - - - - - -## Schema - -### Required - -- `machine_user` (String) The machine user the role is assigned to. Can be the machine user’s name or CRN. -- `role` (String) The role to assign to the machine user. Can be the role’s name or CRN. - -### Read-Only - -- `id` (String) The ID of this resource. - - diff --git a/docs/resources/operational_database.md b/docs/resources/operational_database.md index 494a278d..961e7663 100644 --- a/docs/resources/operational_database.md +++ b/docs/resources/operational_database.md @@ -77,17 +77,17 @@ resource "cdp_operational_database" "opdb" { environment_name = "" database_name = "" - scale_type = "HEAVY" // valid options are "MICRO","LIGHT","HEAVY" - storage_type = "CLOUD_WITH_EPHEMERAL" // valid options are "CLOUD_WITH_EPHEMERAL","CLOUD","HDFS" + scale_type = "HEAVY" // valid options are "MICRO","LIGHT","HEAVY" + storage_type = "CLOUD_WITH_EPHEMERAL" // valid options are "CLOUD_WITH_EPHEMERAL","CLOUD","HDFS" java_version = 8 disable_external_db = true disable_multi_az = true - subnet_id = "" + subnet_id = "" - num_edge_nodes = 1 + num_edge_nodes = 1 auto_scaling_parameters = { targeted_value_for_metric = 249 diff --git a/examples/resources/cdp_environments_azure_environment/resource.tf b/examples/resources/cdp_environments_azure_environment/resource.tf index 971bb184..602fb366 100644 --- a/examples/resources/cdp_environments_azure_environment/resource.tf +++ b/examples/resources/cdp_environments_azure_environment/resource.tf @@ -36,9 +36,9 @@ resource "cdp_environments_azure_environment" "example-env" { storage_location_base = "abfs://rgname-fs@rgname-storage.dfs.core.windows.net" managed_identity = "/subscriptions/123e4567-e89b-12d3-a456-426614174000/resourcegroups/my-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/logger" } - resource_group_name = "rg-name" + resource_group_name = "rg-name" encryption_user_managed_identity = "some-identity" - use_public_ip = true + use_public_ip = true } output "environment_name" { diff --git a/examples/resources/cdp_iam_machine_user/resource.tf b/examples/resources/cdp_iam_machine_user/resource.tf new file mode 100644 index 00000000..38ab34ab --- /dev/null +++ b/examples/resources/cdp_iam_machine_user/resource.tf @@ -0,0 +1,28 @@ +## Copyright 2024 Cloudera. All Rights Reserved. +# +# This file is 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. +# +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS +# OF ANY KIND, either express or implied. Refer to the License for the specific +# permissions and limitations governing your use of the file. + +variable "password" { + type = string +} + +resource "cdp_iam_machine_user" "example" { + name = "example" + + # Optional + workload_password = var.password +} + +output "machine_user" { + value = cdp_iam_machine_user.example.name +} + +output "password_expiration_date" { + value = cdp_iam_machine_user.example.workload_password_details.expiration_date +} diff --git a/examples/resources/cdp_iam_machine_user_group_assignment/resource.tf b/examples/resources/cdp_iam_machine_user_group_assignment/resource.tf new file mode 100644 index 00000000..14e11aa1 --- /dev/null +++ b/examples/resources/cdp_iam_machine_user_group_assignment/resource.tf @@ -0,0 +1,22 @@ +## Copyright 2024 Cloudera. All Rights Reserved. +# +# This file is 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. +# +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS +# OF ANY KIND, either express or implied. Refer to the License for the specific +# permissions and limitations governing your use of the file. + +resource "cdp_iam_machine_user_group_assignment" "example" { + machine_user = "example" + group = "some-group" +} + +output "machine_user" { + value = cdp_iam_machine_user_group_assignment.example.machine_user +} + +output "role" { + value = cdp_iam_machine_user_group_assignment.example.group +} diff --git a/examples/resources/cdp_iam_machine_user_resource_role_assignment/resource.tf b/examples/resources/cdp_iam_machine_user_resource_role_assignment/resource.tf new file mode 100644 index 00000000..181e395e --- /dev/null +++ b/examples/resources/cdp_iam_machine_user_resource_role_assignment/resource.tf @@ -0,0 +1,23 @@ +## Copyright 2024 Cloudera. All Rights Reserved. +# +# This file is 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. +# +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS +# OF ANY KIND, either express or implied. Refer to the License for the specific +# permissions and limitations governing your use of the file. + +resource "cdp_iam_machine_user_resource_role_assignment" "example" { + machine_user = "example" + resource_crn = "crn:cdp:environments:us-west-1:00000000-0000-0000-0000-000000000000:environment:00000000-0000-0000-0000-000000000000" + resource_role_crn = "crn:altus:iam:us-west-1:altus:resourceRole:EnvironmentUser" +} + +output "machine_use" { + value = cdp_iam_machine_user_resource_role_assignment.example.machine_user +} + +output "resource_role_crn" { + value = cdp_iam_machine_user_resource_role_assignment.example.resource_role_crn +} diff --git a/examples/resources/cdp_iam_machine_user_role_assignment/resource.tf b/examples/resources/cdp_iam_machine_user_role_assignment/resource.tf index d7bf13c9..87979963 100644 --- a/examples/resources/cdp_iam_machine_user_role_assignment/resource.tf +++ b/examples/resources/cdp_iam_machine_user_role_assignment/resource.tf @@ -9,12 +9,12 @@ # permissions and limitations governing your use of the file. resource "cdp_iam_machine_user_role_assignment" "example" { - machine_use = "example" - role = "some-role" + machine_user = "example" + role = "some-role" } output "machine_use" { - value = cdp_iam_machine_user_role_assignment.example.machine_use + value = cdp_iam_machine_user_role_assignment.example.machine_user } output "role" { diff --git a/examples/resources/cdp_operational_database/with_all_parameters/resource.tf b/examples/resources/cdp_operational_database/with_all_parameters/resource.tf index cc0b0c8d..91182c13 100644 --- a/examples/resources/cdp_operational_database/with_all_parameters/resource.tf +++ b/examples/resources/cdp_operational_database/with_all_parameters/resource.tf @@ -25,17 +25,17 @@ resource "cdp_operational_database" "opdb" { environment_name = "" database_name = "" - scale_type = "HEAVY" // valid options are "MICRO","LIGHT","HEAVY" - storage_type = "CLOUD_WITH_EPHEMERAL" // valid options are "CLOUD_WITH_EPHEMERAL","CLOUD","HDFS" + scale_type = "HEAVY" // valid options are "MICRO","LIGHT","HEAVY" + storage_type = "CLOUD_WITH_EPHEMERAL" // valid options are "CLOUD_WITH_EPHEMERAL","CLOUD","HDFS" java_version = 8 disable_external_db = true disable_multi_az = true - subnet_id = "" + subnet_id = "" - num_edge_nodes = 1 + num_edge_nodes = 1 auto_scaling_parameters = { targeted_value_for_metric = 249 diff --git a/provider/provider.go b/provider/provider.go index 0c46619e..fb9fbac9 100644 --- a/provider/provider.go +++ b/provider/provider.go @@ -234,6 +234,7 @@ func (p *CdpProvider) Resources(_ context.Context) []func() resource.Resource { datalake.NewAzureDatalakeResource, datalake.NewGcpDatalakeResource, iam.NewGroupResource, + iam.NewMachineUserGroupAssignmentResource, iam.NewMachineUserRoleAssignmentResource, iam.NewMachineUserResourceRoleAssignmentResource, iam.NewMachineUserResource, diff --git a/provider/provider_test.go b/provider/provider_test.go index bdc8a0f0..cffb8c3a 100644 --- a/provider/provider_test.go +++ b/provider/provider_test.go @@ -621,6 +621,7 @@ func TestCdpProvider_Resources(t *testing.T) { datalake.NewGcpDatalakeResource, iam.NewGroupResource, iam.NewMachineUserResource, + iam.NewMachineUserGroupAssignmentResource, iam.NewMachineUserRoleAssignmentResource, iam.NewMachineUserResourceRoleAssignmentResource, datahub.NewAwsDatahubResource, diff --git a/resources/iam/model_machine_user.go b/resources/iam/model_machine_user.go index 9efd6844..3c71cef6 100644 --- a/resources/iam/model_machine_user.go +++ b/resources/iam/model_machine_user.go @@ -17,6 +17,7 @@ type machineUserResourceModel struct { Name types.String `tfsdk:"name"` Status types.String `tfsdk:"status"` WorkloadUsername types.String `tfsdk:"workload_username"` + WorkloadPassword types.String `tfsdk:"workload_password"` CreationDate types.String `tfsdk:"creation_date"` WorkloadPasswordDetails types.Object `tfsdk:"workload_password_details"` AzureCloudIdentities types.Set `tfsdk:"azure_cloud_identities"` diff --git a/resources/iam/model_machine_user_group_assignment.go b/resources/iam/model_machine_user_group_assignment.go index ad51a348..b23c070f 100644 --- a/resources/iam/model_machine_user_group_assignment.go +++ b/resources/iam/model_machine_user_group_assignment.go @@ -13,7 +13,7 @@ package iam import "github.com/hashicorp/terraform-plugin-framework/types" type machineUserGroupAssignmentResourceModel struct { - Id types.String `tfsdk:"id"` - MachineUserName types.String `tfsdk:"machine_user_name"` - GroupName types.String `tfsdk:"group_name"` + Id types.String `tfsdk:"id"` + MachineUser types.String `tfsdk:"machine_user"` + Group types.String `tfsdk:"group"` } diff --git a/resources/iam/resource_machine_user.go b/resources/iam/resource_machine_user.go index 2cfada3d..7931b820 100644 --- a/resources/iam/resource_machine_user.go +++ b/resources/iam/resource_machine_user.go @@ -14,9 +14,11 @@ import ( "context" "github.com/cloudera/terraform-provider-cdp/cdp-sdk-go/cdp" + "github.com/cloudera/terraform-provider-cdp/cdp-sdk-go/gen/iam/client" "github.com/cloudera/terraform-provider-cdp/cdp-sdk-go/gen/iam/client/operations" "github.com/cloudera/terraform-provider-cdp/cdp-sdk-go/gen/iam/models" "github.com/cloudera/terraform-provider-cdp/utils" + "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-log/tflog" ) @@ -70,11 +72,30 @@ func (r *machineUserResource) Create(ctx context.Context, req resource.CreateReq mu := responseOk.Payload.MachineUser muRespToModel(ctx, mu, &data) + if !data.WorkloadPassword.IsNull() { + err = setWorkloadPassword(ctx, client, data.Id.ValueString(), data.WorkloadPassword.ValueStringPointer(), &resp.Diagnostics) + if err != nil { + utils.AddIamDiagnosticsError(err, &resp.Diagnostics, "create Machine User") + return + } + } + // Save data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } } +func setWorkloadPassword(ctx context.Context, client *client.Iam, crn string, pw *string, diags *diag.Diagnostics) error { + pwparams := operations.NewSetWorkloadPasswordParamsWithContext(ctx) + pwparams.WithInput(&models.SetWorkloadPasswordRequest{ + ActorCrn: crn, + Password: pw, + }) + + _, err := client.Operations.SetWorkloadPassword(pwparams) + return err +} + func (r *machineUserResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { var data machineUserResourceModel @@ -85,7 +106,6 @@ func (r *machineUserResource) Read(ctx context.Context, req resource.ReadRequest return } - // Read API call logic client := r.client.Iam params := operations.NewListMachineUsersParamsWithContext(ctx) @@ -123,7 +143,26 @@ func (r *machineUserResource) Read(ctx context.Context, req resource.ReadRequest } func (r *machineUserResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - tflog.Warn(ctx, "Update operation is not implemented yet.") + var data machineUserResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + client := r.client.Iam + err := setWorkloadPassword(ctx, client, data.Id.ValueString(), data.WorkloadPassword.ValueStringPointer(), &resp.Diagnostics) + if err != nil { + utils.AddIamDiagnosticsError(err, &resp.Diagnostics, "update Machine User") + return + } + + resp.Diagnostics.Append(resp.State.Set(ctx, data)...) + if resp.Diagnostics.HasError() { + return + } } func (r *machineUserResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { diff --git a/resources/iam/resource_machine_user_group_assignment.go b/resources/iam/resource_machine_user_group_assignment.go index 2bd6a3e3..d95fb043 100644 --- a/resources/iam/resource_machine_user_group_assignment.go +++ b/resources/iam/resource_machine_user_group_assignment.go @@ -58,8 +58,8 @@ func (r *machineUserGroupAssignmentResource) Create(ctx context.Context, req res params := operations.NewAddMachineUserToGroupParamsWithContext(ctx) params.WithInput(&models.AddMachineUserToGroupRequest{ - MachineUserName: data.MachineUserName.ValueStringPointer(), - GroupName: data.GroupName.ValueStringPointer(), + MachineUserName: data.MachineUser.ValueStringPointer(), + GroupName: data.Group.ValueStringPointer(), }) responseOk, err := client.Operations.AddMachineUserToGroup(params) @@ -69,7 +69,7 @@ func (r *machineUserGroupAssignmentResource) Create(ctx context.Context, req res } if responseOk.Payload != nil { - data.Id = types.StringValue(data.MachineUserName.ValueString() + "_" + data.GroupName.ValueString()) + data.Id = types.StringValue(data.MachineUser.ValueString() + "_" + data.Group.ValueString()) // Save data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) @@ -91,7 +91,7 @@ func (r *machineUserGroupAssignmentResource) Read(ctx context.Context, req resou params := operations.NewListGroupsForMachineUserParamsWithContext(ctx) params.WithInput(&models.ListGroupsForMachineUserRequest{ - MachineUserName: data.MachineUserName.ValueStringPointer(), + MachineUserName: data.MachineUser.ValueStringPointer(), }) responseOk, err := client.Operations.ListGroupsForMachineUser(params) @@ -105,7 +105,7 @@ func (r *machineUserGroupAssignmentResource) Read(ctx context.Context, req resou grParams := operations.NewListGroupsParamsWithContext(ctx) grParams.WithInput(&models.ListGroupsRequest{ - GroupNames: []string{data.GroupName.ValueString()}, + GroupNames: []string{data.Group.ValueString()}, }) grRespOk, err := client.Operations.ListGroups(grParams) @@ -161,8 +161,8 @@ func (r *machineUserGroupAssignmentResource) Delete(ctx context.Context, req res params := operations.NewRemoveMachineUserFromGroupParamsWithContext(ctx) params.WithInput(&models.RemoveMachineUserFromGroupRequest{ - MachineUserName: data.MachineUserName.ValueStringPointer(), - GroupName: data.GroupName.ValueStringPointer(), + MachineUserName: data.MachineUser.ValueStringPointer(), + GroupName: data.Group.ValueStringPointer(), }) _, err := client.Operations.RemoveMachineUserFromGroup(params) diff --git a/resources/iam/resource_machine_user_group_assignment_test.go b/resources/iam/resource_machine_user_group_assignment_test.go index 715c3eb6..b19c0fd1 100644 --- a/resources/iam/resource_machine_user_group_assignment_test.go +++ b/resources/iam/resource_machine_user_group_assignment_test.go @@ -53,8 +53,8 @@ func TestAccIamMachineUserGroupAssignment_basic(t *testing.T) { func testAccIamMachineUserGroupAssignmentConfig(rName string, grName string) string { return fmt.Sprintf(` resource "cdp_iam_machine_user_group_assignment" "test" { - machine_user_name = %[1]q - group_name = %[2]q + machine_user = %[1]q + group = %[2]q } `, rName, grName) } diff --git a/resources/iam/resource_machine_user_resource_role_assignment.go b/resources/iam/resource_machine_user_resource_role_assignment.go index f7e64f03..8fad5794 100644 --- a/resources/iam/resource_machine_user_resource_role_assignment.go +++ b/resources/iam/resource_machine_user_resource_role_assignment.go @@ -38,7 +38,7 @@ func (r *machineUserResourceRoleAssignmentResource) Schema(_ context.Context, _ } func (r *machineUserResourceRoleAssignmentResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_machine_user_resource_role_assignment" + resp.TypeName = req.ProviderTypeName + "_iam_machine_user_resource_role_assignment" } func (r *machineUserResourceRoleAssignmentResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { diff --git a/resources/iam/resource_machine_user_role_assignment.go b/resources/iam/resource_machine_user_role_assignment.go index b77cc28f..c9d40199 100644 --- a/resources/iam/resource_machine_user_role_assignment.go +++ b/resources/iam/resource_machine_user_role_assignment.go @@ -38,7 +38,7 @@ func (r *machineUserRoleAssignmentResource) Schema(_ context.Context, _ resource } func (r *machineUserRoleAssignmentResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_machine_user_role_assignment" + resp.TypeName = req.ProviderTypeName + "_iam_machine_user_role_assignment" } func (r *machineUserRoleAssignmentResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { diff --git a/resources/iam/schema_machine_user.go b/resources/iam/schema_machine_user.go index 50e19661..6b77f1c3 100644 --- a/resources/iam/schema_machine_user.go +++ b/resources/iam/schema_machine_user.go @@ -10,7 +10,11 @@ package iam -import "github.com/hashicorp/terraform-plugin-framework/resource/schema" +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" +) var machineUserSchema = schema.Schema{ Attributes: map[string]schema.Attribute{ @@ -19,6 +23,9 @@ var machineUserSchema = schema.Schema{ }, "name": schema.StringAttribute{ Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, }, "status": schema.StringAttribute{ Computed: true, @@ -26,6 +33,10 @@ var machineUserSchema = schema.Schema{ "workload_username": schema.StringAttribute{ Computed: true, }, + "workload_password": schema.StringAttribute{ + Optional: true, + Sensitive: true, + }, "creation_date": schema.StringAttribute{ Computed: true, }, diff --git a/resources/iam/schema_macine_user_group_assignment.go b/resources/iam/schema_macine_user_group_assignment.go index 18bfdc02..12737857 100644 --- a/resources/iam/schema_macine_user_group_assignment.go +++ b/resources/iam/schema_macine_user_group_assignment.go @@ -17,10 +17,10 @@ var machineUserGroupAssignmentSchema = schema.Schema{ "id": schema.StringAttribute{ Computed: true, }, - "machine_user_name": schema.StringAttribute{ + "machine_user": schema.StringAttribute{ Required: true, }, - "group_name": schema.StringAttribute{ + "group": schema.StringAttribute{ Required: true, }, }, diff --git a/templates/data-sources/environments_keytab.md.tmpl b/templates/data-sources/environments_keytab.md.tmpl new file mode 100644 index 00000000..c971996d --- /dev/null +++ b/templates/data-sources/environments_keytab.md.tmpl @@ -0,0 +1,26 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "{{ index (split .Name "_") 1}}" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +{{ if .HasExample -}} +## Example Usage + +{{ tffile .ExampleFile }} +{{- end }} + +{{ .SchemaMarkdown | trimspace }} + +{{- if .HasImport }} +## Import + +Import is supported using the following syntax: + +{{codefile "shell" .ImportFile }} +{{- end }} \ No newline at end of file diff --git a/templates/resources/datahub_azure_cluster.md.tmpl b/templates/resources/datahub_azure_cluster.md.tmpl new file mode 100644 index 00000000..c971996d --- /dev/null +++ b/templates/resources/datahub_azure_cluster.md.tmpl @@ -0,0 +1,26 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "{{ index (split .Name "_") 1}}" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +{{ if .HasExample -}} +## Example Usage + +{{ tffile .ExampleFile }} +{{- end }} + +{{ .SchemaMarkdown | trimspace }} + +{{- if .HasImport }} +## Import + +Import is supported using the following syntax: + +{{codefile "shell" .ImportFile }} +{{- end }} \ No newline at end of file diff --git a/templates/resources/datahub_gcp_cluster.md.tmpl b/templates/resources/datahub_gcp_cluster.md.tmpl new file mode 100644 index 00000000..c971996d --- /dev/null +++ b/templates/resources/datahub_gcp_cluster.md.tmpl @@ -0,0 +1,26 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "{{ index (split .Name "_") 1}}" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +{{ if .HasExample -}} +## Example Usage + +{{ tffile .ExampleFile }} +{{- end }} + +{{ .SchemaMarkdown | trimspace }} + +{{- if .HasImport }} +## Import + +Import is supported using the following syntax: + +{{codefile "shell" .ImportFile }} +{{- end }} \ No newline at end of file diff --git a/templates/resources/datalake_gcp_datalake.md.tmpl b/templates/resources/datalake_gcp_datalake.md.tmpl new file mode 100644 index 00000000..c971996d --- /dev/null +++ b/templates/resources/datalake_gcp_datalake.md.tmpl @@ -0,0 +1,26 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "{{ index (split .Name "_") 1}}" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +{{ if .HasExample -}} +## Example Usage + +{{ tffile .ExampleFile }} +{{- end }} + +{{ .SchemaMarkdown | trimspace }} + +{{- if .HasImport }} +## Import + +Import is supported using the following syntax: + +{{codefile "shell" .ImportFile }} +{{- end }} \ No newline at end of file diff --git a/templates/resources/environments_azure_image_terms.md.tmpl b/templates/resources/environments_azure_image_terms.md.tmpl new file mode 100644 index 00000000..c971996d --- /dev/null +++ b/templates/resources/environments_azure_image_terms.md.tmpl @@ -0,0 +1,26 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "{{ index (split .Name "_") 1}}" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +{{ if .HasExample -}} +## Example Usage + +{{ tffile .ExampleFile }} +{{- end }} + +{{ .SchemaMarkdown | trimspace }} + +{{- if .HasImport }} +## Import + +Import is supported using the following syntax: + +{{codefile "shell" .ImportFile }} +{{- end }} \ No newline at end of file diff --git a/templates/resources/environments_gcp_credential.md.tmpl b/templates/resources/environments_gcp_credential.md.tmpl new file mode 100644 index 00000000..c971996d --- /dev/null +++ b/templates/resources/environments_gcp_credential.md.tmpl @@ -0,0 +1,26 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "{{ index (split .Name "_") 1}}" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +{{ if .HasExample -}} +## Example Usage + +{{ tffile .ExampleFile }} +{{- end }} + +{{ .SchemaMarkdown | trimspace }} + +{{- if .HasImport }} +## Import + +Import is supported using the following syntax: + +{{codefile "shell" .ImportFile }} +{{- end }} \ No newline at end of file diff --git a/templates/resources/environments_gcp_environment.md.tmpl b/templates/resources/environments_gcp_environment.md.tmpl new file mode 100644 index 00000000..c971996d --- /dev/null +++ b/templates/resources/environments_gcp_environment.md.tmpl @@ -0,0 +1,26 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "{{ index (split .Name "_") 1}}" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +{{ if .HasExample -}} +## Example Usage + +{{ tffile .ExampleFile }} +{{- end }} + +{{ .SchemaMarkdown | trimspace }} + +{{- if .HasImport }} +## Import + +Import is supported using the following syntax: + +{{codefile "shell" .ImportFile }} +{{- end }} \ No newline at end of file diff --git a/templates/resources/environments_proxy_configuration.md.tmpl b/templates/resources/environments_proxy_configuration.md.tmpl new file mode 100644 index 00000000..c971996d --- /dev/null +++ b/templates/resources/environments_proxy_configuration.md.tmpl @@ -0,0 +1,26 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "{{ index (split .Name "_") 1}}" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +{{ if .HasExample -}} +## Example Usage + +{{ tffile .ExampleFile }} +{{- end }} + +{{ .SchemaMarkdown | trimspace }} + +{{- if .HasImport }} +## Import + +Import is supported using the following syntax: + +{{codefile "shell" .ImportFile }} +{{- end }} \ No newline at end of file diff --git a/templates/resources/iam_machine_user.md.tmpl b/templates/resources/iam_machine_user.md.tmpl new file mode 100644 index 00000000..c971996d --- /dev/null +++ b/templates/resources/iam_machine_user.md.tmpl @@ -0,0 +1,26 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "{{ index (split .Name "_") 1}}" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +{{ if .HasExample -}} +## Example Usage + +{{ tffile .ExampleFile }} +{{- end }} + +{{ .SchemaMarkdown | trimspace }} + +{{- if .HasImport }} +## Import + +Import is supported using the following syntax: + +{{codefile "shell" .ImportFile }} +{{- end }} \ No newline at end of file diff --git a/templates/resources/iam_machine_user_group_assignment.md.tmpl b/templates/resources/iam_machine_user_group_assignment.md.tmpl new file mode 100644 index 00000000..c971996d --- /dev/null +++ b/templates/resources/iam_machine_user_group_assignment.md.tmpl @@ -0,0 +1,26 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "{{ index (split .Name "_") 1}}" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +{{ if .HasExample -}} +## Example Usage + +{{ tffile .ExampleFile }} +{{- end }} + +{{ .SchemaMarkdown | trimspace }} + +{{- if .HasImport }} +## Import + +Import is supported using the following syntax: + +{{codefile "shell" .ImportFile }} +{{- end }} \ No newline at end of file diff --git a/templates/resources/iam_machine_user_resource_role_assignment.md.tmpl b/templates/resources/iam_machine_user_resource_role_assignment.md.tmpl new file mode 100644 index 00000000..c971996d --- /dev/null +++ b/templates/resources/iam_machine_user_resource_role_assignment.md.tmpl @@ -0,0 +1,26 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "{{ index (split .Name "_") 1}}" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +{{ if .HasExample -}} +## Example Usage + +{{ tffile .ExampleFile }} +{{- end }} + +{{ .SchemaMarkdown | trimspace }} + +{{- if .HasImport }} +## Import + +Import is supported using the following syntax: + +{{codefile "shell" .ImportFile }} +{{- end }} \ No newline at end of file diff --git a/templates/resources/iam_machine_user_role_assignment.md.tmpl b/templates/resources/iam_machine_user_role_assignment.md.tmpl new file mode 100644 index 00000000..c971996d --- /dev/null +++ b/templates/resources/iam_machine_user_role_assignment.md.tmpl @@ -0,0 +1,26 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "{{ index (split .Name "_") 1}}" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +{{ if .HasExample -}} +## Example Usage + +{{ tffile .ExampleFile }} +{{- end }} + +{{ .SchemaMarkdown | trimspace }} + +{{- if .HasImport }} +## Import + +Import is supported using the following syntax: + +{{codefile "shell" .ImportFile }} +{{- end }} \ No newline at end of file