Skip to content

Commit 91c0de1

Browse files
Added field graceful_decomissioning_timeout to resource dataproc_cluster (#4078) (#7485)
* Added field graceful_decomissioning_timeout to resource dataproc_cluster * formating * fix formatting concerns and removed api.yaml edits since resource is handwritten Signed-off-by: Modular Magician <magic-modules@google.com>
1 parent 3358ea2 commit 91c0de1

File tree

4 files changed

+32
-8
lines changed

4 files changed

+32
-8
lines changed

.changelog/4078.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
dataproc: Added `graceful_decomissioning_timeout` field to `dataproc_cluster` resource
3+
```

google/resource_dataproc_cluster.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,13 @@ func resourceDataprocCluster() *schema.Resource {
113113
Description: `The region in which the cluster and associated nodes will be created in. Defaults to global.`,
114114
},
115115

116+
"graceful_decommission_timeout": {
117+
Type: schema.TypeString,
118+
Optional: true,
119+
Default: "0s",
120+
Description: `The timeout duration which allows graceful decomissioning when you change the number of worker nodes directly through a terraform apply`,
121+
},
122+
116123
"labels": {
117124
Type: schema.TypeMap,
118125
Optional: true,
@@ -1125,9 +1132,13 @@ func resourceDataprocClusterUpdate(d *schema.ResourceData, meta interface{}) err
11251132
}
11261133

11271134
if len(updMask) > 0 {
1135+
gracefulDecommissionTimeout := d.Get("graceful_decommission_timeout").(string)
1136+
11281137
patch := config.NewDataprocBetaClient(userAgent).Projects.Regions.Clusters.Patch(
11291138
project, region, clusterName, cluster)
1130-
op, err := patch.UpdateMask(strings.Join(updMask, ",")).Do()
1139+
patch.GracefulDecommissionTimeout(gracefulDecommissionTimeout)
1140+
patch.UpdateMask(strings.Join(updMask, ","))
1141+
op, err := patch.Do()
11311142
if err != nil {
11321143
return err
11331144
}

google/resource_dataproc_cluster_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,7 @@ func testAccDataprocCluster_updatable(rnd string, w, p int) string {
11391139
resource "google_dataproc_cluster" "updatable" {
11401140
name = "tf-test-dproc-%s"
11411141
region = "us-central1"
1142+
graceful_decommission_timeout = "0.2s"
11421143
11431144
cluster_config {
11441145
master_config {
@@ -1462,7 +1463,7 @@ resource "google_dataproc_cluster" "basic" {
14621463
}
14631464
}
14641465
}
1465-
1466+
14661467
resource "google_dataproc_autoscaling_policy" "asp" {
14671468
policy_id = "tf-test-dataproc-policy-%s"
14681469
location = "us-central1"
@@ -1494,7 +1495,7 @@ resource "google_dataproc_cluster" "basic" {
14941495
}
14951496
}
14961497
}
1497-
1498+
14981499
resource "google_dataproc_autoscaling_policy" "asp" {
14991500
policy_id = "tf-test-dataproc-policy-%s"
15001501
location = "us-central1"

website/docs/r/dataproc_cluster.html.markdown

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ resource "google_dataproc_cluster" "simplecluster" {
3232
resource "google_dataproc_cluster" "mycluster" {
3333
name = "mycluster"
3434
region = "us-central1"
35+
graceful_decommission_timeout = "120s"
3536
labels = {
3637
foo = "bar"
3738
}
@@ -131,6 +132,14 @@ resource "google_dataproc_cluster" "accelerated_cluster" {
131132
* `cluster_config` - (Optional) Allows you to configure various aspects of the cluster.
132133
Structure defined below.
133134

135+
* `graceful_decommission_timout` - (Optional) Allows graceful decomissioning when you change the number of worker nodes directly through a terraform apply.
136+
Does not affect auto scaling decomissioning from an autoscaling policy.
137+
Graceful decommissioning allows removing nodes from the cluster without interrupting jobs in progress.
138+
Timeout specifies how long to wait for jobs in progress to finish before forcefully removing nodes (and potentially interrupting jobs).
139+
Default timeout is 0 (for forceful decommission), and the maximum allowed timeout is 1 day. (see JSON representation of
140+
[Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
141+
Only supported on Dataproc image versions 1.2 and higher.
142+
For more context see the [docs](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.clusters/patch#query-parameters)
134143
- - -
135144

136145
The `cluster_config` block supports:
@@ -240,10 +249,10 @@ The `cluster_config.gce_cluster_config` block supports:
240249
* `tags` - (Optional) The list of instance tags applied to instances in the cluster.
241250
Tags are used to identify valid sources or targets for network firewalls.
242251

243-
* `internal_ip_only` - (Optional) By default, clusters are not restricted to internal IP addresses,
244-
and will have ephemeral external IP addresses assigned to each instance. If set to true, all
245-
instances in the cluster will only have internal IP addresses. Note: Private Google Access
246-
(also known as `privateIpGoogleAccess`) must be enabled on the subnetwork that the cluster
252+
* `internal_ip_only` - (Optional) By default, clusters are not restricted to internal IP addresses,
253+
and will have ephemeral external IP addresses assigned to each instance. If set to true, all
254+
instances in the cluster will only have internal IP addresses. Note: Private Google Access
255+
(also known as `privateIpGoogleAccess`) must be enabled on the subnetwork that the cluster
247256
will be launched in.
248257

249258
* `metadata` - (Optional) A map of the Compute Engine metadata entries to add to all instances
@@ -436,7 +445,7 @@ cluster_config {
436445
a cluster. For a list of valid properties please see
437446
[Cluster properties](https://cloud.google.com/dataproc/docs/concepts/cluster-properties)
438447

439-
* `optional_components` - (Optional) The set of optional components to activate on the cluster.
448+
* `optional_components` - (Optional) The set of optional components to activate on the cluster.
440449
Accepted values are:
441450
* ANACONDA
442451
* DRUID

0 commit comments

Comments
 (0)