Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
7 changes: 3 additions & 4 deletions mmv1/products/compute/PreviewFeature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
name: 'PreviewFeature'
kind: 'compute#PreviewFeature'
description: |
Represents a single Google Compute Engine preview feature such as Alpha API access, which can be enabled or disabled for a project.
min_version: 'beta'
Represents a single Google Compute Engine preview feature such as Alpha API access, which can be enabled or unspecified for a project.
references:
guides:
'Use the Compute Engine alpha API': 'https://cloud.google.com/compute/docs/reference/rest/alpha'
api: 'https://cloud.google.com/compute/docs/reference/rest/beta/PreviewFeatures'
api: 'https://cloud.google.com/compute/docs/reference/rest/v1/PreviewFeatures'
docs:
base_url: 'projects/{{project}}/global/previewFeatures'
has_self_link: false
Expand Down Expand Up @@ -66,7 +65,7 @@ properties:
required: true
enum_values:
- 'ENABLED'
- 'DISABLED'
- 'UNSPECIFIED'
- name: 'rolloutOperation'
type: NestedObject
description: 'The rollout operation of the feature.'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
resource "google_compute_preview_feature" "{{ .PrimaryResourceId }}" {
provider = google-beta
name = "alpha-api-access"
activation_status = "DISABLED"
activation_status = "UNSPECIFIED"
rollout_operation {
rollout_input {
predefined_rollout_plan = "ROLLOUT_PLAN_FAST_ROLLOUT"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ package compute_test

import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-provider-google/google/acctest"
"testing"
)

func TestAccComputePreviewFeature_update(t *testing.T) {
Expand All @@ -20,12 +19,12 @@ func TestAccComputePreviewFeature_update(t *testing.T) {
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
Steps: []resource.TestStep{
// Step 1: Disable the "alpha-api-access" feature and verify its attributes.
// Step 1: Unspecify the "alpha-api-access" feature and verify its attributes.
{
Config: testAccComputePreviewFeature_disable(featureName),
Config: testAccComputePreviewFeature_unspecify(featureName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "name", featureName),
resource.TestCheckResourceAttr(resourceName, "activation_status", "DISABLED"),
resource.TestCheckResourceAttr(resourceName, "activation_status", "UNSPECIFIED"),
),
},
// Step 2: Verify that the resource can be successfully imported.
Expand All @@ -39,11 +38,11 @@ func TestAccComputePreviewFeature_update(t *testing.T) {
})
}

func testAccComputePreviewFeature_disable(name string) string {
func testAccComputePreviewFeature_unspecify(name string) string {
return fmt.Sprintf(`
resource "google_compute_preview_feature" "acceptance" {
name = "%s"
activation_status = "DISABLED"
activation_status = "UNSPECIFIED"

rollout_operation {
rollout_input {
Expand Down
Loading