Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ignore_warnings to google_bigtable_app_profile create call #7806

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/4220.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
bigtable: added ignore_warnings flag to create call for `google_bigtable_app_profile`
```
2 changes: 1 addition & 1 deletion google/resource_bigtable_app_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func resourceBigtableAppProfileCreate(d *schema.ResourceData, meta interface{})
return err
}

url, err := replaceVars(d, config, "{{BigtableBasePath}}projects/{{project}}/instances/{{instance}}/appProfiles?appProfileId={{app_profile_id}}")
url, err := replaceVars(d, config, "{{BigtableBasePath}}projects/{{project}}/instances/{{instance}}/appProfiles?appProfileId={{app_profile_id}}&ignoreWarnings={{ignore_warnings}}")
if err != nil {
return err
}
Expand Down
89 changes: 89 additions & 0 deletions google/resource_bigtable_app_profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,31 @@ func TestAccBigtableAppProfile_update(t *testing.T) {
})
}

func TestAccBigtableAppProfile_ignoreWarnings(t *testing.T) {
// bigtable instance does not use the shared HTTP client, this test creates an instance
skipIfVcr(t)
t.Parallel()

instanceName := fmt.Sprintf("tf-test-%s", randString(t, 10))

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckBigtableAppProfileDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccBigtableAppProfile_warningsProduced(instanceName),
},
{
ResourceName: "google_bigtable_app_profile.gae-profile1",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"ignore_warnings"},
},
},
})
}

func testAccBigtableAppProfile_update1(instanceName string) string {
return fmt.Sprintf(`
resource "google_bigtable_instance" "instance" {
Expand Down Expand Up @@ -97,3 +122,67 @@ resource "google_bigtable_app_profile" "ap" {
}
`, instanceName, instanceName, instanceName)
}

func testAccBigtableAppProfile_warningsProduced(instanceName string) string {
return fmt.Sprintf(`
resource "google_bigtable_instance" "instance" {
name = "%s"
instance_type = "PRODUCTION"
cluster {
cluster_id = "%s1"
zone = "us-central1-b"
num_nodes = 3
}

cluster {
cluster_id = "%s2"
zone = "us-west1-a"
num_nodes = 3
}

cluster {
cluster_id = "%s3"
zone = "us-west1-b"
num_nodes = 3
}

deletion_protection = false
}

resource "google_bigtable_app_profile" "gae-profile1" {
instance = google_bigtable_instance.instance.id
app_profile_id = "bigtableinstance-sample1"

single_cluster_routing {
cluster_id = "%s1"
allow_transactional_writes = true
}

ignore_warnings = true
}

resource "google_bigtable_app_profile" "gae-profile2" {
instance = google_bigtable_instance.instance.id
app_profile_id = "bigtableinstance-sample2"

single_cluster_routing {
cluster_id = "%s2"
allow_transactional_writes = true
}

ignore_warnings = true
}

resource "google_bigtable_app_profile" "gae-profile3" {
instance = google_bigtable_instance.instance.id
app_profile_id = "bigtableinstance-sample3"

single_cluster_routing {
cluster_id = "%s3"
allow_transactional_writes = true
}

ignore_warnings = true
}
`, instanceName, instanceName, instanceName, instanceName, instanceName, instanceName, instanceName)
}
3 changes: 3 additions & 0 deletions website/docs/r/bigtable_app_profile.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ description: |-
App profile is a configuration object describing how Cloud Bigtable should treat traffic from a particular end user application.


To get more information about AppProfile, see:

* [API documentation](https://cloud.google.com/bigtable/docs/reference/admin/rest/v2/projects.instances.appProfiles)

<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<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">
Expand Down