|
| 1 | +// Copyright (c) HashiCorp, Inc. |
| 2 | +// SPDX-License-Identifier: MPL-2.0 |
| 3 | +// ---------------------------------------------------------------------------- |
| 4 | +// |
| 5 | +// *** AUTO GENERATED CODE *** Type: Handwritten *** |
| 6 | +// |
| 7 | +// ---------------------------------------------------------------------------- |
| 8 | +// |
| 9 | +// This code is generated by Magic Modules using the following: |
| 10 | +// |
| 11 | +// Source file: https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services/networkmanagement/resource_network_management_org_vpc_flow_logs_config_test.go.tmpl |
| 12 | +// |
| 13 | +// DO NOT EDIT this file directly. Any changes made to this file will be |
| 14 | +// overwritten during the next generation cycle. |
| 15 | +// |
| 16 | +// ---------------------------------------------------------------------------- |
| 17 | +package networkmanagement_test |
| 18 | + |
| 19 | +import ( |
| 20 | + "testing" |
| 21 | + |
| 22 | + "github.com/hashicorp/terraform-plugin-testing/helper/resource" |
| 23 | + "github.com/hashicorp/terraform-provider-google-beta/google-beta/acctest" |
| 24 | + "github.com/hashicorp/terraform-provider-google-beta/google-beta/envvar" |
| 25 | +) |
| 26 | + |
| 27 | +func TestAccNetworkManagementOrganizationVpcFlowLogsConfig_update(t *testing.T) { |
| 28 | + t.Parallel() |
| 29 | + |
| 30 | + context := map[string]interface{}{ |
| 31 | + "random_suffix": acctest.RandString(t, 10), |
| 32 | + "org_id": envvar.GetTestOrgFromEnv(t), |
| 33 | + } |
| 34 | + |
| 35 | + acctest.VcrTest(t, resource.TestCase{ |
| 36 | + PreCheck: func() { acctest.AccTestPreCheck(t) }, |
| 37 | + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), |
| 38 | + CheckDestroy: testAccCheckNetworkManagementVpcFlowLogsConfigDestroyProducer(t), |
| 39 | + Steps: []resource.TestStep{ |
| 40 | + { |
| 41 | + Config: testAccNetworkManagementOrganizationVpcFlowLogsConfig_basic(context), |
| 42 | + }, |
| 43 | + { |
| 44 | + ResourceName: "google_network_management_organization_vpc_flow_logs_config.org-test-update", |
| 45 | + ImportState: true, |
| 46 | + ImportStateVerify: true, |
| 47 | + ImportStateVerifyIgnore: []string{"organization", "location", "vpc_flow_logs_config_id"}, |
| 48 | + }, |
| 49 | + { |
| 50 | + Config: testAccNetworkManagementOrganizationVpcFlowLogsConfig_update(context), |
| 51 | + }, |
| 52 | + { |
| 53 | + ResourceName: "google_network_management_organization_vpc_flow_logs_config.org-test-update", |
| 54 | + ImportState: true, |
| 55 | + ImportStateVerify: true, |
| 56 | + ImportStateVerifyIgnore: []string{"organization", "location", "vpc_flow_logs_config_id"}, |
| 57 | + }, |
| 58 | + }, |
| 59 | + }) |
| 60 | +} |
| 61 | + |
| 62 | +func testAccNetworkManagementOrganizationVpcFlowLogsConfig_basic(context map[string]interface{}) string { |
| 63 | + return acctest.Nprintf(` |
| 64 | +resource "google_network_management_organization_vpc_flow_logs_config" "org-test-update" { |
| 65 | + provider = google-beta |
| 66 | + vpc_flow_logs_config_id = "tf-test-update-org-id-%{random_suffix}" |
| 67 | + organization = "%{org_id}" |
| 68 | + location = "global" |
| 69 | +} |
| 70 | +`, context) |
| 71 | +} |
| 72 | + |
| 73 | +func testAccNetworkManagementOrganizationVpcFlowLogsConfig_update(context map[string]interface{}) string { |
| 74 | + return acctest.Nprintf(` |
| 75 | +resource "google_network_management_organization_vpc_flow_logs_config" "org-test-update" { |
| 76 | + provider = google-beta |
| 77 | + vpc_flow_logs_config_id = "tf-test-update-org-id-%{random_suffix}" |
| 78 | + organization = "%{org_id}" |
| 79 | + location = "global" |
| 80 | +
|
| 81 | + state = "DISABLED" |
| 82 | + aggregation_interval = "INTERVAL_30_SEC" |
| 83 | + description = "This is an updated description" |
| 84 | + flow_sampling = 0.5 |
| 85 | + metadata = "EXCLUDE_ALL_METADATA" |
| 86 | + cross_project_metadata = "CROSS_PROJECT_METADATA_DISABLED" |
| 87 | +} |
| 88 | +`, context) |
| 89 | +} |
0 commit comments