Skip to content

Commit 24bde3c

Browse files
modular-magicianConnor Wilkes
andauthored
add datafusion versioning for terraform (#3734) (#2268)
* add datafusion versioning * Update tf version override in terraform.yml Co-authored-by: Connor Wilkes <[email protected]> Signed-off-by: Modular Magician <[email protected]> Co-authored-by: Connor Wilkes <[email protected]>
1 parent 997f130 commit 24bde3c

File tree

5 files changed

+28
-8
lines changed

5 files changed

+28
-8
lines changed

.changelog/3734.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
datafusion: changed `version` field to selectable in `google_data_fusion_instance` resource
3+
```

google-beta/resource_data_fusion_instance.go

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ able to access the public internet.`,
132132
ForceNew: true,
133133
Description: `The region of the Data Fusion instance.`,
134134
},
135+
"version": {
136+
Type: schema.TypeString,
137+
Computed: true,
138+
Optional: true,
139+
ForceNew: true,
140+
Description: `Current version of the Data Fusion.`,
141+
},
135142
"create_time": {
136143
Type: schema.TypeString,
137144
Computed: true,
@@ -168,11 +175,6 @@ able to access the public internet.`,
168175
Computed: true,
169176
Description: `The time the instance was last updated in RFC3339 UTC "Zulu" format, accurate to nanoseconds.`,
170177
},
171-
"version": {
172-
Type: schema.TypeString,
173-
Computed: true,
174-
Description: `Current version of the Data Fusion.`,
175-
},
176178
"project": {
177179
Type: schema.TypeString,
178180
Optional: true,
@@ -229,6 +231,12 @@ func resourceDataFusionInstanceCreate(d *schema.ResourceData, meta interface{})
229231
} else if v, ok := d.GetOkExists("options"); !isEmptyValue(reflect.ValueOf(optionsProp)) && (ok || !reflect.DeepEqual(v, optionsProp)) {
230232
obj["options"] = optionsProp
231233
}
234+
versionProp, err := expandDataFusionInstanceVersion(d.Get("version"), d, config)
235+
if err != nil {
236+
return err
237+
} else if v, ok := d.GetOkExists("version"); !isEmptyValue(reflect.ValueOf(versionProp)) && (ok || !reflect.DeepEqual(v, versionProp)) {
238+
obj["version"] = versionProp
239+
}
232240
privateInstanceProp, err := expandDataFusionInstancePrivateInstance(d.Get("private_instance"), d, config)
233241
if err != nil {
234242
return err
@@ -606,6 +614,10 @@ func expandDataFusionInstanceOptions(v interface{}, d TerraformResourceData, con
606614
return m, nil
607615
}
608616

617+
func expandDataFusionInstanceVersion(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
618+
return v, nil
619+
}
620+
609621
func expandDataFusionInstancePrivateInstance(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
610622
return v, nil
611623
}

google-beta/resource_data_fusion_instance_generated_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ resource "google_data_fusion_instance" "extended_instance" {
9090
network = "default"
9191
ip_allocation = "10.89.48.0/22"
9292
}
93+
version = "6.1.1"
9394
}
9495
`, context)
9596
}

google-beta/resource_data_fusion_instance_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ resource "google_data_fusion_instance" "foobar" {
4242
name = "%s"
4343
region = "us-central1"
4444
type = "BASIC"
45+
version = "6.1.1"
4546
}
4647
`, instanceName)
4748
}
@@ -59,6 +60,7 @@ resource "google_data_fusion_instance" "foobar" {
5960
label1 = "value1"
6061
label2 = "value2"
6162
}
63+
version = "6.1.1"
6264
}
6365
`, instanceName)
6466
}

website/docs/r/data_fusion_instance.html.markdown

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ resource "google_data_fusion_instance" "extended_instance" {
7474
network = "default"
7575
ip_allocation = "10.89.48.0/22"
7676
}
77+
version = "6.1.1"
7778
}
7879
```
7980

@@ -125,6 +126,10 @@ The following arguments are supported:
125126
(Optional)
126127
Map of additional options used to configure the behavior of Data Fusion instance.
127128

129+
* `version` -
130+
(Optional)
131+
Current version of the Data Fusion.
132+
128133
* `private_instance` -
129134
(Optional)
130135
Specifies whether the Data Fusion instance should be private. If set to
@@ -183,9 +188,6 @@ In addition to the arguments listed above, the following computed attributes are
183188
* `service_endpoint` -
184189
Endpoint on which the Data Fusion UI and REST APIs are accessible.
185190

186-
* `version` -
187-
Current version of the Data Fusion.
188-
189191
* `service_account` -
190192
Service account which will be used to access resources in the customer project.
191193

0 commit comments

Comments
 (0)