-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CDPCP-9881 - GCP Data Hub create/read/delete
- Loading branch information
Showing
15 changed files
with
1,032 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,7 +101,7 @@ jobs: | |
- name: Go Coverage | ||
uses: gwatts/[email protected] | ||
with: | ||
coverage-threshold: 7.4 # current (2023.10.10) state | ||
coverage-threshold: 9.0 # current (2023.08.12) | ||
cover-pkg: ./... | ||
ignore-pattern: | | ||
/cdp-sdk-go/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "cdp_datahub_gcp_cluster Resource - terraform-provider-cdp" | ||
subcategory: "" | ||
description: |- | ||
Creates an GCP Data hub cluster. | ||
--- | ||
|
||
# cdp_datahub_gcp_cluster (Resource) | ||
|
||
Creates an GCP Data hub cluster. | ||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `cluster_definition_name` (String) The name of the cluster definition. | ||
- `cluster_template_name` (String) The name of the cluster template. | ||
- `environment_name` (String) The name of the environment where the cluster will belong to. | ||
- `name` (String) The name of the cluster. | ||
|
||
### Optional | ||
|
||
- `destroy_options` (Attributes) Cluster deletion options. (see [below for nested schema](#nestedatt--destroy_options)) | ||
- `instance_group` (Attributes List) (see [below for nested schema](#nestedatt--instance_group)) | ||
- `polling_options` (Attributes) Polling related configuration options that could specify various values that will be used during CDP resource creation. (see [below for nested schema](#nestedatt--polling_options)) | ||
|
||
### Read-Only | ||
|
||
- `crn` (String) The CRN of the cluster. | ||
- `id` (String) The ID of this resource. | ||
- `status` (String) The last known state of the cluster | ||
|
||
<a id="nestedatt--destroy_options"></a> | ||
### Nested Schema for `destroy_options` | ||
|
||
Optional: | ||
|
||
- `force_delete_cluster` (Boolean) An indicator that will take place once the cluster termination will be performed. If it is true, that means if something would go sideways during termination, the operation will proceed, however in such a case no notification would come thus it is advisable to check the cloud provider if there are no leftover resources once the destroy is finished. | ||
|
||
|
||
<a id="nestedatt--instance_group"></a> | ||
### Nested Schema for `instance_group` | ||
|
||
Required: | ||
|
||
- `attached_volume_configuration` (Attributes List) Configuration regarding the attached volume to the specific instance group. (see [below for nested schema](#nestedatt--instance_group--attached_volume_configuration)) | ||
- `instance_group_name` (String) The name of the instance group. | ||
- `instance_group_type` (String) The type of the instance group. | ||
- `instance_type` (String) The cloud provider-side instance type. | ||
- `node_count` (Number) The cluster node count. Has to be greater or equal than 0 and less than 100,000. | ||
- `recovery_mode` (String) The type of the recovery mode. | ||
- `root_volume_size` (Number) The size of the root volume in GB | ||
|
||
Optional: | ||
|
||
- `recipes` (Set of String) The set of recipe names that are going to be applied on the given instance group. | ||
|
||
<a id="nestedatt--instance_group--attached_volume_configuration"></a> | ||
### Nested Schema for `instance_group.attached_volume_configuration` | ||
|
||
Required: | ||
|
||
- `volume_count` (Number) The number of volumes to be attached. | ||
- `volume_size` (Number) The size of the volume in GB. | ||
- `volume_type` (String) The - cloud provider - type of the volume. | ||
|
||
|
||
|
||
<a id="nestedatt--polling_options"></a> | ||
### Nested Schema for `polling_options` | ||
|
||
Optional: | ||
|
||
- `polling_timeout` (Number) Timeout value in minutes that specifies for how long should the polling go for resource creation/deletion. | ||
|
||
|
154 changes: 154 additions & 0 deletions
154
examples/resources/cdp_datahub_gcp_cluster/with_instance_groups/resource.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
// Copyright 2023 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_datahub_gcp_cluster" "gcp-cluster" { | ||
name = "<value>" | ||
environment_name = "<value>" | ||
cluster_template_name = "7.2.17 - Data Engineering: Apache Spark, Apache Hive, Apache Oozie" | ||
|
||
destroy_options = { | ||
force_delete_cluster = false | ||
} | ||
|
||
instance_group = [ | ||
{ | ||
node_count = 0 | ||
instance_group_name = "<value>" | ||
instance_group_type = "<value>" | ||
instance_type = "<value>" | ||
root_volume_size = 100 | ||
attached_volume_configuration = [ | ||
{ | ||
volume_size = 100 | ||
volume_count = 1 | ||
volume_type = "<value>" | ||
} | ||
] | ||
recovery_mode = "<value>" | ||
recipes = [] | ||
}, | ||
{ | ||
node_count = 1 | ||
instance_group_name = "<value>" | ||
instance_group_type = "<value>" | ||
instance_type = "<value>" | ||
root_volume_size = 100 | ||
attached_volume_configuration = [ | ||
{ | ||
volume_size = 100 | ||
volume_count = 1 | ||
volume_type = "<value>" | ||
} | ||
] | ||
recovery_mode = "<value>" | ||
recipes = [] | ||
}, | ||
{ | ||
node_count = 3 | ||
instance_group_name = "<value>" | ||
instance_group_type = "<value>" | ||
instance_type = "<value>" | ||
root_volume_size = 100 | ||
attached_volume_configuration = [ | ||
{ | ||
volume_size = 300 | ||
volume_count = 1 | ||
volume_type = "<value>" | ||
} | ||
] | ||
recovery_mode = "<value>" | ||
recipes = [] | ||
}, | ||
{ | ||
node_count = 3 | ||
instance_group_name = "<value>" | ||
instance_group_type = "<value>" | ||
instance_type = "<value>" | ||
root_volume_size = 100 | ||
attached_volume_configuration = [ | ||
{ | ||
volume_size = 300 | ||
volume_count = 1 | ||
volume_type = "<value>" | ||
} | ||
] | ||
recovery_mode = "<value>" | ||
recipes = [] | ||
} | ||
] | ||
} | ||
|
||
output "cluster" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.name | ||
} | ||
|
||
output "environment" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.environment_name | ||
} | ||
|
||
output "cluster_template" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.cluster_template_name | ||
} | ||
|
||
output "destroy_options" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.destroy_options | ||
} | ||
|
||
output "force_delete_cluster" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.destroy_options.force_delete_cluster | ||
} | ||
|
||
output "recipes" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.instance_group[*].recipes | ||
} | ||
|
||
output "instance_group" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.instance_group | ||
} | ||
|
||
output "node_count" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.instance_group[*].node_count | ||
} | ||
|
||
output "instance_group_name" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.instance_group[*].instance_group_name | ||
} | ||
|
||
output "instance_group_type" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.instance_group[*].instance_group_type | ||
} | ||
|
||
output "instance_type" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.instance_group[*].instance_type | ||
} | ||
|
||
output "root_volume_size" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.instance_group[*].root_volume_size | ||
} | ||
|
||
output "attached_volume_configuration" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.instance_group[*].attached_volume_configuration | ||
} | ||
|
||
output "volume_size" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.instance_group[*].attached_volume_configuration[*].volume_size | ||
} | ||
|
||
output "volume_count" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.instance_group[*].attached_volume_configuration[*].volume_count | ||
} | ||
|
||
output "volume_type" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.instance_group[*].attached_volume_configuration[*].volume_type | ||
} | ||
|
||
output "recovery_mode" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.instance_group[*].recovery_mode | ||
} |
44 changes: 44 additions & 0 deletions
44
examples/resources/cdp_datahub_gcp_cluster/with_templates/resource.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2023 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_datahub_gcp_cluster" "gcp-cluster" { | ||
name = "<value>" | ||
environment_name = "<value>" | ||
cluster_template_name = "7.2.17 - Data Engineering: Apache Spark, Apache Hive, Apache Oozie" | ||
cluster_definition_name = "7.2.17 - Data Engineering for Google Cloud" | ||
|
||
destroy_options = { | ||
force_delete_cluster = false | ||
} | ||
} | ||
|
||
output "cluster" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.name | ||
} | ||
|
||
output "environment_name" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.environment_name | ||
} | ||
|
||
output "cluster_template_name" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.cluster_template_name | ||
} | ||
|
||
output "cluster_definition_name" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.cluster_definition_name | ||
} | ||
|
||
output "destroy_options" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.destroy_options | ||
} | ||
|
||
output "force_delete_cluster" { | ||
value = cdp_datahub_gcp_cluster.gcp-cluster.destroy_options.force_delete_cluster | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.