mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-04 17:51:11 +00:00
Remove old-style Terraform examples (#2848)
Signed-off-by: Modular Magician <magic-modules@google.com>
This commit is contained in:
parent
54dd3ad6e4
commit
7fc6743a9d
99
google/resource_monitoring_alert_policy_generated_test.go
Normal file
99
google/resource_monitoring_alert_policy_generated_test.go
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This file is automatically generated by Magic Modules and manual
|
||||||
|
// changes will be clobbered when the file is regenerated.
|
||||||
|
//
|
||||||
|
// Please read more about how to change this file in
|
||||||
|
// .github/CONTRIBUTING.md.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
package google
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform/helper/acctest"
|
||||||
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
|
"github.com/hashicorp/terraform/terraform"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestAccMonitoringAlertPolicy_monitoringAlertPolicyBasicExample(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
context := map[string]interface{}{
|
||||||
|
"random_suffix": acctest.RandString(10),
|
||||||
|
}
|
||||||
|
|
||||||
|
resource.Test(t, resource.TestCase{
|
||||||
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Providers: testAccProviders,
|
||||||
|
CheckDestroy: testAccCheckMonitoringAlertPolicyDestroy,
|
||||||
|
Steps: []resource.TestStep{
|
||||||
|
{
|
||||||
|
Config: testAccMonitoringAlertPolicy_monitoringAlertPolicyBasicExample(context),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ResourceName: "google_monitoring_alert_policy.alert_policy",
|
||||||
|
ImportState: true,
|
||||||
|
ImportStateVerify: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func testAccMonitoringAlertPolicy_monitoringAlertPolicyBasicExample(context map[string]interface{}) string {
|
||||||
|
return Nprintf(`
|
||||||
|
resource "google_monitoring_alert_policy" "alert_policy" {
|
||||||
|
display_name = "My Alert Policy-%{random_suffix}"
|
||||||
|
combiner = "OR"
|
||||||
|
conditions = [
|
||||||
|
{
|
||||||
|
display_name = "test condition"
|
||||||
|
condition_threshold {
|
||||||
|
filter = "metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\""
|
||||||
|
duration = "60s"
|
||||||
|
comparison = "COMPARISON_GT"
|
||||||
|
aggregations = [
|
||||||
|
{
|
||||||
|
alignment_period = "60s"
|
||||||
|
per_series_aligner = "ALIGN_RATE"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
`, context)
|
||||||
|
}
|
||||||
|
|
||||||
|
func testAccCheckMonitoringAlertPolicyDestroy(s *terraform.State) error {
|
||||||
|
for name, rs := range s.RootModule().Resources {
|
||||||
|
if rs.Type != "google_monitoring_alert_policy" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(name, "data.") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
config := testAccProvider.Meta().(*Config)
|
||||||
|
|
||||||
|
url, err := replaceVarsForTest(rs, "https://monitoring.googleapis.com/v3/{{name}}")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = sendRequest(config, "GET", url, nil)
|
||||||
|
if err == nil {
|
||||||
|
return fmt.Errorf("MonitoringAlertPolicy still exists at %s", url)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -26,19 +26,20 @@ information, see Creating VLAN Attachments.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Example Usage
|
## Example Usage - Interconnect Attachment Basic
|
||||||
|
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
resource "google_compute_router" "foobar" {
|
resource "google_compute_interconnect_attachment" "on_prem" {
|
||||||
name = "my-router"
|
name = "on-prem-attachment"
|
||||||
network = "${google_compute_network.foobar.name}"
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "google_compute_interconnect_attachment" "default" {
|
|
||||||
name = "test-interconnect"
|
|
||||||
interconnect = "my-interconnect-id"
|
interconnect = "my-interconnect-id"
|
||||||
router = "${google_compute_router.foobar.self_link}"
|
router = "${google_compute_router.foobar.self_link}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "google_compute_router" "foobar" {
|
||||||
|
name = "router"
|
||||||
|
network = "${google_compute_network.foobar.name}"
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Argument Reference
|
## Argument Reference
|
||||||
|
@ -34,12 +34,17 @@ To get more information about AlertPolicy, see:
|
|||||||
* How-to Guides
|
* How-to Guides
|
||||||
* [Official Documentation](https://cloud.google.com/monitoring/alerts/)
|
* [Official Documentation](https://cloud.google.com/monitoring/alerts/)
|
||||||
|
|
||||||
## Example Usage
|
<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=monitoring_alert_policy_basic&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
|
||||||
|
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
## Example Usage - Monitoring Alert Policy Basic
|
||||||
|
|
||||||
|
|
||||||
### Basic Usage
|
|
||||||
```hcl
|
```hcl
|
||||||
resource "google_monitoring_alert_policy" "basic" {
|
resource "google_monitoring_alert_policy" "alert_policy" {
|
||||||
display_name = "Test Policy Basic"
|
display_name = "My Alert Policy"
|
||||||
combiner = "OR"
|
combiner = "OR"
|
||||||
conditions = [
|
conditions = [
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user