Skip to content

Commit 17f9966

Browse files
Add ignore_warnings to google_bigtable_app_profile create call (#4220) (#2716)
* Add to create call * add testcase to valid scenario is workign appropriately * use test config * update testcase with correct import name Signed-off-by: Modular Magician <[email protected]>
1 parent 160460e commit 17f9966

File tree

4 files changed

+96
-1
lines changed

4 files changed

+96
-1
lines changed

.changelog/4220.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
bigtable: added ignore_warnings flag to create call for `google_bigtable_app_profile`
3+
```

google-beta/resource_bigtable_app_profile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func resourceBigtableAppProfileCreate(d *schema.ResourceData, meta interface{})
145145
return err
146146
}
147147

148-
url, err := replaceVars(d, config, "{{BigtableBasePath}}projects/{{project}}/instances/{{instance}}/appProfiles?appProfileId={{app_profile_id}}")
148+
url, err := replaceVars(d, config, "{{BigtableBasePath}}projects/{{project}}/instances/{{instance}}/appProfiles?appProfileId={{app_profile_id}}&ignoreWarnings={{ignore_warnings}}")
149149
if err != nil {
150150
return err
151151
}

google-beta/resource_bigtable_app_profile_test.go

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,31 @@ func TestAccBigtableAppProfile_update(t *testing.T) {
4141
})
4242
}
4343

44+
func TestAccBigtableAppProfile_ignoreWarnings(t *testing.T) {
45+
// bigtable instance does not use the shared HTTP client, this test creates an instance
46+
skipIfVcr(t)
47+
t.Parallel()
48+
49+
instanceName := fmt.Sprintf("tf-test-%s", randString(t, 10))
50+
51+
vcrTest(t, resource.TestCase{
52+
PreCheck: func() { testAccPreCheck(t) },
53+
Providers: testAccProviders,
54+
CheckDestroy: testAccCheckBigtableAppProfileDestroyProducer(t),
55+
Steps: []resource.TestStep{
56+
{
57+
Config: testAccBigtableAppProfile_warningsProduced(instanceName),
58+
},
59+
{
60+
ResourceName: "google_bigtable_app_profile.gae-profile1",
61+
ImportState: true,
62+
ImportStateVerify: true,
63+
ImportStateVerifyIgnore: []string{"ignore_warnings"},
64+
},
65+
},
66+
})
67+
}
68+
4469
func testAccBigtableAppProfile_update1(instanceName string) string {
4570
return fmt.Sprintf(`
4671
resource "google_bigtable_instance" "instance" {
@@ -97,3 +122,67 @@ resource "google_bigtable_app_profile" "ap" {
97122
}
98123
`, instanceName, instanceName, instanceName)
99124
}
125+
126+
func testAccBigtableAppProfile_warningsProduced(instanceName string) string {
127+
return fmt.Sprintf(`
128+
resource "google_bigtable_instance" "instance" {
129+
name = "%s"
130+
instance_type = "PRODUCTION"
131+
cluster {
132+
cluster_id = "%s1"
133+
zone = "us-central1-b"
134+
num_nodes = 3
135+
}
136+
137+
cluster {
138+
cluster_id = "%s2"
139+
zone = "us-west1-a"
140+
num_nodes = 3
141+
}
142+
143+
cluster {
144+
cluster_id = "%s3"
145+
zone = "us-west1-b"
146+
num_nodes = 3
147+
}
148+
149+
deletion_protection = false
150+
}
151+
152+
resource "google_bigtable_app_profile" "gae-profile1" {
153+
instance = google_bigtable_instance.instance.id
154+
app_profile_id = "bigtableinstance-sample1"
155+
156+
single_cluster_routing {
157+
cluster_id = "%s1"
158+
allow_transactional_writes = true
159+
}
160+
161+
ignore_warnings = true
162+
}
163+
164+
resource "google_bigtable_app_profile" "gae-profile2" {
165+
instance = google_bigtable_instance.instance.id
166+
app_profile_id = "bigtableinstance-sample2"
167+
168+
single_cluster_routing {
169+
cluster_id = "%s2"
170+
allow_transactional_writes = true
171+
}
172+
173+
ignore_warnings = true
174+
}
175+
176+
resource "google_bigtable_app_profile" "gae-profile3" {
177+
instance = google_bigtable_instance.instance.id
178+
app_profile_id = "bigtableinstance-sample3"
179+
180+
single_cluster_routing {
181+
cluster_id = "%s3"
182+
allow_transactional_writes = true
183+
}
184+
185+
ignore_warnings = true
186+
}
187+
`, instanceName, instanceName, instanceName, instanceName, instanceName, instanceName, instanceName)
188+
}

website/docs/r/bigtable_app_profile.html.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ description: |-
2525
App profile is a configuration object describing how Cloud Bigtable should treat traffic from a particular end user application.
2626

2727

28+
To get more information about AppProfile, see:
29+
30+
* [API documentation](https://cloud.google.com/bigtable/docs/reference/admin/rest/v2/projects.instances.appProfiles)
2831

2932
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
3033
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=bigtable_app_profile_multicluster&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">

0 commit comments

Comments
 (0)