Skip to content

Commit 190de1a

Browse files
Use ExactlyOneOf for "content" and "source" (#6009) (#11663)
* Use ExactlyOneOf for "content" and "source" * gofmt Signed-off-by: Modular Magician <[email protected]>
1 parent 93a5e1b commit 190de1a

5 files changed

+26
-23
lines changed

.changelog/6009.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
storage: not specifying `content` or `source` for `google_storage_bucket_object` now fails at plan-time instead of apply-time.
3+
```

google/resource_clouddeploy_delivery_pipeline_generated_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ resource "google_clouddeploy_delivery_pipeline" "primary" {
6767
name = "tf-test-pipeline%{random_suffix}"
6868
6969
annotations = {
70-
my_second_annotation = "example-annotation-2"
71-
7270
my_first_annotation = "example-annotation-1"
71+
72+
my_second_annotation = "example-annotation-2"
7373
}
7474
7575
description = "basic description"
@@ -106,9 +106,9 @@ resource "google_clouddeploy_delivery_pipeline" "primary" {
106106
name = "tf-test-pipeline%{random_suffix}"
107107
108108
annotations = {
109-
my_third_annotation = "example-annotation-3"
110-
111109
my_second_annotation = "updated-example-annotation-2"
110+
111+
my_third_annotation = "example-annotation-3"
112112
}
113113
114114
description = "updated description"

google/resource_clouddeploy_target_generated_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ resource "google_clouddeploy_target" "primary" {
156156
name = "tf-test-target%{random_suffix}"
157157
158158
annotations = {
159-
my_second_annotation = "updated-example-annotation-2"
160-
161159
my_third_annotation = "example-annotation-3"
160+
161+
my_second_annotation = "updated-example-annotation-2"
162162
}
163163
164164
description = "updated description"
@@ -195,9 +195,9 @@ resource "google_clouddeploy_target" "primary" {
195195
name = "tf-test-target%{random_suffix}"
196196
197197
annotations = {
198-
my_second_annotation = "updated-example-annotation-2"
199-
200198
my_third_annotation = "example-annotation-3"
199+
200+
my_second_annotation = "updated-example-annotation-2"
201201
}
202202
203203
description = "updated description"
@@ -241,9 +241,9 @@ resource "google_clouddeploy_target" "primary" {
241241
name = "tf-test-target%{random_suffix}"
242242
243243
annotations = {
244-
my_third_annotation = "example-annotation-3"
245-
246244
my_second_annotation = "updated-example-annotation-2"
245+
246+
my_third_annotation = "example-annotation-3"
247247
}
248248
249249
description = "updated description"

google/resource_storage_bucket_object.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ func resourceStorageBucketObject() *schema.Resource {
8686
},
8787

8888
"content": {
89-
Type: schema.TypeString,
90-
Optional: true,
91-
ForceNew: true,
92-
ConflictsWith: []string{"source"},
93-
Sensitive: true,
94-
Description: `Data as string to be uploaded. Must be defined if source is not. Note: The content field is marked as sensitive. To view the raw contents of the object, please define an output.`,
89+
Type: schema.TypeString,
90+
Optional: true,
91+
ForceNew: true,
92+
ExactlyOneOf: []string{"source"},
93+
Sensitive: true,
94+
Description: `Data as string to be uploaded. Must be defined if source is not. Note: The content field is marked as sensitive. To view the raw contents of the object, please define an output.`,
9595
},
9696

9797
"crc32c": {
@@ -107,11 +107,11 @@ func resourceStorageBucketObject() *schema.Resource {
107107
},
108108

109109
"source": {
110-
Type: schema.TypeString,
111-
Optional: true,
112-
ForceNew: true,
113-
ConflictsWith: []string{"content"},
114-
Description: `A path to the data you want to upload. Must be defined if content is not.`,
110+
Type: schema.TypeString,
111+
Optional: true,
112+
ForceNew: true,
113+
ExactlyOneOf: []string{"content"},
114+
Description: `A path to the data you want to upload. Must be defined if content is not.`,
115115
},
116116

117117
// Detect changes to local file or changes made outside of Terraform to the file stored on the server.

website/docs/r/clouddeploy_delivery_pipeline.html.markdown

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ resource "google_clouddeploy_delivery_pipeline" "primary" {
3333
name = "pipeline"
3434
3535
annotations = {
36-
my_second_annotation = "example-annotation-2"
37-
3836
my_first_annotation = "example-annotation-1"
37+
38+
my_second_annotation = "example-annotation-2"
3939
}
4040
4141
description = "basic description"

0 commit comments

Comments
 (0)