[Terraform]: Apply gofmt -s to all files managed by MM (#2676)

<!-- This change is generated by MagicModules. -->
/cc @rileykarson
This commit is contained in:
The Magician 2018-12-14 12:51:11 -08:00 committed by Nathan McKinley
parent 593156e918
commit c605b0bc4b
172 changed files with 1482 additions and 1482 deletions

View File

@ -12,7 +12,7 @@ func TestAccDataSourceComputeLbIpRanges_basic(t *testing.T) {
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeLbIpRangesConfig,
Check: resource.ComposeTestCheckFunc(
resource.TestMatchResourceAttr("data.google_compute_lb_ip_ranges.some",

View File

@ -7,22 +7,22 @@ func dataSourceDnsManagedZone() *schema.Resource {
Read: dataSourceDnsManagedZoneRead,
Schema: map[string]*schema.Schema{
"dns_name": &schema.Schema{
"dns_name": {
Type: schema.TypeString,
Computed: true,
},
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
},
"description": &schema.Schema{
"description": {
Type: schema.TypeString,
Computed: true,
},
"name_servers": &schema.Schema{
"name_servers": {
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Schema{
@ -32,7 +32,7 @@ func dataSourceDnsManagedZone() *schema.Resource {
// Google Cloud DNS ManagedZone resources do not have a SelfLink attribute.
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
},

View File

@ -17,7 +17,7 @@ func TestAccDataSourceDnsManagedZone_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckDnsManagedZoneDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccDataSourceDnsManagedZone_basic(),
Check: testAccDataSourceDnsManagedZoneCheck("data.google_dns_managed_zone.qa", "google_dns_managed_zone.foo"),
},

View File

@ -13,15 +13,15 @@ func dataSourceGoogleActiveFolder() *schema.Resource {
Read: dataSourceGoogleActiveFolderRead,
Schema: map[string]*schema.Schema{
"parent": &schema.Schema{
"parent": {
Type: schema.TypeString,
Required: true,
},
"display_name": &schema.Schema{
"display_name": {
Type: schema.TypeString,
Required: true,
},
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Computed: true,
},

View File

@ -19,7 +19,7 @@ func TestAccDataSourceGoogleActiveFolder_default(t *testing.T) {
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccDataSourceGoogleActiveFolderConfig(parent, displayName),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceGoogleActiveFolderCheck("data.google_active_folder.my_folder", "google_folder.foobar"),
@ -39,7 +39,7 @@ func TestAccDataSourceGoogleActiveFolder_space(t *testing.T) {
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccDataSourceGoogleActiveFolderConfig(parent, displayName),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceGoogleActiveFolderCheck("data.google_active_folder.my_folder", "google_folder.foobar"),

View File

@ -19,33 +19,33 @@ func dataSourceGoogleComputeAddress() *schema.Resource {
Read: dataSourceGoogleComputeAddressRead,
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
},
"address": &schema.Schema{
"address": {
Type: schema.TypeString,
Computed: true,
},
"status": &schema.Schema{
"status": {
Type: schema.TypeString,
Computed: true,
},
"self_link": &schema.Schema{
"self_link": {
Type: schema.TypeString,
Computed: true,
},
"region": &schema.Schema{
"region": {
Type: schema.TypeString,
Computed: true,
Optional: true,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Computed: true,
Optional: true,

View File

@ -81,7 +81,7 @@ func TestAccDataSourceComputeAddress(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckDataSourceComputeAddressDestroy(rsFullName),
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccDataSourceComputeAddressConfig(rsName, dsName),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceComputeAddressCheck(dsFullName, rsFullName),

View File

@ -20,7 +20,7 @@ func TestAccDataSourceComputeBackendService_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccDataSourceComputeBackendService_basic(serviceName, checkName),
Check: testAccDataSourceComputeBackendServiceCheck("data.google_compute_backend_service.baz", "google_compute_backend_service.foobar"),
},

View File

@ -11,75 +11,75 @@ func dataSourceGoogleComputeForwardingRule() *schema.Resource {
Read: dataSourceGoogleComputeForwardingRuleRead,
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
},
"region": &schema.Schema{
"region": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"target": &schema.Schema{
"target": {
Type: schema.TypeString,
Computed: true,
},
"backend_service": &schema.Schema{
"backend_service": {
Type: schema.TypeString,
Computed: true,
},
"description": &schema.Schema{
"description": {
Type: schema.TypeString,
Computed: true,
},
"ip_address": &schema.Schema{
"ip_address": {
Type: schema.TypeString,
Computed: true,
},
"ip_protocol": &schema.Schema{
"ip_protocol": {
Type: schema.TypeString,
Computed: true,
},
"load_balancing_scheme": &schema.Schema{
"load_balancing_scheme": {
Type: schema.TypeString,
Computed: true,
},
"network": &schema.Schema{
"network": {
Type: schema.TypeString,
Computed: true,
},
"port_range": &schema.Schema{
"port_range": {
Type: schema.TypeString,
Computed: true,
},
"ports": &schema.Schema{
"ports": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeString},
Computed: true,
},
"self_link": &schema.Schema{
"self_link": {
Type: schema.TypeString,
Computed: true,
},
"subnetwork": &schema.Schema{
"subnetwork": {
Type: schema.TypeString,
Computed: true,
},

View File

@ -19,7 +19,7 @@ func TestAccDataSourceGoogleForwardingRule(t *testing.T) {
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccDataSourceGoogleForwardingRuleConfig(poolName, ruleName),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceGoogleForwardingRuleCheck("data.google_compute_forwarding_rule.my_forwarding_rule", "google_compute_forwarding_rule.foobar-fr"),

View File

@ -12,27 +12,27 @@ func dataSourceGoogleComputeGlobalAddress() *schema.Resource {
Read: dataSourceGoogleComputeGlobalAddressRead,
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
},
"address": &schema.Schema{
"address": {
Type: schema.TypeString,
Computed: true,
},
"status": &schema.Schema{
"status": {
Type: schema.TypeString,
Computed: true,
},
"self_link": &schema.Schema{
"self_link": {
Type: schema.TypeString,
Computed: true,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Computed: true,
Optional: true,

View File

@ -21,7 +21,7 @@ func TestAccDataSourceComputeGlobalAddress(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeGlobalAddressDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccDataSourceComputeGlobalAddressConfig(rsName, dsName),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceComputeGlobalAddressCheck(dsFullName, rsFullName),

View File

@ -19,7 +19,7 @@ func TestAccDataSourceComputeInstance_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccDataSourceComputeInstanceConfig(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceComputeInstanceCheck("data.google_compute_instance.bar", "google_compute_instance.foo"),

View File

@ -11,27 +11,27 @@ func dataSourceGoogleComputeNetwork() *schema.Resource {
Read: dataSourceGoogleComputeNetworkRead,
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
},
"description": &schema.Schema{
"description": {
Type: schema.TypeString,
Computed: true,
},
"gateway_ipv4": &schema.Schema{
"gateway_ipv4": {
Type: schema.TypeString,
Computed: true,
},
"self_link": &schema.Schema{
"self_link": {
Type: schema.TypeString,
Computed: true,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
},

View File

@ -17,7 +17,7 @@ func TestAccDataSourceGoogleNetwork(t *testing.T) {
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccDataSourceGoogleNetworkConfig(networkName),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceGoogleNetworkCheck("data.google_compute_network.my_network", "google_compute_network.foobar"),

View File

@ -15,7 +15,7 @@ func dataSourceGoogleComputeRegions() *schema.Resource {
return &schema.Resource{
Read: dataSourceGoogleComputeRegionsRead,
Schema: map[string]*schema.Schema{
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,

View File

@ -16,7 +16,7 @@ func TestAccDataSourceGoogleSslPolicy(t *testing.T) {
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccDataSourceGoogleSslPolicy(),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceGoogleSslPolicyCheck("data.google_compute_ssl_policy.ssl_policy", "google_compute_ssl_policy.foobar"),

View File

@ -13,58 +13,58 @@ func dataSourceGoogleComputeSubnetwork() *schema.Resource {
Read: dataSourceGoogleComputeSubnetworkRead,
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
},
"description": &schema.Schema{
"description": {
Type: schema.TypeString,
Computed: true,
},
"self_link": &schema.Schema{
"self_link": {
Type: schema.TypeString,
Computed: true,
},
"ip_cidr_range": &schema.Schema{
"ip_cidr_range": {
Type: schema.TypeString,
Computed: true,
},
"private_ip_google_access": &schema.Schema{
"private_ip_google_access": {
Type: schema.TypeBool,
Computed: true,
},
"secondary_ip_range": &schema.Schema{
"secondary_ip_range": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"range_name": &schema.Schema{
"range_name": {
Type: schema.TypeString,
Computed: true,
},
"ip_cidr_range": &schema.Schema{
"ip_cidr_range": {
Type: schema.TypeString,
Computed: true,
},
},
},
},
"network": &schema.Schema{
"network": {
Type: schema.TypeString,
Computed: true,
},
"gateway_address": &schema.Schema{
"gateway_address": {
Type: schema.TypeString,
Computed: true,
},
"region": &schema.Schema{
"region": {
Type: schema.TypeString,
Computed: true,
Optional: true,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Computed: true,
Optional: true,

View File

@ -16,7 +16,7 @@ func TestAccDataSourceGoogleSubnetwork(t *testing.T) {
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccDataSourceGoogleSubnetwork(),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceGoogleSubnetworkCheck("data.google_compute_subnetwork.my_subnetwork", "google_compute_subnetwork.foobar"),

View File

@ -12,34 +12,34 @@ func dataSourceGoogleComputeVpnGateway() *schema.Resource {
Read: dataSourceGoogleComputeVpnGatewayRead,
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
},
"region": &schema.Schema{
"region": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"description": &schema.Schema{
"description": {
Type: schema.TypeString,
Computed: true,
},
"self_link": &schema.Schema{
"self_link": {
Type: schema.TypeString,
Computed: true,
},
"network": &schema.Schema{
"network": {
Type: schema.TypeString,
Computed: true,
},

View File

@ -17,7 +17,7 @@ func TestAccDataSourceGoogleVpnGateway(t *testing.T) {
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccDataSourceGoogleVpnGatewayConfig(vpnGatewayName),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceGoogleVpnGatewayCheck("data.google_compute_vpn_gateway.my_vpn_gateway", "google_compute_vpn_gateway.foobar"),

View File

@ -19,7 +19,7 @@ func dataSourceGoogleComputeZones() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,

View File

@ -10,7 +10,7 @@ func dataSourceGoogleIamRole() *schema.Resource {
return &schema.Resource{
Read: dataSourceGoogleIamRoleRead,
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
},

View File

@ -14,15 +14,15 @@ func dataSourceGoogleKmsSecret() *schema.Resource {
return &schema.Resource{
Read: dataSourceGoogleKmsSecretRead,
Schema: map[string]*schema.Schema{
"crypto_key": &schema.Schema{
"crypto_key": {
Type: schema.TypeString,
Required: true,
},
"ciphertext": &schema.Schema{
"ciphertext": {
Type: schema.TypeString,
Required: true,
},
"plaintext": &schema.Schema{
"plaintext": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,

View File

@ -29,7 +29,7 @@ func TestAccKmsSecret_basic(t *testing.T) {
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testGoogleKmsCryptoKey_basic(projectId, projectOrg, projectBillingAccount, keyRingName, cryptoKeyName),
Check: func(s *terraform.State) error {
ciphertext, cryptoKeyId, err := testAccEncryptSecretDataWithCryptoKey(s, "google_kms_crypto_key.crypto_key", plaintext)
@ -43,7 +43,7 @@ func TestAccKmsSecret_basic(t *testing.T) {
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testGoogleKmsSecret_datasource(cryptoKeyId.terraformId(), ciphertext),
Check: resource.TestCheckResourceAttr("data.google_kms_secret.acceptance", "plaintext", plaintext),
},

View File

@ -93,7 +93,7 @@ func getCidrBlocks() (map[string][]string, error) {
dnsNetblock := dnsNetblockList[0]
dnsNetblockList[0] = ""
dnsNetblockList = dnsNetblockList[1:len(dnsNetblockList)]
dnsNetblockList = dnsNetblockList[1:]
response, err = netblock_request(dnsNetblock)

View File

@ -12,7 +12,7 @@ func TestAccDataSourceGoogleNetblockIpRanges_basic(t *testing.T) {
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccNetblockIpRangesConfig,
Check: resource.ComposeTestCheckFunc(
resource.TestMatchResourceAttr("data.google_netblock_ip_ranges.some",

View File

@ -11,28 +11,28 @@ func dataSourceGoogleServiceAccount() *schema.Resource {
return &schema.Resource{
Read: dataSourceGoogleServiceAccountRead,
Schema: map[string]*schema.Schema{
"account_id": &schema.Schema{
"account_id": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validateRFC1035Name(6, 30),
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
},
"email": &schema.Schema{
"email": {
Type: schema.TypeString,
Computed: true,
},
"unique_id": &schema.Schema{
"unique_id": {
Type: schema.TypeString,
Computed: true,
},
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Computed: true,
},
"display_name": &schema.Schema{
"display_name": {
Type: schema.TypeString,
Computed: true,
},

View File

@ -36,46 +36,46 @@ func dataSourceGoogleSignedUrl() *schema.Resource {
Read: dataSourceGoogleSignedUrlRead,
Schema: map[string]*schema.Schema{
"bucket": &schema.Schema{
"bucket": {
Type: schema.TypeString,
Required: true,
},
"content_md5": &schema.Schema{
"content_md5": {
Type: schema.TypeString,
Optional: true,
Default: "",
},
"content_type": &schema.Schema{
"content_type": {
Type: schema.TypeString,
Optional: true,
Default: "",
},
"credentials": &schema.Schema{
"credentials": {
Type: schema.TypeString,
Optional: true,
},
"duration": &schema.Schema{
"duration": {
Type: schema.TypeString,
Optional: true,
Default: "1h",
},
"extension_headers": &schema.Schema{
"extension_headers": {
Type: schema.TypeMap,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
ValidateFunc: validateExtensionHeaders,
},
"http_method": &schema.Schema{
"http_method": {
Type: schema.TypeString,
Optional: true,
Default: "GET",
ValidateFunc: validation.StringInSlice([]string{"GET", "HEAD", "PUT", "DELETE"}, true),
},
"path": &schema.Schema{
"path": {
Type: schema.TypeString,
Required: true,
},
"signed_url": &schema.Schema{
"signed_url": {
Type: schema.TypeString,
Computed: true,
},
@ -85,7 +85,7 @@ func dataSourceGoogleSignedUrl() *schema.Resource {
func validateExtensionHeaders(v interface{}, k string) (ws []string, errors []error) {
hdrMap := v.(map[string]interface{})
for k, _ := range hdrMap {
for k := range hdrMap {
if !strings.HasPrefix(strings.ToLower(k), "x-goog-") {
errors = append(errors, fmt.Errorf(
"extension_header (%s) not valid, header name must begin with 'x-goog-'", k))

View File

@ -106,7 +106,7 @@ func TestAccStorageSignedUrl_basic(t *testing.T) {
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testGoogleSignedUrlConfig,
Check: resource.ComposeTestCheckFunc(
testAccSignedUrlExists("data.google_storage_object_signed_url.blerg"),
@ -130,7 +130,7 @@ func TestAccStorageSignedUrl_accTest(t *testing.T) {
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccTestGoogleStorageObjectSignedURL(bucketName),
Check: resource.ComposeTestCheckFunc(
testAccSignedUrlRetrieval("data.google_storage_object_signed_url.story_url", nil),

View File

@ -9,13 +9,13 @@ import (
)
var IamPubsubSubscriptionSchema = map[string]*schema.Schema{
"subscription": &schema.Schema{
"subscription": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DiffSuppressFunc: compareSelfLinkOrResourceName,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,

View File

@ -10,13 +10,13 @@ import (
)
var IamPubsubTopicSchema = map[string]*schema.Schema{
"topic": &schema.Schema{
"topic": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DiffSuppressFunc: compareSelfLinkOrResourceName,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,

View File

@ -9,7 +9,7 @@ import (
)
var IamServiceAccountSchema = map[string]*schema.Schema{
"service_account_id": &schema.Schema{
"service_account_id": {
Type: schema.TypeString,
Required: true,
ForceNew: true,

View File

@ -9,7 +9,7 @@ import (
)
var IamStorageBucketSchema = map[string]*schema.Schema{
"bucket": &schema.Schema{
"bucket": {
Type: schema.TypeString,
Required: true,
ForceNew: true,

View File

@ -43,19 +43,19 @@ var schemaNodeConfig = &schema.Schema{
ValidateFunc: validation.StringInSlice([]string{"pd-standard", "pd-ssd"}, false),
},
"guest_accelerator": &schema.Schema{
"guest_accelerator": {
Type: schema.TypeList,
Optional: true,
Computed: true,
ForceNew: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"count": &schema.Schema{
"count": {
Type: schema.TypeInt,
Required: true,
ForceNew: true,
},
"type": &schema.Schema{
"type": {
Type: schema.TypeString,
Required: true,
ForceNew: true,

View File

@ -17,7 +17,7 @@ var mutexKV = mutexkv.NewMutexKV()
func Provider() terraform.ResourceProvider {
return &schema.Provider{
Schema: map[string]*schema.Schema{
"credentials": &schema.Schema{
"credentials": {
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
@ -28,7 +28,7 @@ func Provider() terraform.ResourceProvider {
ValidateFunc: validateCredentials,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
@ -39,7 +39,7 @@ func Provider() terraform.ResourceProvider {
}, nil),
},
"region": &schema.Schema{
"region": {
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
@ -49,7 +49,7 @@ func Provider() terraform.ResourceProvider {
}, nil),
},
"zone": &schema.Schema{
"zone": {
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{

View File

@ -26,19 +26,19 @@ func resourceAppEngineApplication() *schema.Resource {
),
Schema: map[string]*schema.Schema{
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ValidateFunc: validateProjectID(),
},
"auth_domain": &schema.Schema{
"auth_domain": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"location_id": &schema.Schema{
"location_id": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
@ -56,7 +56,7 @@ func resourceAppEngineApplication() *schema.Resource {
"australia-southeast1",
}, false),
},
"serving_status": &schema.Schema{
"serving_status": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{
@ -67,35 +67,35 @@ func resourceAppEngineApplication() *schema.Resource {
}, false),
Computed: true,
},
"feature_settings": &schema.Schema{
"feature_settings": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Elem: appEngineApplicationFeatureSettingsResource(),
},
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Computed: true,
},
"url_dispatch_rule": &schema.Schema{
"url_dispatch_rule": {
Type: schema.TypeList,
Computed: true,
Elem: appEngineApplicationURLDispatchRuleResource(),
},
"code_bucket": &schema.Schema{
"code_bucket": {
Type: schema.TypeString,
Computed: true,
},
"default_hostname": &schema.Schema{
"default_hostname": {
Type: schema.TypeString,
Computed: true,
},
"default_bucket": &schema.Schema{
"default_bucket": {
Type: schema.TypeString,
Computed: true,
},
"gcr_domain": &schema.Schema{
"gcr_domain": {
Type: schema.TypeString,
Computed: true,
},
@ -106,15 +106,15 @@ func resourceAppEngineApplication() *schema.Resource {
func appEngineApplicationURLDispatchRuleResource() *schema.Resource {
return &schema.Resource{
Schema: map[string]*schema.Schema{
"domain": &schema.Schema{
"domain": {
Type: schema.TypeString,
Computed: true,
},
"path": &schema.Schema{
"path": {
Type: schema.TypeString,
Computed: true,
},
"service": &schema.Schema{
"service": {
Type: schema.TypeString,
Computed: true,
},
@ -125,7 +125,7 @@ func appEngineApplicationURLDispatchRuleResource() *schema.Resource {
func appEngineApplicationFeatureSettingsResource() *schema.Resource {
return &schema.Resource{
Schema: map[string]*schema.Schema{
"split_health_checks": &schema.Schema{
"split_health_checks": {
Type: schema.TypeBool,
Optional: true,
},

View File

@ -121,7 +121,7 @@ func resourceBigQueryDataset() *schema.Resource {
// Labels: [Experimental] The labels associated with this dataset. You
// can use these to organize and group your datasets. You can set this
// property when inserting or updating a dataset.
"labels": &schema.Schema{
"labels": {
Type: schema.TypeMap,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
@ -131,35 +131,35 @@ func resourceBigQueryDataset() *schema.Resource {
// for one or more entities. You can set this property when inserting
// or updating a dataset in order to control who is allowed to access
// the data.
"access": &schema.Schema{
"access": {
Type: schema.TypeSet,
Optional: true,
// Computed because if unset, BQ adds 4 entries automatically
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"role": &schema.Schema{
"role": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"OWNER", "WRITER", "READER"}, false),
},
"domain": &schema.Schema{
"domain": {
Type: schema.TypeString,
Optional: true,
},
"group_by_email": &schema.Schema{
"group_by_email": {
Type: schema.TypeString,
Optional: true,
},
"special_group": &schema.Schema{
"special_group": {
Type: schema.TypeString,
Optional: true,
},
"user_by_email": &schema.Schema{
"user_by_email": {
Type: schema.TypeString,
Optional: true,
},
"view": &schema.Schema{
"view": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,

View File

@ -75,7 +75,7 @@ func resourceBigQueryTable() *schema.Resource {
// characters are allowed. Label values are optional. Label keys must
// start with a letter and each label in the list must have a different
// key.
"labels": &schema.Schema{
"labels": {
Type: schema.TypeMap,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
@ -94,7 +94,7 @@ func resourceBigQueryTable() *schema.Resource {
},
// View: [Optional] If specified, configures this table as a view.
"view": &schema.Schema{
"view": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
@ -121,7 +121,7 @@ func resourceBigQueryTable() *schema.Resource {
// TimePartitioning: [Experimental] If specified, configures time-based
// partitioning for this table.
"time_partitioning": &schema.Schema{
"time_partitioning": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,

View File

@ -31,13 +31,13 @@ func resourceCloudBuildTrigger() *schema.Resource {
SchemaVersion: 1,
Schema: map[string]*schema.Schema{
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"filename": &schema.Schema{
"filename": {
Type: schema.TypeString,
Optional: true,
ConflictsWith: []string{"build"},
@ -49,28 +49,28 @@ func resourceCloudBuildTrigger() *schema.Resource {
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"images": &schema.Schema{
"images": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"step": &schema.Schema{
"step": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Optional: true,
},
"args": &schema.Schema{
"args": {
Type: schema.TypeString,
Optional: true,
},
},
},
},
"tags": &schema.Schema{
"tags": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
@ -78,56 +78,56 @@ func resourceCloudBuildTrigger() *schema.Resource {
},
},
},
"description": &schema.Schema{
"description": {
Type: schema.TypeString,
Optional: true,
},
"substitutions": &schema.Schema{
"substitutions": {
Optional: true,
Type: schema.TypeMap,
Elem: &schema.Schema{Type: schema.TypeString},
},
"included_files": &schema.Schema{
"included_files": {
Optional: true,
Type: schema.TypeList,
MaxItems: 50,
ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"ignored_files": &schema.Schema{
"ignored_files": {
Optional: true,
Type: schema.TypeList,
MaxItems: 50,
ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"trigger_template": &schema.Schema{
"trigger_template": {
Optional: true,
Type: schema.TypeList,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"branch_name": &schema.Schema{
"branch_name": {
Type: schema.TypeString,
Optional: true,
},
"commit_sha": &schema.Schema{
"commit_sha": {
Type: schema.TypeString,
Optional: true,
},
"dir": &schema.Schema{
"dir": {
Type: schema.TypeString,
Optional: true,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
},
"repo_name": &schema.Schema{
"repo_name": {
Type: schema.TypeString,
Optional: true,
},
"tag_name": &schema.Schema{
"tag_name": {
Type: schema.TypeString,
Optional: true,
},

View File

@ -22,28 +22,28 @@ func TestAccCloudBuildTrigger_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckGoogleCloudBuildTriggerVersionsDestroyed,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testGoogleCloudBuildTrigger_basic(projectID, projectOrg, projectBillingAccount),
Check: resource.ComposeTestCheckFunc(
testAccCheckGoogleCloudBuildTriggerExists("google_cloudbuild_trigger.build_trigger"),
),
},
resource.TestStep{
{
ResourceName: "google_cloudbuild_trigger.build_trigger",
ImportState: true,
ImportStateVerify: true,
ImportStateIdPrefix: fmt.Sprintf("%s/", projectID),
},
resource.TestStep{
{
Config: testGoogleCloudBuildTrigger_updated(projectID, projectOrg, projectBillingAccount),
},
resource.TestStep{
{
ResourceName: "google_cloudbuild_trigger.build_trigger",
ImportState: true,
ImportStateVerify: true,
ImportStateIdPrefix: fmt.Sprintf("%s/", projectID),
},
resource.TestStep{
{
Config: testGoogleCloudBuildTrigger_removed(projectID, projectOrg, projectBillingAccount),
Check: resource.ComposeTestCheckFunc(
testAccCheckGoogleCloudBuildTriggerWasRemovedFromState("google_cloudbuild_trigger.build_trigger"),
@ -65,13 +65,13 @@ func TestAccCloudBuildTrigger_filename(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckGoogleCloudBuildTriggerVersionsDestroyed,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testGoogleCloudBuildTrigger_filename(projectID, projectOrg, projectBillingAccount),
Check: resource.ComposeTestCheckFunc(
testAccCheckGoogleCloudFilenameConfig("google_cloudbuild_trigger.filename_build_trigger"),
),
},
resource.TestStep{
{
Config: testGoogleCloudBuildTrigger_removed(projectID, projectOrg, projectBillingAccount),
Check: resource.ComposeTestCheckFunc(
testAccCheckGoogleCloudBuildTriggerWasRemovedFromState("google_cloudbuild_trigger.filename_build_trigger"),

View File

@ -30,30 +30,30 @@ func resourceCloudIoTRegistry() *schema.Resource {
},
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validateCloudIoTID,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"region": &schema.Schema{
"region": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"event_notification_config": &schema.Schema{
"event_notification_config": {
Type: schema.TypeMap,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"pubsub_topic_name": &schema.Schema{
"pubsub_topic_name": {
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: compareSelfLinkOrResourceName,
@ -61,12 +61,12 @@ func resourceCloudIoTRegistry() *schema.Resource {
},
},
},
"state_notification_config": &schema.Schema{
"state_notification_config": {
Type: schema.TypeMap,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"pubsub_topic_name": &schema.Schema{
"pubsub_topic_name": {
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: compareSelfLinkOrResourceName,
@ -74,13 +74,13 @@ func resourceCloudIoTRegistry() *schema.Resource {
},
},
},
"mqtt_config": &schema.Schema{
"mqtt_config": {
Type: schema.TypeMap,
Computed: true,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"mqtt_enabled_state": &schema.Schema{
"mqtt_enabled_state": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice(
@ -89,13 +89,13 @@ func resourceCloudIoTRegistry() *schema.Resource {
},
},
},
"http_config": &schema.Schema{
"http_config": {
Type: schema.TypeMap,
Computed: true,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"http_enabled_state": &schema.Schema{
"http_enabled_state": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice(
@ -104,24 +104,24 @@ func resourceCloudIoTRegistry() *schema.Resource {
},
},
},
"credentials": &schema.Schema{
"credentials": {
Type: schema.TypeList,
Optional: true,
MaxItems: 10,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"public_key_certificate": &schema.Schema{
"public_key_certificate": {
Type: schema.TypeMap,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"format": &schema.Schema{
"format": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice(
[]string{x509CertificatePEM}, false),
},
"certificate": &schema.Schema{
"certificate": {
Type: schema.TypeString,
Required: true,
},

View File

@ -19,7 +19,7 @@ func TestAccCloudIoTRegistry_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckCloudIoTRegistryDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccCloudIoTRegistry_basic(registryName),
Check: resource.ComposeTestCheckFunc(
testAccCloudIoTRegistryExists(
@ -45,7 +45,7 @@ func TestAccCloudIoTRegistry_extended(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckCloudIoTRegistryDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccCloudIoTRegistry_extended(registryName),
Check: resource.ComposeTestCheckFunc(
testAccCloudIoTRegistryExists(
@ -71,17 +71,17 @@ func TestAccCloudIoTRegistry_update(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckCloudIoTRegistryDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccCloudIoTRegistry_basic(registryName),
Check: resource.ComposeTestCheckFunc(
testAccCloudIoTRegistryExists(
"google_cloudiot_registry.foobar"),
),
},
resource.TestStep{
{
Config: testAccCloudIoTRegistry_extended(registryName),
},
resource.TestStep{
{
Config: testAccCloudIoTRegistry_basic(registryName),
},
{

View File

@ -16,10 +16,10 @@ func TestAccComputeAddress_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeAddressDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeAddress_basic(acctest.RandString(10)),
},
resource.TestStep{
{
ResourceName: "google_compute_address.foobar",
ImportState: true,
ImportStateVerify: true,
@ -36,10 +36,10 @@ func TestAccComputeAddress_networkTier(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeAddressDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeAddress_networkTier(acctest.RandString(10)),
},
resource.TestStep{
{
ResourceName: "google_compute_address.foobar",
ImportState: true,
ImportStateVerify: true,
@ -54,22 +54,22 @@ func TestAccComputeAddress_internal(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeAddressDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeAddress_internal(acctest.RandString(10)),
},
resource.TestStep{
{
ResourceName: "google_compute_address.internal",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
ResourceName: "google_compute_address.internal_with_subnet",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
ResourceName: "google_compute_address.internal_with_subnet_and_address",
ImportState: true,
ImportStateVerify: true,

View File

@ -22,16 +22,16 @@ func TestAccComputeAttachedDisk_basic(t *testing.T) {
// Check destroy isn't a good test here, see comment on testCheckAttachedDiskIsNowDetached
CheckDestroy: nil,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAttachedDiskResource(diskName, instanceName) + testAttachedDiskResourceAttachment(),
},
resource.TestStep{
{
ResourceName: "google_compute_attached_disk.test",
ImportStateId: importID,
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAttachedDiskResource(diskName, instanceName),
Check: resource.ComposeTestCheckFunc(
testCheckAttachedDiskIsNowDetached(instanceName, diskName),
@ -54,10 +54,10 @@ func TestAccComputeAttachedDisk_full(t *testing.T) {
// Check destroy isn't a good test here, see comment on testCheckAttachedDiskIsNowDetached
CheckDestroy: nil,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAttachedDiskResource(diskName, instanceName) + testAttachedDiskResourceAttachmentFull(),
},
resource.TestStep{
{
ResourceName: "google_compute_attached_disk.test",
ImportStateId: importID,
ImportState: true,
@ -81,10 +81,10 @@ func TestAccComputeAttachedDisk_region(t *testing.T) {
// Check destroy isn't a good test here, see comment on testCheckAttachedDiskIsNowDetached
CheckDestroy: nil,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAttachedDiskResource_region(diskName, instanceName),
},
resource.TestStep{
{
ResourceName: "google_compute_attached_disk.test",
ImportStateId: importID,
ImportState: true,
@ -107,7 +107,7 @@ func TestAccComputeAttachedDisk_count(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: nil,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAttachedDiskResourceCount(diskPrefix, instanceName, count),
Check: resource.ComposeTestCheckFunc(
testCheckAttachedDiskContainsManyDisks(instanceName, count),

View File

@ -26,7 +26,7 @@ func TestAccComputeAutoscaler_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeAutoscalerDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeAutoscaler_basic(it_name, tp_name, igm_name, autoscaler_name),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeAutoscalerExists(
@ -34,7 +34,7 @@ func TestAccComputeAutoscaler_basic(t *testing.T) {
),
},
resource.TestStep{
{
ResourceName: "google_compute_autoscaler.foobar",
ImportState: true,
ImportStateVerify: true,
@ -58,14 +58,14 @@ func TestAccComputeAutoscaler_update(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeAutoscalerDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeAutoscaler_basic(it_name, tp_name, igm_name, autoscaler_name),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeAutoscalerExists(
"google_compute_autoscaler.foobar", &ascaler),
),
},
resource.TestStep{
{
Config: testAccComputeAutoscaler_update(it_name, tp_name, igm_name, autoscaler_name),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeAutoscalerExists(
@ -91,11 +91,11 @@ func TestAccComputeAutoscaler_multicondition(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeAutoscalerDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeAutoscaler_multicondition(it_name, tp_name, igm_name, autoscaler_name),
Check: testAccCheckComputeAutoscalerMultifunction("google_compute_autoscaler.foobar"),
},
resource.TestStep{
{
ResourceName: "google_compute_autoscaler.foobar",
ImportState: true,
ImportStateVerify: true,

View File

@ -22,14 +22,14 @@ func TestAccComputeBackendBucket_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeBackendBucketDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeBackendBucket_basic(backendName, storageName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeBackendBucketExists(
"google_compute_backend_bucket.foobar", &svc),
),
},
resource.TestStep{
{
ResourceName: "google_compute_backend_bucket.foobar",
ImportState: true,
ImportStateVerify: true,
@ -55,14 +55,14 @@ func TestAccComputeBackendBucket_basicModified(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeBackendBucketDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeBackendBucket_basic(backendName, storageName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeBackendBucketExists(
"google_compute_backend_bucket.foobar", &svc),
),
},
resource.TestStep{
{
Config: testAccComputeBackendBucket_basicModified(
backendName, storageName, secondStorageName),
Check: resource.ComposeTestCheckFunc(
@ -119,7 +119,7 @@ func TestAccComputeBackendBucket_withCdnEnabled(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeBackendBucketDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeBackendBucket_withCdnEnabled(
backendName, storageName),
Check: resource.ComposeTestCheckFunc(

View File

@ -23,14 +23,14 @@ func resourceComputeBackendService() *schema.Resource {
SchemaVersion: 1,
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validateGCPName,
},
"health_checks": &schema.Schema{
"health_checks": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeString},
Set: selfLinkRelativePathHash,
@ -39,17 +39,17 @@ func resourceComputeBackendService() *schema.Resource {
MaxItems: 1,
},
"iap": &schema.Schema{
"iap": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"oauth2_client_id": &schema.Schema{
"oauth2_client_id": {
Type: schema.TypeString,
Required: true,
},
"oauth2_client_secret": &schema.Schema{
"oauth2_client_secret": {
Type: schema.TypeString,
Required: true,
Sensitive: true,
@ -64,48 +64,48 @@ func resourceComputeBackendService() *schema.Resource {
},
},
"backend": &schema.Schema{
"backend": {
Type: schema.TypeSet,
Optional: true,
Set: resourceGoogleComputeBackendServiceBackendHash,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"group": &schema.Schema{
"group": {
Type: schema.TypeString,
Optional: true,
DiffSuppressFunc: compareSelfLinkRelativePaths,
},
"balancing_mode": &schema.Schema{
"balancing_mode": {
Type: schema.TypeString,
Optional: true,
Default: "UTILIZATION",
},
"capacity_scaler": &schema.Schema{
"capacity_scaler": {
Type: schema.TypeFloat,
Optional: true,
Default: 1,
},
"description": &schema.Schema{
"description": {
Type: schema.TypeString,
Optional: true,
},
"max_rate": &schema.Schema{
"max_rate": {
Type: schema.TypeInt,
Optional: true,
},
"max_rate_per_instance": &schema.Schema{
"max_rate_per_instance": {
Type: schema.TypeFloat,
Optional: true,
},
"max_connections": &schema.Schema{
"max_connections": {
Type: schema.TypeInt,
Optional: true,
},
"max_connections_per_instance": &schema.Schema{
"max_connections_per_instance": {
Type: schema.TypeInt,
Optional: true,
},
"max_utilization": &schema.Schema{
"max_utilization": {
Type: schema.TypeFloat,
Optional: true,
Default: 0.8,
@ -114,38 +114,38 @@ func resourceComputeBackendService() *schema.Resource {
},
},
"cdn_policy": &schema.Schema{
"cdn_policy": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"cache_key_policy": &schema.Schema{
"cache_key_policy": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"include_host": &schema.Schema{
"include_host": {
Type: schema.TypeBool,
Optional: true,
},
"include_protocol": &schema.Schema{
"include_protocol": {
Type: schema.TypeBool,
Optional: true,
},
"include_query_string": &schema.Schema{
"include_query_string": {
Type: schema.TypeBool,
Optional: true,
},
"query_string_blacklist": &schema.Schema{
"query_string_blacklist": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
ConflictsWith: []string{"cdn_policy.0.cache_key_policy.query_string_whitelist"},
},
"query_string_whitelist": &schema.Schema{
"query_string_whitelist": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
@ -158,7 +158,7 @@ func resourceComputeBackendService() *schema.Resource {
},
},
"custom_request_headers": &schema.Schema{
"custom_request_headers": {
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
Type: schema.TypeSet,
Optional: true,
@ -166,72 +166,72 @@ func resourceComputeBackendService() *schema.Resource {
Set: schema.HashString,
},
"description": &schema.Schema{
"description": {
Type: schema.TypeString,
Optional: true,
},
"enable_cdn": &schema.Schema{
"enable_cdn": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"fingerprint": &schema.Schema{
"fingerprint": {
Type: schema.TypeString,
Computed: true,
},
"port_name": &schema.Schema{
"port_name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"protocol": &schema.Schema{
"protocol": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"region": &schema.Schema{
"region": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Removed: "region has been removed as it was never used. For internal load balancing, use google_compute_region_backend_service",
},
"security_policy": &schema.Schema{
"security_policy": {
Type: schema.TypeString,
Optional: true,
DiffSuppressFunc: compareSelfLinkOrResourceName,
},
"self_link": &schema.Schema{
"self_link": {
Type: schema.TypeString,
Computed: true,
},
"session_affinity": &schema.Schema{
"session_affinity": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"timeout_sec": &schema.Schema{
"timeout_sec": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"connection_draining_timeout_sec": &schema.Schema{
"connection_draining_timeout_sec": {
Type: schema.TypeInt,
Optional: true,
Default: 300,

View File

@ -24,14 +24,14 @@ func TestAccComputeBackendService_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeBackendService_basic(serviceName, checkName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeBackendServiceExists(
"google_compute_backend_service.foobar", &svc),
),
},
resource.TestStep{
{
Config: testAccComputeBackendService_basicModified(
serviceName, checkName, extraCheckName),
Check: resource.ComposeTestCheckFunc(
@ -39,7 +39,7 @@ func TestAccComputeBackendService_basic(t *testing.T) {
"google_compute_backend_service.foobar", &svc),
),
},
resource.TestStep{
{
ResourceName: "google_compute_backend_service.foobar",
ImportState: true,
ImportStateVerify: true,
@ -61,7 +61,7 @@ func TestAccComputeBackendService_withBackend(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeBackendService_withBackend(
serviceName, igName, itName, checkName, 10),
Check: resource.ComposeTestCheckFunc(
@ -69,7 +69,7 @@ func TestAccComputeBackendService_withBackend(t *testing.T) {
"google_compute_backend_service.lipsum", &svc),
),
},
resource.TestStep{
{
Config: testAccComputeBackendService_withBackend(
serviceName, igName, itName, checkName, 20),
Check: resource.ComposeTestCheckFunc(
@ -77,7 +77,7 @@ func TestAccComputeBackendService_withBackend(t *testing.T) {
"google_compute_backend_service.lipsum", &svc),
),
},
resource.TestStep{
{
ResourceName: "google_compute_backend_service.lipsum",
ImportState: true,
ImportStateVerify: true,
@ -107,7 +107,7 @@ func TestAccComputeBackendService_withBackendAndIAP(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeBackendService_withBackendAndIAP(
serviceName, igName, itName, checkName, 10),
Check: resource.ComposeTestCheckFunc(
@ -115,12 +115,12 @@ func TestAccComputeBackendService_withBackendAndIAP(t *testing.T) {
"google_compute_backend_service.lipsum", &svc),
),
},
resource.TestStep{
{
ResourceName: "google_compute_backend_service.lipsum",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAccComputeBackendService_withBackend(
serviceName, igName, itName, checkName, 10),
Check: resource.ComposeTestCheckFunc(
@ -155,7 +155,7 @@ func TestAccComputeBackendService_updatePreservesOptionalParameters(t *testing.T
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeBackendService_withSessionAffinity(
serviceName, checkName, "initial-description", "GENERATED_COOKIE"),
Check: resource.ComposeTestCheckFunc(
@ -163,7 +163,7 @@ func TestAccComputeBackendService_updatePreservesOptionalParameters(t *testing.T
"google_compute_backend_service.foobar", &svc),
),
},
resource.TestStep{
{
Config: testAccComputeBackendService_withSessionAffinity(
serviceName, checkName, "updated-description", "GENERATED_COOKIE"),
Check: resource.ComposeTestCheckFunc(
@ -191,14 +191,14 @@ func TestAccComputeBackendService_withConnectionDraining(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeBackendService_withConnectionDraining(serviceName, checkName, 10),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeBackendServiceExists(
"google_compute_backend_service.foobar", &svc),
),
},
resource.TestStep{
{
ResourceName: "google_compute_backend_service.foobar",
ImportState: true,
ImportStateVerify: true,
@ -223,14 +223,14 @@ func TestAccComputeBackendService_withConnectionDrainingAndUpdate(t *testing.T)
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeBackendService_withConnectionDraining(serviceName, checkName, 10),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeBackendServiceExists(
"google_compute_backend_service.foobar", &svc),
),
},
resource.TestStep{
{
Config: testAccComputeBackendService_basic(serviceName, checkName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeBackendServiceExists(
@ -257,14 +257,14 @@ func TestAccComputeBackendService_withHttpsHealthCheck(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeBackendService_withHttpsHealthCheck(serviceName, checkName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeBackendServiceExists(
"google_compute_backend_service.foobar", &svc),
),
},
resource.TestStep{
{
ResourceName: "google_compute_backend_service.foobar",
ImportState: true,
ImportStateVerify: true,
@ -285,14 +285,14 @@ func TestAccComputeBackendService_withCdnPolicy(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeBackendService_withCdnPolicy(serviceName, checkName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeBackendServiceExists(
"google_compute_backend_service.foobar", &svc),
),
},
resource.TestStep{
{
ResourceName: "google_compute_backend_service.foobar",
ImportState: true,
ImportStateVerify: true,
@ -314,7 +314,7 @@ func TestAccComputeBackendService_withSecurityPolicy(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeBackendService_withSecurityPolicy(serviceName, checkName, polName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeBackendServiceExists(
@ -450,7 +450,7 @@ func TestAccComputeBackendService_withCDNEnabled(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeBackendService_withCDNEnabled(
serviceName, checkName),
Check: resource.ComposeTestCheckFunc(
@ -478,7 +478,7 @@ func TestAccComputeBackendService_withSessionAffinity(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeBackendService_withSessionAffinity(
serviceName, checkName, "description", "CLIENT_IP"),
Check: resource.ComposeTestCheckFunc(
@ -486,7 +486,7 @@ func TestAccComputeBackendService_withSessionAffinity(t *testing.T) {
"google_compute_backend_service.foobar", &svc),
),
},
resource.TestStep{
{
Config: testAccComputeBackendService_withSessionAffinity(
serviceName, checkName, "description", "GENERATED_COOKIE"),
Check: resource.ComposeTestCheckFunc(
@ -516,7 +516,7 @@ func TestAccComputeBackendService_withMaxConnections(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeBackendService_withMaxConnections(
serviceName, igName, itName, checkName, 10),
Check: resource.ComposeTestCheckFunc(
@ -524,7 +524,7 @@ func TestAccComputeBackendService_withMaxConnections(t *testing.T) {
"google_compute_backend_service.lipsum", &svc),
),
},
resource.TestStep{
{
Config: testAccComputeBackendService_withMaxConnections(
serviceName, igName, itName, checkName, 20),
Check: resource.ComposeTestCheckFunc(
@ -532,7 +532,7 @@ func TestAccComputeBackendService_withMaxConnections(t *testing.T) {
"google_compute_backend_service.lipsum", &svc),
),
},
resource.TestStep{
{
ResourceName: "google_compute_backend_service.lipsum",
ImportState: true,
ImportStateVerify: true,
@ -559,7 +559,7 @@ func TestAccComputeBackendService_withMaxConnectionsPerInstance(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeBackendService_withMaxConnectionsPerInstance(
serviceName, igName, itName, checkName, 10),
Check: resource.ComposeTestCheckFunc(
@ -567,7 +567,7 @@ func TestAccComputeBackendService_withMaxConnectionsPerInstance(t *testing.T) {
"google_compute_backend_service.lipsum", &svc),
),
},
resource.TestStep{
{
Config: testAccComputeBackendService_withMaxConnectionsPerInstance(
serviceName, igName, itName, checkName, 20),
Check: resource.ComposeTestCheckFunc(
@ -575,7 +575,7 @@ func TestAccComputeBackendService_withMaxConnectionsPerInstance(t *testing.T) {
"google_compute_backend_service.lipsum", &svc),
),
},
resource.TestStep{
{
ResourceName: "google_compute_backend_service.lipsum",
ImportState: true,
ImportStateVerify: true,

View File

@ -388,7 +388,7 @@ func resourceComputeDisk() *schema.Resource {
DiffSuppressFunc: compareSelfLinkOrResourceName,
},
},
"disk_encryption_key_raw": &schema.Schema{
"disk_encryption_key_raw": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
@ -396,7 +396,7 @@ func resourceComputeDisk() *schema.Resource {
Removed: "Use disk_encryption_key.raw_key instead.",
},
"disk_encryption_key_sha256": &schema.Schema{
"disk_encryption_key_sha256": {
Type: schema.TypeString,
Computed: true,
Removed: "Use disk_encryption_key.sha256 instead.",

View File

@ -216,7 +216,7 @@ func TestAccComputeDisk_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeDiskDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeDisk_basic(diskName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeDiskExists(
@ -225,7 +225,7 @@ func TestAccComputeDisk_basic(t *testing.T) {
testAccCheckComputeDiskHasLabelFingerprint(&disk, "google_compute_disk.foobar"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_disk.foobar",
ImportState: true,
ImportStateVerify: true,
@ -242,7 +242,7 @@ func TestAccComputeDisk_timeout(t *testing.T) {
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeDisk_timeout(diskName),
ExpectError: regexp.MustCompile("timeout"),
},
@ -300,14 +300,14 @@ func TestAccComputeDisk_fromSnapshot(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeDiskDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeDisk_fromSnapshot(projectName, firstDiskName, snapshotName, diskName, "self_link"),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeDiskExists(
"google_compute_disk.seconddisk", getTestProjectFromEnv(), &disk),
),
},
resource.TestStep{
{
Config: testAccComputeDisk_fromSnapshot(projectName, firstDiskName, snapshotName, diskName, "name"),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeDiskExists(
@ -329,7 +329,7 @@ func TestAccComputeDisk_encryption(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeDiskDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeDisk_encryption(diskName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeDiskExists(
@ -354,7 +354,7 @@ func TestAccComputeDisk_deleteDetach(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeDiskDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeDisk_deleteDetach(instanceName, diskName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeDiskExists(
@ -365,7 +365,7 @@ func TestAccComputeDisk_deleteDetach(t *testing.T) {
// listed as attached to the disk; the instance is created after the
// disk. and the disk's properties aren't refreshed unless there's
// another step
resource.TestStep{
{
Config: testAccComputeDisk_deleteDetach(instanceName, diskName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeDiskExists(
@ -391,7 +391,7 @@ func TestAccComputeDisk_deleteDetachIGM(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeDiskDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeDisk_deleteDetachIGM(diskName, mgrName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeDiskExists(
@ -402,7 +402,7 @@ func TestAccComputeDisk_deleteDetachIGM(t *testing.T) {
// listed as attached to the disk; the instance is created after the
// disk. and the disk's properties aren't refreshed unless there's
// another step
resource.TestStep{
{
Config: testAccComputeDisk_deleteDetachIGM(diskName, mgrName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeDiskExists(
@ -412,7 +412,7 @@ func TestAccComputeDisk_deleteDetachIGM(t *testing.T) {
),
},
// Change the disk name to recreate the instances
resource.TestStep{
{
Config: testAccComputeDisk_deleteDetachIGM(diskName2, mgrName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeDiskExists(
@ -420,7 +420,7 @@ func TestAccComputeDisk_deleteDetachIGM(t *testing.T) {
),
},
// Add the extra step like before
resource.TestStep{
{
Config: testAccComputeDisk_deleteDetachIGM(diskName2, mgrName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeDiskExists(

View File

@ -36,7 +36,7 @@ func migrateFirewallStateV0toV1(is *terraform.InstanceState) (*terraform.Instanc
portCount := 0
newPorts := make(map[string]string)
keys := make([]string, len(is.Attributes))
for k, _ := range is.Attributes {
for k := range is.Attributes {
keys[idx] = k
idx++

View File

@ -26,7 +26,7 @@ func TestAccComputeFirewall_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeFirewallDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeFirewall_basic(networkName, firewallName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeFirewallExists(
@ -34,7 +34,7 @@ func TestAccComputeFirewall_basic(t *testing.T) {
testAccCheckComputeFirewallApiVersion(&firewall),
),
},
resource.TestStep{
{
ResourceName: "google_compute_firewall.foobar",
ImportState: true,
ImportStateVerify: true,
@ -55,7 +55,7 @@ func TestAccComputeFirewall_update(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeFirewallDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeFirewall_basic(networkName, firewallName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeFirewallExists(
@ -68,7 +68,7 @@ func TestAccComputeFirewall_update(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAccComputeFirewall_update(networkName, firewallName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeFirewallExists(
@ -83,7 +83,7 @@ func TestAccComputeFirewall_update(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAccComputeFirewall_basic(networkName, firewallName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeFirewallExists(
@ -142,7 +142,7 @@ func TestAccComputeFirewall_noSource(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeFirewallDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeFirewall_noSource(networkName, firewallName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeFirewallExists(
@ -150,7 +150,7 @@ func TestAccComputeFirewall_noSource(t *testing.T) {
testAccCheckComputeFirewallApiVersion(&firewall),
),
},
resource.TestStep{
{
ResourceName: "google_compute_firewall.foobar",
ImportState: true,
ImportStateVerify: true,
@ -171,7 +171,7 @@ func TestAccComputeFirewall_denied(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeFirewallDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeFirewall_denied(networkName, firewallName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeFirewallExists("google_compute_firewall.foobar", &firewall),
@ -179,7 +179,7 @@ func TestAccComputeFirewall_denied(t *testing.T) {
testAccCheckComputeFirewallApiVersion(&firewall),
),
},
resource.TestStep{
{
ResourceName: "google_compute_firewall.foobar",
ImportState: true,
ImportStateVerify: true,
@ -200,7 +200,7 @@ func TestAccComputeFirewall_egress(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeFirewallDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeFirewall_egress(networkName, firewallName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeFirewallExists("google_compute_firewall.foobar", &firewall),
@ -208,7 +208,7 @@ func TestAccComputeFirewall_egress(t *testing.T) {
testAccCheckComputeFirewallApiVersion(&firewall),
),
},
resource.TestStep{
{
ResourceName: "google_compute_firewall.foobar",
ImportState: true,
ImportStateVerify: true,
@ -235,7 +235,7 @@ func TestAccComputeFirewall_serviceAccounts(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeFirewallDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeFirewall_serviceAccounts(sourceSa, targetSa, networkName, firewallName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeFirewallExists("google_compute_firewall.foobar", &firewall),
@ -243,7 +243,7 @@ func TestAccComputeFirewall_serviceAccounts(t *testing.T) {
testAccCheckComputeFirewallApiVersion(&firewall),
),
},
resource.TestStep{
{
ResourceName: "google_compute_firewall.foobar",
ImportState: true,
ImportStateVerify: true,
@ -263,18 +263,18 @@ func TestAccComputeFirewall_disabled(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeFirewallDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeFirewall_disabled(networkName, firewallName),
},
resource.TestStep{
{
ResourceName: "google_compute_firewall.foobar",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAccComputeFirewall_basic(networkName, firewallName),
},
resource.TestStep{
{
ResourceName: "google_compute_firewall.foobar",
ImportState: true,
ImportStateVerify: true,

View File

@ -19,18 +19,18 @@ func TestAccComputeForwardingRule_update(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeForwardingRuleDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeForwardingRule_basic(poolName, ruleName),
},
resource.TestStep{
{
ResourceName: "google_compute_forwarding_rule.foobar",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAccComputeForwardingRule_update(poolName, ruleName),
},
resource.TestStep{
{
ResourceName: "google_compute_forwarding_rule.foobar",
ImportState: true,
ImportStateVerify: true,
@ -50,10 +50,10 @@ func TestAccComputeForwardingRule_singlePort(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeForwardingRuleDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeForwardingRule_singlePort(poolName, ruleName),
},
resource.TestStep{
{
ResourceName: "google_compute_forwarding_rule.foobar",
ImportState: true,
ImportStateVerify: true,
@ -74,10 +74,10 @@ func TestAccComputeForwardingRule_ip(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeForwardingRuleDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeForwardingRule_ip(addrName, poolName, ruleName),
},
resource.TestStep{
{
ResourceName: "google_compute_forwarding_rule.foobar",
ImportState: true,
ImportStateVerify: true,
@ -100,15 +100,15 @@ func TestAccComputeForwardingRule_internalLoadBalancing(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeForwardingRuleDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeForwardingRule_internalLoadBalancing(serviceName, checkName, networkName, ruleName1, ruleName2),
},
resource.TestStep{
{
ResourceName: "google_compute_forwarding_rule.foobar",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
ResourceName: "google_compute_forwarding_rule.foobar2",
ImportState: true,
ImportStateVerify: true,
@ -128,11 +128,11 @@ func TestAccComputeForwardingRule_networkTier(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeForwardingRuleDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeForwardingRule_networkTier(poolName, ruleName),
},
resource.TestStep{
{
ResourceName: "google_compute_forwarding_rule.foobar",
ImportState: true,
ImportStateVerify: true,

View File

@ -21,7 +21,7 @@ func TestAccComputeGlobalAddress_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeGlobalAddressDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeGlobalAddress_basic(),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeGlobalAddressExists(
@ -31,7 +31,7 @@ func TestAccComputeGlobalAddress_basic(t *testing.T) {
testAccCheckComputeGlobalAddressIpVersion("google_compute_global_address.foobar", ""),
),
},
resource.TestStep{
{
ResourceName: "google_compute_global_address.foobar",
ImportState: true,
ImportStateVerify: true,
@ -50,7 +50,7 @@ func TestAccComputeGlobalAddress_ipv6(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeGlobalAddressDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeGlobalAddress_ipv6(),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeGlobalAddressExists(
@ -58,7 +58,7 @@ func TestAccComputeGlobalAddress_ipv6(t *testing.T) {
testAccCheckComputeGlobalAddressIpVersion("google_compute_global_address.foobar", "IPV6"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_global_address.foobar",
ImportState: true,
ImportStateVerify: true,

View File

@ -23,39 +23,39 @@ func resourceComputeGlobalForwardingRule() *schema.Resource {
},
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"target": &schema.Schema{
"target": {
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: compareSelfLinkRelativePaths,
},
"description": &schema.Schema{
"description": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"ip_address": &schema.Schema{
"ip_address": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},
"ip_protocol": &schema.Schema{
"ip_protocol": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},
"labels": &schema.Schema{
"labels": {
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
Type: schema.TypeMap,
Optional: true,
@ -63,41 +63,41 @@ func resourceComputeGlobalForwardingRule() *schema.Resource {
Set: schema.HashString,
},
"label_fingerprint": &schema.Schema{
"label_fingerprint": {
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
Type: schema.TypeString,
Computed: true,
},
"port_range": &schema.Schema{
"port_range": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
DiffSuppressFunc: portRangeDiffSuppress,
},
"ip_version": &schema.Schema{
"ip_version": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"IPV4", "IPV6"}, false),
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"region": &schema.Schema{
"region": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Removed: "Please remove this attribute (it was never used)",
},
"self_link": &schema.Schema{
"self_link": {
Type: schema.TypeString,
Computed: true,
},

View File

@ -26,7 +26,7 @@ func TestAccComputeGlobalForwardingRule_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeGlobalForwardingRuleDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeGlobalForwardingRule_basic1(fr, proxy1, proxy2, backend, hc, urlmap),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeGlobalForwardingRuleExists(
@ -36,7 +36,7 @@ func TestAccComputeGlobalForwardingRule_basic(t *testing.T) {
testAccCheckComputeBetaGlobalForwardingRuleIpVersion("google_compute_global_forwarding_rule.foobar", ""),
),
},
resource.TestStep{
{
ResourceName: "google_compute_global_forwarding_rule.foobar",
ImportState: true,
ImportStateVerify: true,
@ -60,7 +60,7 @@ func TestAccComputeGlobalForwardingRule_update(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeGlobalForwardingRuleDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeGlobalForwardingRule_basic1(fr, proxy1, proxy2, backend, hc, urlmap),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeGlobalForwardingRuleExists(
@ -68,7 +68,7 @@ func TestAccComputeGlobalForwardingRule_update(t *testing.T) {
),
},
resource.TestStep{
{
Config: testAccComputeGlobalForwardingRule_basic2(fr, proxy1, proxy2, backend, hc, urlmap),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeGlobalForwardingRuleExists(
@ -96,7 +96,7 @@ func TestAccComputeGlobalForwardingRule_ipv6(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeGlobalForwardingRuleDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeGlobalForwardingRule_ipv6(fr, proxy1, proxy2, backend, hc, urlmap),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeBetaGlobalForwardingRuleExists(
@ -104,7 +104,7 @@ func TestAccComputeGlobalForwardingRule_ipv6(t *testing.T) {
testAccCheckComputeBetaGlobalForwardingRuleIpVersion("google_compute_global_forwarding_rule.foobar", "IPV6"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_global_forwarding_rule.foobar",
ImportState: true,
ImportStateVerify: true,

View File

@ -23,7 +23,7 @@ func TestAccComputeHealthCheck_tcp(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeHealthCheckDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeHealthCheck_tcp(hckName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeHealthCheckExists(
@ -33,7 +33,7 @@ func TestAccComputeHealthCheck_tcp(t *testing.T) {
testAccCheckComputeHealthCheckTcpPort(80, &healthCheck),
),
},
resource.TestStep{
{
ResourceName: "google_compute_health_check.foobar",
ImportState: true,
ImportStateVerify: true,
@ -54,7 +54,7 @@ func TestAccComputeHealthCheck_tcp_update(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeHealthCheckDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeHealthCheck_tcp(hckName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeHealthCheckExists(
@ -64,7 +64,7 @@ func TestAccComputeHealthCheck_tcp_update(t *testing.T) {
testAccCheckComputeHealthCheckTcpPort(80, &healthCheck),
),
},
resource.TestStep{
{
Config: testAccComputeHealthCheck_tcp_update(hckName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeHealthCheckExists(
@ -90,7 +90,7 @@ func TestAccComputeHealthCheck_ssl(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeHealthCheckDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeHealthCheck_ssl(hckName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeHealthCheckExists(
@ -99,7 +99,7 @@ func TestAccComputeHealthCheck_ssl(t *testing.T) {
3, 3, &healthCheck),
),
},
resource.TestStep{
{
ResourceName: "google_compute_health_check.foobar",
ImportState: true,
ImportStateVerify: true,
@ -120,7 +120,7 @@ func TestAccComputeHealthCheck_http(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeHealthCheckDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeHealthCheck_http(hckName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeHealthCheckExists(
@ -129,7 +129,7 @@ func TestAccComputeHealthCheck_http(t *testing.T) {
3, 3, &healthCheck),
),
},
resource.TestStep{
{
ResourceName: "google_compute_health_check.foobar",
ImportState: true,
ImportStateVerify: true,
@ -150,7 +150,7 @@ func TestAccComputeHealthCheck_https(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeHealthCheckDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeHealthCheck_https(hckName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeHealthCheckExists(
@ -159,7 +159,7 @@ func TestAccComputeHealthCheck_https(t *testing.T) {
3, 3, &healthCheck),
),
},
resource.TestStep{
{
ResourceName: "google_compute_health_check.foobar",
ImportState: true,
ImportStateVerify: true,
@ -178,19 +178,19 @@ func TestAccComputeHealthCheck_typeTransition(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeHealthCheckDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeHealthCheck_https(hckName),
},
resource.TestStep{
{
Config: testAccComputeHealthCheck_http(hckName),
},
resource.TestStep{
{
Config: testAccComputeHealthCheck_ssl(hckName),
},
resource.TestStep{
{
Config: testAccComputeHealthCheck_tcp(hckName),
},
resource.TestStep{
{
Config: testAccComputeHealthCheck_https(hckName),
},
},
@ -207,7 +207,7 @@ func TestAccComputeHealthCheck_tcpAndSsl_shouldFail(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeHealthCheckDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeHealthCheck_tcpAndSsl_shouldFail(hckName),
ExpectError: regexp.MustCompile("conflicts with tcp_health_check"),
},

View File

@ -22,7 +22,7 @@ func TestAccComputeHttpHealthCheck_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeHttpHealthCheckDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeHttpHealthCheck_basic(hhckName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeHttpHealthCheckExists(
@ -33,7 +33,7 @@ func TestAccComputeHttpHealthCheck_basic(t *testing.T) {
3, 3, &healthCheck),
),
},
resource.TestStep{
{
ResourceName: "google_compute_http_health_check.foobar",
ImportState: true,
ImportStateVerify: true,
@ -54,7 +54,7 @@ func TestAccComputeHttpHealthCheck_update(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeHttpHealthCheckDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeHttpHealthCheck_update1(hhckName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeHttpHealthCheckExists(
@ -65,7 +65,7 @@ func TestAccComputeHttpHealthCheck_update(t *testing.T) {
2, 2, &healthCheck),
),
},
resource.TestStep{
{
Config: testAccComputeHttpHealthCheck_update2(hhckName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeHttpHealthCheckExists(

View File

@ -22,7 +22,7 @@ func TestAccComputeHttpsHealthCheck_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeHttpsHealthCheckDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeHttpsHealthCheck_basic(hhckName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeHttpsHealthCheckExists(
@ -33,7 +33,7 @@ func TestAccComputeHttpsHealthCheck_basic(t *testing.T) {
3, 3, &healthCheck),
),
},
resource.TestStep{
{
ResourceName: "google_compute_https_health_check.foobar",
ImportState: true,
ImportStateVerify: true,
@ -54,7 +54,7 @@ func TestAccComputeHttpsHealthCheck_update(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeHttpsHealthCheckDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeHttpsHealthCheck_update1(hhckName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeHttpsHealthCheckExists(
@ -65,7 +65,7 @@ func TestAccComputeHttpsHealthCheck_update(t *testing.T) {
2, 2, &healthCheck),
),
},
resource.TestStep{
{
Config: testAccComputeHttpsHealthCheck_update2(hhckName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeHttpsHealthCheckExists(

View File

@ -30,55 +30,55 @@ func resourceComputeImage() *schema.Resource {
Schema: map[string]*schema.Schema{
// TODO(cblecker): one of source_disk or raw_disk is required
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"description": &schema.Schema{
"description": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"family": &schema.Schema{
"family": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"source_disk": &schema.Schema{
"source_disk": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"raw_disk": &schema.Schema{
"raw_disk": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"source": &schema.Schema{
"source": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"sha1": &schema.Schema{
"sha1": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"container_type": &schema.Schema{
"container_type": {
Type: schema.TypeString,
Optional: true,
Default: "TAR",
@ -88,25 +88,25 @@ func resourceComputeImage() *schema.Resource {
},
},
"self_link": &schema.Schema{
"self_link": {
Type: schema.TypeString,
Computed: true,
},
"create_timeout": &schema.Schema{
"create_timeout": {
Type: schema.TypeInt,
Optional: true,
Removed: "Use timeouts block instead. See https://www.terraform.io/docs/configuration/resources.html#timeouts.",
},
"labels": &schema.Schema{
"labels": {
Type: schema.TypeMap,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
},
"licenses": &schema.Schema{
"licenses": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
@ -114,7 +114,7 @@ func resourceComputeImage() *schema.Resource {
Computed: true,
},
"label_fingerprint": &schema.Schema{
"label_fingerprint": {
Type: schema.TypeString,
Computed: true,
},

View File

@ -20,7 +20,7 @@ func TestAccComputeImage_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeImageDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeImage_basic("image-test-" + acctest.RandString(10)),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeImageExists(
@ -46,7 +46,7 @@ func TestAccComputeImage_withLicense(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeImageDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeImage_license("image-test-" + acctest.RandString(10)),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeImageExists(
@ -75,7 +75,7 @@ func TestAccComputeImage_update(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeImageDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeImage_basic(name),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeImageExists(
@ -85,7 +85,7 @@ func TestAccComputeImage_update(t *testing.T) {
testAccCheckComputeImageHasComputedFingerprint(&image, "google_compute_image.foobar"),
),
},
resource.TestStep{
{
Config: testAccComputeImage_update(name),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeImageExists(
@ -96,7 +96,7 @@ func TestAccComputeImage_update(t *testing.T) {
testAccCheckComputeImageHasComputedFingerprint(&image, "google_compute_image.foobar"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_image.foobar",
ImportState: true,
ImportStateVerify: true,
@ -116,7 +116,7 @@ func TestAccComputeImage_basedondisk(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeImageDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeImage_basedondisk(),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeImageExists(
@ -124,7 +124,7 @@ func TestAccComputeImage_basedondisk(t *testing.T) {
testAccCheckComputeImageHasSourceDisk(&image),
),
},
resource.TestStep{
{
ResourceName: "google_compute_image.foobar",
ImportState: true,
ImportStateVerify: true,

View File

@ -42,40 +42,40 @@ func resourceComputeInstance() *schema.Resource {
// template. Please attempt to maintain consistency with the
// resource_compute_instance_template schema when updating this one.
Schema: map[string]*schema.Schema{
"boot_disk": &schema.Schema{
"boot_disk": {
Type: schema.TypeList,
Required: true,
ForceNew: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"auto_delete": &schema.Schema{
"auto_delete": {
Type: schema.TypeBool,
Optional: true,
Default: true,
ForceNew: true,
},
"device_name": &schema.Schema{
"device_name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"disk_encryption_key_raw": &schema.Schema{
"disk_encryption_key_raw": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Sensitive: true,
},
"disk_encryption_key_sha256": &schema.Schema{
"disk_encryption_key_sha256": {
Type: schema.TypeString,
Computed: true,
},
"initialize_params": &schema.Schema{
"initialize_params": {
Type: schema.TypeList,
Optional: true,
Computed: true,
@ -83,7 +83,7 @@ func resourceComputeInstance() *schema.Resource {
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"size": &schema.Schema{
"size": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
@ -91,7 +91,7 @@ func resourceComputeInstance() *schema.Resource {
ValidateFunc: validation.IntAtLeast(1),
},
"type": &schema.Schema{
"type": {
Type: schema.TypeString,
Optional: true,
Computed: true,
@ -99,7 +99,7 @@ func resourceComputeInstance() *schema.Resource {
ValidateFunc: validation.StringInSlice([]string{"pd-standard", "pd-ssd"}, false),
},
"image": &schema.Schema{
"image": {
Type: schema.TypeString,
Optional: true,
Computed: true,
@ -110,7 +110,7 @@ func resourceComputeInstance() *schema.Resource {
},
},
"source": &schema.Schema{
"source": {
Type: schema.TypeString,
Optional: true,
Computed: true,
@ -122,24 +122,24 @@ func resourceComputeInstance() *schema.Resource {
},
},
"machine_type": &schema.Schema{
"machine_type": {
Type: schema.TypeString,
Required: true,
},
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"network_interface": &schema.Schema{
"network_interface": {
Type: schema.TypeList,
Required: true,
ForceNew: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"network": &schema.Schema{
"network": {
Type: schema.TypeString,
Optional: true,
Computed: true,
@ -147,7 +147,7 @@ func resourceComputeInstance() *schema.Resource {
DiffSuppressFunc: compareSelfLinkOrResourceName,
},
"subnetwork": &schema.Schema{
"subnetwork": {
Type: schema.TypeString,
Optional: true,
Computed: true,
@ -155,50 +155,50 @@ func resourceComputeInstance() *schema.Resource {
DiffSuppressFunc: compareSelfLinkOrResourceName,
},
"subnetwork_project": &schema.Schema{
"subnetwork_project": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Computed: true,
},
"network_ip": &schema.Schema{
"network_ip": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},
"access_config": &schema.Schema{
"access_config": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"nat_ip": &schema.Schema{
"nat_ip": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"network_tier": &schema.Schema{
"network_tier": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{"PREMIUM", "STANDARD"}, false),
},
"assigned_nat_ip": &schema.Schema{
"assigned_nat_ip": {
Type: schema.TypeString,
Computed: true,
Removed: "Use network_interface.access_config.nat_ip instead.",
},
"public_ptr_domain_name": &schema.Schema{
"public_ptr_domain_name": {
Type: schema.TypeString,
Optional: true,
},
@ -206,17 +206,17 @@ func resourceComputeInstance() *schema.Resource {
},
},
"alias_ip_range": &schema.Schema{
"alias_ip_range": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"ip_cidr_range": &schema.Schema{
"ip_cidr_range": {
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: ipCidrRangeDiffSuppress,
},
"subnetwork_range_name": &schema.Schema{
"subnetwork_range_name": {
Type: schema.TypeString,
Optional: true,
},
@ -224,7 +224,7 @@ func resourceComputeInstance() *schema.Resource {
},
},
"address": &schema.Schema{
"address": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
@ -235,42 +235,42 @@ func resourceComputeInstance() *schema.Resource {
},
},
"allow_stopping_for_update": &schema.Schema{
"allow_stopping_for_update": {
Type: schema.TypeBool,
Optional: true,
},
"attached_disk": &schema.Schema{
"attached_disk": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"source": &schema.Schema{
"source": {
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: compareSelfLinkOrResourceName,
},
"device_name": &schema.Schema{
"device_name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"mode": &schema.Schema{
"mode": {
Type: schema.TypeString,
Optional: true,
Default: "READ_WRITE",
ValidateFunc: validation.StringInSlice([]string{"READ_WRITE", "READ_ONLY"}, false),
},
"disk_encryption_key_raw": &schema.Schema{
"disk_encryption_key_raw": {
Type: schema.TypeString,
Optional: true,
Sensitive: true,
},
"disk_encryption_key_sha256": &schema.Schema{
"disk_encryption_key_sha256": {
Type: schema.TypeString,
Computed: true,
},
@ -278,32 +278,32 @@ func resourceComputeInstance() *schema.Resource {
},
},
"can_ip_forward": &schema.Schema{
"can_ip_forward": {
Type: schema.TypeBool,
Optional: true,
Default: false,
ForceNew: true,
},
"create_timeout": &schema.Schema{
"create_timeout": {
Type: schema.TypeInt,
Optional: true,
Removed: "Use timeouts block instead.",
},
"description": &schema.Schema{
"description": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"deletion_protection": &schema.Schema{
"deletion_protection": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"disk": &schema.Schema{
"disk": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
@ -312,56 +312,56 @@ func resourceComputeInstance() *schema.Resource {
Schema: map[string]*schema.Schema{
// TODO(mitchellh): one of image or disk is required
"disk": &schema.Schema{
"disk": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"image": &schema.Schema{
"image": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"type": &schema.Schema{
"type": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"scratch": &schema.Schema{
"scratch": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
},
"auto_delete": &schema.Schema{
"auto_delete": {
Type: schema.TypeBool,
Optional: true,
Default: true,
ForceNew: true,
},
"size": &schema.Schema{
"size": {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
},
"device_name": &schema.Schema{
"device_name": {
Type: schema.TypeString,
Optional: true,
},
"disk_encryption_key_raw": &schema.Schema{
"disk_encryption_key_raw": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Sensitive: true,
},
"disk_encryption_key_sha256": &schema.Schema{
"disk_encryption_key_sha256": {
Type: schema.TypeString,
Computed: true,
},
@ -369,19 +369,19 @@ func resourceComputeInstance() *schema.Resource {
},
},
"guest_accelerator": &schema.Schema{
"guest_accelerator": {
Type: schema.TypeList,
Optional: true,
Computed: true,
ForceNew: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"count": &schema.Schema{
"count": {
Type: schema.TypeInt,
Required: true,
ForceNew: true,
},
"type": &schema.Schema{
"type": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
@ -391,57 +391,57 @@ func resourceComputeInstance() *schema.Resource {
},
},
"labels": &schema.Schema{
"labels": {
Type: schema.TypeMap,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
},
"metadata": &schema.Schema{
"metadata": {
Type: schema.TypeMap,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"metadata_startup_script": &schema.Schema{
"metadata_startup_script": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"min_cpu_platform": &schema.Schema{
"min_cpu_platform": {
Type: schema.TypeString,
Optional: true,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"scheduling": &schema.Schema{
"scheduling": {
Type: schema.TypeList,
MaxItems: 1,
Optional: true,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"on_host_maintenance": &schema.Schema{
"on_host_maintenance": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"automatic_restart": &schema.Schema{
"automatic_restart": {
Type: schema.TypeBool,
Optional: true,
Default: true,
},
"preemptible": &schema.Schema{
"preemptible": {
Type: schema.TypeBool,
Optional: true,
Default: false,
@ -451,13 +451,13 @@ func resourceComputeInstance() *schema.Resource {
},
},
"scratch_disk": &schema.Schema{
"scratch_disk": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"interface": &schema.Schema{
"interface": {
Type: schema.TypeString,
Optional: true,
Default: "SCSI",
@ -467,19 +467,19 @@ func resourceComputeInstance() *schema.Resource {
},
},
"service_account": &schema.Schema{
"service_account": {
Type: schema.TypeList,
MaxItems: 1,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"email": &schema.Schema{
"email": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"scopes": &schema.Schema{
"scopes": {
Type: schema.TypeSet,
Required: true,
Elem: &schema.Schema{
@ -494,46 +494,46 @@ func resourceComputeInstance() *schema.Resource {
},
},
"tags": &schema.Schema{
"tags": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
},
"zone": &schema.Schema{
"zone": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"cpu_platform": &schema.Schema{
"cpu_platform": {
Type: schema.TypeString,
Computed: true,
},
"instance_id": &schema.Schema{
"instance_id": {
Type: schema.TypeString,
Computed: true,
},
"label_fingerprint": &schema.Schema{
"label_fingerprint": {
Type: schema.TypeString,
Computed: true,
},
"metadata_fingerprint": &schema.Schema{
"metadata_fingerprint": {
Type: schema.TypeString,
Computed: true,
},
"self_link": &schema.Schema{
"self_link": {
Type: schema.TypeString,
Computed: true,
},
"tags_fingerprint": &schema.Schema{
"tags_fingerprint": {
Type: schema.TypeString,
Computed: true,
},

View File

@ -23,7 +23,7 @@ func TestAccComputeInstanceFromTemplate_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceFromTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceFromTemplate_basic(instanceName, templateName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(resourceName, &instance),

View File

@ -31,52 +31,52 @@ func resourceComputeInstanceGroupManager() *schema.Resource {
},
Schema: map[string]*schema.Schema{
"base_instance_name": &schema.Schema{
"base_instance_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"instance_template": &schema.Schema{
"instance_template": {
Type: schema.TypeString,
Optional: true,
DiffSuppressFunc: compareSelfLinkRelativePaths,
},
"version": &schema.Schema{
"version": {
Type: schema.TypeList,
Optional: true,
Computed: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
},
"instance_template": &schema.Schema{
"instance_template": {
Type: schema.TypeString,
Required: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
DiffSuppressFunc: compareSelfLinkRelativePaths,
},
"target_size": &schema.Schema{
"target_size": {
Type: schema.TypeList,
Optional: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"fixed": &schema.Schema{
"fixed": {
Type: schema.TypeInt,
Optional: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
},
"percent": &schema.Schema{
"percent": {
Type: schema.TypeInt,
Optional: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
@ -89,46 +89,46 @@ func resourceComputeInstanceGroupManager() *schema.Resource {
},
},
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"zone": &schema.Schema{
"zone": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"description": &schema.Schema{
"description": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"fingerprint": &schema.Schema{
"fingerprint": {
Type: schema.TypeString,
Computed: true,
},
"instance_group": &schema.Schema{
"instance_group": {
Type: schema.TypeString,
Computed: true,
},
"named_port": &schema.Schema{
"named_port": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
},
"port": &schema.Schema{
"port": {
Type: schema.TypeInt,
Required: true,
},
@ -136,19 +136,19 @@ func resourceComputeInstanceGroupManager() *schema.Resource {
},
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},
"self_link": &schema.Schema{
"self_link": {
Type: schema.TypeString,
Computed: true,
},
"update_strategy": &schema.Schema{
"update_strategy": {
Type: schema.TypeString,
Optional: true,
Default: "REPLACE",
@ -164,7 +164,7 @@ func resourceComputeInstanceGroupManager() *schema.Resource {
},
},
"target_pools": &schema.Schema{
"target_pools": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{
@ -173,27 +173,27 @@ func resourceComputeInstanceGroupManager() *schema.Resource {
Set: selfLinkRelativePathHash,
},
"target_size": &schema.Schema{
"target_size": {
Type: schema.TypeInt,
Computed: true,
Optional: true,
},
"auto_healing_policies": &schema.Schema{
"auto_healing_policies": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"health_check": &schema.Schema{
"health_check": {
Type: schema.TypeString,
Required: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
DiffSuppressFunc: compareSelfLinkRelativePaths,
},
"initial_delay_sec": &schema.Schema{
"initial_delay_sec": {
Type: schema.TypeInt,
Required: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
@ -203,7 +203,7 @@ func resourceComputeInstanceGroupManager() *schema.Resource {
},
},
"rolling_update_policy": &schema.Schema{
"rolling_update_policy": {
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
Computed: true,
Type: schema.TypeList,
@ -211,48 +211,48 @@ func resourceComputeInstanceGroupManager() *schema.Resource {
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"minimal_action": &schema.Schema{
"minimal_action": {
Type: schema.TypeString,
Required: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
ValidateFunc: validation.StringInSlice([]string{"RESTART", "REPLACE"}, false),
},
"type": &schema.Schema{
"type": {
Type: schema.TypeString,
Required: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
ValidateFunc: validation.StringInSlice([]string{"OPPORTUNISTIC", "PROACTIVE"}, false),
},
"max_surge_fixed": &schema.Schema{
"max_surge_fixed": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
},
"max_surge_percent": &schema.Schema{
"max_surge_percent": {
Type: schema.TypeInt,
Optional: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
ValidateFunc: validation.IntBetween(0, 100),
},
"max_unavailable_fixed": &schema.Schema{
"max_unavailable_fixed": {
Type: schema.TypeInt,
Optional: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
},
"max_unavailable_percent": &schema.Schema{
"max_unavailable_percent": {
Type: schema.TypeInt,
Optional: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
ValidateFunc: validation.IntBetween(0, 100),
},
"min_ready_sec": &schema.Schema{
"min_ready_sec": {
Type: schema.TypeInt,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
Optional: true,
@ -262,7 +262,7 @@ func resourceComputeInstanceGroupManager() *schema.Resource {
},
},
"wait_for_instances": &schema.Schema{
"wait_for_instances": {
Type: schema.TypeBool,
Optional: true,
Default: false,

View File

@ -176,7 +176,7 @@ func TestAccComputeInstanceGroup_network(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccComputeInstanceGroup_destroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceGroup_network(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccComputeInstanceGroup_exists(

View File

@ -283,7 +283,7 @@ func migrateStateV3toV4(is *terraform.InstanceState, meta interface{}) (*terrafo
}
}
for k, _ := range is.Attributes {
for k := range is.Attributes {
if !strings.HasPrefix(k, "disk.") {
continue
}

View File

@ -27,7 +27,7 @@ func resourceComputeInstanceTemplate() *schema.Resource {
// instance. Please attempt to maintain consistency with the
// resource_compute_instance schema when updating this one.
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
@ -36,7 +36,7 @@ func resourceComputeInstanceTemplate() *schema.Resource {
ValidateFunc: validateGCPName,
},
"name_prefix": &schema.Schema{
"name_prefix": {
Type: schema.TypeString,
Optional: true,
Computed: true,
@ -53,79 +53,79 @@ func resourceComputeInstanceTemplate() *schema.Resource {
},
},
"disk": &schema.Schema{
"disk": {
Type: schema.TypeList,
Required: true,
ForceNew: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"auto_delete": &schema.Schema{
"auto_delete": {
Type: schema.TypeBool,
Optional: true,
Default: true,
ForceNew: true,
},
"boot": &schema.Schema{
"boot": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
Computed: true,
},
"device_name": &schema.Schema{
"device_name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"disk_name": &schema.Schema{
"disk_name": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"disk_size_gb": &schema.Schema{
"disk_size_gb": {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
},
"disk_type": &schema.Schema{
"disk_type": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},
"source_image": &schema.Schema{
"source_image": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"interface": &schema.Schema{
"interface": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},
"mode": &schema.Schema{
"mode": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},
"source": &schema.Schema{
"source": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"type": &schema.Schema{
"type": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
@ -152,62 +152,62 @@ func resourceComputeInstanceTemplate() *schema.Resource {
},
},
"machine_type": &schema.Schema{
"machine_type": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"automatic_restart": &schema.Schema{
"automatic_restart": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
Removed: "Use 'scheduling.automatic_restart' instead.",
},
"can_ip_forward": &schema.Schema{
"can_ip_forward": {
Type: schema.TypeBool,
Optional: true,
Default: false,
ForceNew: true,
},
"description": &schema.Schema{
"description": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"instance_description": &schema.Schema{
"instance_description": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"metadata": &schema.Schema{
"metadata": {
Type: schema.TypeMap,
Optional: true,
ForceNew: true,
},
"metadata_startup_script": &schema.Schema{
"metadata_startup_script": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"metadata_fingerprint": &schema.Schema{
"metadata_fingerprint": {
Type: schema.TypeString,
Computed: true,
},
"network_interface": &schema.Schema{
"network_interface": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"network": &schema.Schema{
"network": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
@ -215,13 +215,13 @@ func resourceComputeInstanceTemplate() *schema.Resource {
DiffSuppressFunc: compareSelfLinkOrResourceName,
},
"network_ip": &schema.Schema{
"network_ip": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"subnetwork": &schema.Schema{
"subnetwork": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
@ -229,32 +229,32 @@ func resourceComputeInstanceTemplate() *schema.Resource {
DiffSuppressFunc: compareSelfLinkOrResourceName,
},
"subnetwork_project": &schema.Schema{
"subnetwork_project": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},
"access_config": &schema.Schema{
"access_config": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"nat_ip": &schema.Schema{
"nat_ip": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},
"network_tier": &schema.Schema{
"network_tier": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{"PREMIUM", "STANDARD"}, false),
},
"assigned_nat_ip": &schema.Schema{
"assigned_nat_ip": {
Type: schema.TypeString,
Computed: true,
Removed: "Use network_interface.access_config.nat_ip instead.",
@ -263,19 +263,19 @@ func resourceComputeInstanceTemplate() *schema.Resource {
},
},
"alias_ip_range": &schema.Schema{
"alias_ip_range": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"ip_cidr_range": &schema.Schema{
"ip_cidr_range": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DiffSuppressFunc: ipCidrRangeDiffSuppress,
},
"subnetwork_range_name": &schema.Schema{
"subnetwork_range_name": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
@ -284,7 +284,7 @@ func resourceComputeInstanceTemplate() *schema.Resource {
},
},
"address": &schema.Schema{
"address": {
Type: schema.TypeString,
Computed: true,
Optional: true,
@ -294,49 +294,49 @@ func resourceComputeInstanceTemplate() *schema.Resource {
},
},
"on_host_maintenance": &schema.Schema{
"on_host_maintenance": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Removed: "Use 'scheduling.on_host_maintenance' instead.",
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},
"region": &schema.Schema{
"region": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},
"scheduling": &schema.Schema{
"scheduling": {
Type: schema.TypeList,
Optional: true,
Computed: true,
ForceNew: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"preemptible": &schema.Schema{
"preemptible": {
Type: schema.TypeBool,
Optional: true,
Default: false,
ForceNew: true,
},
"automatic_restart": &schema.Schema{
"automatic_restart": {
Type: schema.TypeBool,
Optional: true,
Default: true,
ForceNew: true,
},
"on_host_maintenance": &schema.Schema{
"on_host_maintenance": {
Type: schema.TypeString,
Optional: true,
Computed: true,
@ -346,26 +346,26 @@ func resourceComputeInstanceTemplate() *schema.Resource {
},
},
"self_link": &schema.Schema{
"self_link": {
Type: schema.TypeString,
Computed: true,
},
"service_account": &schema.Schema{
"service_account": {
Type: schema.TypeList,
MaxItems: 1,
Optional: true,
ForceNew: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"email": &schema.Schema{
"email": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"scopes": &schema.Schema{
"scopes": {
Type: schema.TypeSet,
Required: true,
ForceNew: true,
@ -381,18 +381,18 @@ func resourceComputeInstanceTemplate() *schema.Resource {
},
},
"guest_accelerator": &schema.Schema{
"guest_accelerator": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"count": &schema.Schema{
"count": {
Type: schema.TypeInt,
Required: true,
ForceNew: true,
},
"type": &schema.Schema{
"type": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
@ -402,13 +402,13 @@ func resourceComputeInstanceTemplate() *schema.Resource {
},
},
"min_cpu_platform": &schema.Schema{
"min_cpu_platform": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"tags": &schema.Schema{
"tags": {
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
@ -416,12 +416,12 @@ func resourceComputeInstanceTemplate() *schema.Resource {
Set: schema.HashString,
},
"tags_fingerprint": &schema.Schema{
"tags_fingerprint": {
Type: schema.TypeString,
Computed: true,
},
"labels": &schema.Schema{
"labels": {
Type: schema.TypeMap,
Optional: true,
ForceNew: true,

View File

@ -24,7 +24,7 @@ func TestAccComputeInstanceTemplate_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceTemplate_basic(),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceTemplateExists(
@ -34,7 +34,7 @@ func TestAccComputeInstanceTemplate_basic(t *testing.T) {
testAccCheckComputeInstanceTemplateContainsLabel(&instanceTemplate, "my_label", "foobar"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_instance_template.foobar",
ImportState: true,
ImportStateVerify: true,
@ -53,14 +53,14 @@ func TestAccComputeInstanceTemplate_imageShorthand(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceTemplate_imageShorthand(),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceTemplateExists(
"google_compute_instance_template.foobar", &instanceTemplate),
),
},
resource.TestStep{
{
ResourceName: "google_compute_instance_template.foobar",
ImportState: true,
ImportStateVerify: true,
@ -79,7 +79,7 @@ func TestAccComputeInstanceTemplate_preemptible(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceTemplate_preemptible(),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceTemplateExists(
@ -88,7 +88,7 @@ func TestAccComputeInstanceTemplate_preemptible(t *testing.T) {
testAccCheckComputeInstanceTemplatePreemptible(&instanceTemplate, true),
),
},
resource.TestStep{
{
ResourceName: "google_compute_instance_template.foobar",
ImportState: true,
ImportStateVerify: true,
@ -107,7 +107,7 @@ func TestAccComputeInstanceTemplate_IP(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceTemplate_ip(),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceTemplateExists(
@ -115,7 +115,7 @@ func TestAccComputeInstanceTemplate_IP(t *testing.T) {
testAccCheckComputeInstanceTemplateNetwork(&instanceTemplate),
),
},
resource.TestStep{
{
ResourceName: "google_compute_instance_template.foobar",
ImportState: true,
ImportStateVerify: true,
@ -132,10 +132,10 @@ func TestAccComputeInstanceTemplate_networkTier(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceTemplate_networkTier(),
},
resource.TestStep{
{
ResourceName: "google_compute_instance_template.foobar",
ImportState: true,
ImportStateVerify: true,
@ -155,7 +155,7 @@ func TestAccComputeInstanceTemplate_networkIP(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceTemplate_networkIP(networkIP),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceTemplateExists(
@ -165,7 +165,7 @@ func TestAccComputeInstanceTemplate_networkIP(t *testing.T) {
"google_compute_instance_template.foobar", networkIP, &instanceTemplate),
),
},
resource.TestStep{
{
ResourceName: "google_compute_instance_template.foobar",
ImportState: true,
ImportStateVerify: true,
@ -184,7 +184,7 @@ func TestAccComputeInstanceTemplate_networkIPAddress(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceTemplate_networkIPAddress(ipAddress),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceTemplateExists(
@ -194,7 +194,7 @@ func TestAccComputeInstanceTemplate_networkIPAddress(t *testing.T) {
"google_compute_instance_template.foobar", ipAddress, &instanceTemplate),
),
},
resource.TestStep{
{
ResourceName: "google_compute_instance_template.foobar",
ImportState: true,
ImportStateVerify: true,
@ -211,10 +211,10 @@ func TestAccComputeInstanceTemplate_disks(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceTemplate_disks(),
},
resource.TestStep{
{
ResourceName: "google_compute_instance_template.foobar",
ImportState: true,
ImportStateVerify: true,
@ -231,10 +231,10 @@ func TestAccComputeInstanceTemplate_regionDisks(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceTemplate_regionDisks(),
},
resource.TestStep{
{
ResourceName: "google_compute_instance_template.foobar",
ImportState: true,
ImportStateVerify: true,
@ -254,7 +254,7 @@ func TestAccComputeInstanceTemplate_subnet_auto(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceTemplate_subnet_auto(network),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceTemplateExists(
@ -262,7 +262,7 @@ func TestAccComputeInstanceTemplate_subnet_auto(t *testing.T) {
testAccCheckComputeInstanceTemplateNetworkName(&instanceTemplate, network),
),
},
resource.TestStep{
{
ResourceName: "google_compute_instance_template.foobar",
ImportState: true,
ImportStateVerify: true,
@ -281,7 +281,7 @@ func TestAccComputeInstanceTemplate_subnet_custom(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceTemplate_subnet_custom(),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceTemplateExists(
@ -289,7 +289,7 @@ func TestAccComputeInstanceTemplate_subnet_custom(t *testing.T) {
testAccCheckComputeInstanceTemplateSubnetwork(&instanceTemplate),
),
},
resource.TestStep{
{
ResourceName: "google_compute_instance_template.foobar",
ImportState: true,
ImportStateVerify: true,
@ -311,7 +311,7 @@ func TestAccComputeInstanceTemplate_subnet_xpn(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceTemplate_subnet_xpn(org, billingId, projectName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceTemplateExistsInProject(
@ -334,7 +334,7 @@ func TestAccComputeInstanceTemplate_metadata_startup_script(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceTemplate_startup_script(),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceTemplateExists(
@ -355,14 +355,14 @@ func TestAccComputeInstanceTemplate_primaryAliasIpRange(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceTemplate_primaryAliasIpRange(acctest.RandString(10)),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceTemplateExists("google_compute_instance_template.foobar", &instanceTemplate),
testAccCheckComputeInstanceTemplateHasAliasIpRange(&instanceTemplate, "", "/24"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_instance_template.foobar",
ImportState: true,
ImportStateVerify: true,
@ -381,14 +381,14 @@ func TestAccComputeInstanceTemplate_secondaryAliasIpRange(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceTemplate_secondaryAliasIpRange(acctest.RandString(10)),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceTemplateExists("google_compute_instance_template.foobar", &instanceTemplate),
testAccCheckComputeInstanceTemplateHasAliasIpRange(&instanceTemplate, "inst-test-secondary", "/24"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_instance_template.foobar",
ImportState: true,
ImportStateVerify: true,
@ -407,14 +407,14 @@ func TestAccComputeInstanceTemplate_guestAccelerator(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceTemplate_guestAccelerator(acctest.RandString(10), 1),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceTemplateExists("google_compute_instance_template.foobar", &instanceTemplate),
testAccCheckComputeInstanceTemplateHasGuestAccelerator(&instanceTemplate, "nvidia-tesla-k80", 1),
),
},
resource.TestStep{
{
ResourceName: "google_compute_instance_template.foobar",
ImportState: true,
ImportStateVerify: true,
@ -434,7 +434,7 @@ func TestAccComputeInstanceTemplate_guestAcceleratorSkip(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceTemplate_guestAccelerator(acctest.RandString(10), 0),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceTemplateExists("google_compute_instance_template.foobar", &instanceTemplate),
@ -456,14 +456,14 @@ func TestAccComputeInstanceTemplate_minCpuPlatform(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceTemplate_minCpuPlatform(acctest.RandString(10)),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceTemplateExists("google_compute_instance_template.foobar", &instanceTemplate),
testAccCheckComputeInstanceTemplateHasMinCpuPlatform(&instanceTemplate, DEFAULT_MIN_CPU_TEST_VALUE),
),
},
resource.TestStep{
{
ResourceName: "google_compute_instance_template.foobar",
ImportState: true,
ImportStateVerify: true,
@ -489,13 +489,13 @@ func TestAccComputeInstanceTemplate_EncryptKMS(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstanceTemplate_encryptionKMS(pid, pname, org, billingAccount, diskName, keyRingName, keyName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceTemplateExists("google_compute_instance_template.foobar", &instanceTemplate),
),
},
resource.TestStep{
{
ResourceName: "google_compute_instance_template.foobar",
ImportState: true,
ImportStateVerify: true,

View File

@ -39,7 +39,7 @@ func TestAccComputeInstance_basic1(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_basic(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -72,7 +72,7 @@ func TestAccComputeInstance_basic2(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_basic2(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -97,7 +97,7 @@ func TestAccComputeInstance_basic3(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_basic3(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -122,7 +122,7 @@ func TestAccComputeInstance_basic4(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_basic4(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -147,7 +147,7 @@ func TestAccComputeInstance_basic5(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_basic5(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -173,7 +173,7 @@ func TestAccComputeInstance_IP(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_ip(ipName, instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -198,7 +198,7 @@ func TestAccComputeInstance_PTRRecord(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_PTRRecord(ptrName, instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -207,7 +207,7 @@ func TestAccComputeInstance_PTRRecord(t *testing.T) {
),
},
computeInstanceImportStep("us-central1-a", instanceName, []string{"metadata.baz", "metadata.foo"}),
resource.TestStep{
{
Config: testAccComputeInstance_ip(ipName, instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -229,7 +229,7 @@ func TestAccComputeInstance_networkTier(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_networkTier(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -270,7 +270,7 @@ func TestAccComputeInstance_diskEncryption(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_disks_encryption(bootEncryptionKey, diskNameToEncryptionKey, instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -294,7 +294,7 @@ func TestAccComputeInstance_attachedDisk(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_attachedDisk(diskName, instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -319,7 +319,7 @@ func TestAccComputeInstance_attachedDisk_sourceUrl(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_attachedDisk_sourceUrl(diskName, instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -344,7 +344,7 @@ func TestAccComputeInstance_attachedDisk_modeRo(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_attachedDisk_modeRo(diskName, instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -370,7 +370,7 @@ func TestAccComputeInstance_attachedDiskUpdate(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_attachedDisk(diskName, instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -379,7 +379,7 @@ func TestAccComputeInstance_attachedDiskUpdate(t *testing.T) {
),
},
// check attaching
resource.TestStep{
{
Config: testAccComputeInstance_addAttachedDisk(diskName, diskName2, instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -389,7 +389,7 @@ func TestAccComputeInstance_attachedDiskUpdate(t *testing.T) {
),
},
// check detaching
resource.TestStep{
{
Config: testAccComputeInstance_detachDisk(diskName, diskName2, instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -398,7 +398,7 @@ func TestAccComputeInstance_attachedDiskUpdate(t *testing.T) {
),
},
// check updating
resource.TestStep{
{
Config: testAccComputeInstance_updateAttachedDiskEncryptionKey(diskName, instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -422,7 +422,7 @@ func TestAccComputeInstance_bootDisk_source(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_bootDisk_source(diskName, instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -447,7 +447,7 @@ func TestAccComputeInstance_bootDisk_sourceUrl(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_bootDisk_sourceUrl(diskName, instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -472,7 +472,7 @@ func TestAccComputeInstance_bootDisk_type(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_bootDisk_type(instanceName, diskType),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -495,7 +495,7 @@ func TestAccComputeInstance_scratchDisk(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_scratchDisk(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -519,14 +519,14 @@ func TestAccComputeInstance_forceNewAndChangeMetadata(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_basic(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
"google_compute_instance.foobar", &instance),
),
},
resource.TestStep{
{
Config: testAccComputeInstance_forceNewAndChangeMetadata(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -550,14 +550,14 @@ func TestAccComputeInstance_update(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_basic(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
"google_compute_instance.foobar", &instance),
),
},
resource.TestStep{
{
Config: testAccComputeInstance_update(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -585,7 +585,7 @@ func TestAccComputeInstance_stopInstanceToUpdate(t *testing.T) {
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
// Set fields that require stopping the instance
resource.TestStep{
{
Config: testAccComputeInstance_stopInstanceToUpdate(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -594,7 +594,7 @@ func TestAccComputeInstance_stopInstanceToUpdate(t *testing.T) {
},
computeInstanceImportStep("us-central1-a", instanceName, []string{"allow_stopping_for_update"}),
// Check that updating them works
resource.TestStep{
{
Config: testAccComputeInstance_stopInstanceToUpdate2(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -603,7 +603,7 @@ func TestAccComputeInstance_stopInstanceToUpdate(t *testing.T) {
},
computeInstanceImportStep("us-central1-a", instanceName, []string{"allow_stopping_for_update"}),
// Check that removing them works
resource.TestStep{
{
Config: testAccComputeInstance_stopInstanceToUpdate3(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -626,7 +626,7 @@ func TestAccComputeInstance_service_account(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_service_account(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -655,7 +655,7 @@ func TestAccComputeInstance_scheduling(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_scheduling(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -678,7 +678,7 @@ func TestAccComputeInstance_subnet_auto(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_subnet_auto(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -702,7 +702,7 @@ func TestAccComputeInstance_subnet_custom(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_subnet_custom(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -729,7 +729,7 @@ func TestAccComputeInstance_subnet_xpn(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_subnet_xpn(org, billingId, projectName, instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExistsInProject(
@ -753,7 +753,7 @@ func TestAccComputeInstance_networkIPAuto(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_networkIPAuto(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -776,7 +776,7 @@ func TestAccComputeInstance_network_ip_custom(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_network_ip_custom(instanceName, ipAddress),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -801,7 +801,7 @@ func TestAccComputeInstance_private_image_family(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_private_image_family(diskName, familyName, instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -823,7 +823,7 @@ func TestAccComputeInstance_forceChangeMachineTypeManually(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_basic(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists("google_compute_instance.foobar", &instance),
@ -849,7 +849,7 @@ func TestAccComputeInstance_multiNic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_multiNic(instanceName, networkName, subnetworkName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists("google_compute_instance.foobar", &instance),
@ -872,7 +872,7 @@ func TestAccComputeInstance_guestAccelerator(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_guestAccelerator(instanceName, 1),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists("google_compute_instance.foobar", &instance),
@ -896,7 +896,7 @@ func TestAccComputeInstance_guestAcceleratorSkip(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_guestAccelerator(instanceName, 0),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists("google_compute_instance.foobar", &instance),
@ -919,7 +919,7 @@ func TestAccComputeInstance_minCpuPlatform(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_minCpuPlatform(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists("google_compute_instance.foobar", &instance),
@ -942,7 +942,7 @@ func TestAccComputeInstance_deletionProtectionExplicitFalse(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_basic_deletionProtectionFalse(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -965,7 +965,7 @@ func TestAccComputeInstance_deletionProtectionExplicitTrueAndUpdateFalse(t *test
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_basic_deletionProtectionTrue(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -975,7 +975,7 @@ func TestAccComputeInstance_deletionProtectionExplicitTrueAndUpdateFalse(t *test
},
computeInstanceImportStep("us-central1-a", instanceName, []string{"metadata.foo"}),
// Update deletion_protection to false, otherwise the test harness can't delete the instance
resource.TestStep{
{
Config: testAccComputeInstance_basic_deletionProtectionFalse(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
@ -998,7 +998,7 @@ func TestAccComputeInstance_primaryAliasIpRange(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_primaryAliasIpRange(instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists("google_compute_instance.foobar", &instance),
@ -1023,7 +1023,7 @@ func TestAccComputeInstance_secondaryAliasIpRange(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeInstance_secondaryAliasIpRange(networkName, subnetName, instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists("google_compute_instance.foobar", &instance),
@ -1031,7 +1031,7 @@ func TestAccComputeInstance_secondaryAliasIpRange(t *testing.T) {
),
},
computeInstanceImportStep("us-east1-d", instanceName, []string{}),
resource.TestStep{
{
Config: testAccComputeInstance_secondaryAliasIpRangeUpdate(networkName, subnetName, instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists("google_compute_instance.foobar", &instance),
@ -1908,7 +1908,7 @@ resource "google_compute_instance" "foobar" {
func testAccComputeInstance_disks_encryption(bootEncryptionKey string, diskNameToEncryptionKey map[string]*compute.CustomerEncryptionKey, instance string) string {
diskNames := []string{}
for k, _ := range diskNameToEncryptionKey {
for k := range diskNameToEncryptionKey {
diskNames = append(diskNames, k)
}
return fmt.Sprintf(`

View File

@ -19,37 +19,37 @@ func resourceComputeNetwork() *schema.Resource {
},
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"auto_create_subnetworks": &schema.Schema{
"auto_create_subnetworks": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
Default: true,
},
"description": &schema.Schema{
"description": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"routing_mode": &schema.Schema{
"routing_mode": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"gateway_ipv4": &schema.Schema{
"gateway_ipv4": {
Type: schema.TypeString,
Computed: true,
},
"ipv4_range": &schema.Schema{
"ipv4_range": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
@ -57,14 +57,14 @@ func resourceComputeNetwork() *schema.Resource {
Deprecated: "Please use google_compute_subnetwork resources instead.",
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"self_link": &schema.Schema{
"self_link": {
Type: schema.TypeString,
Computed: true,
},

View File

@ -19,37 +19,37 @@ func resourceComputeNetworkPeering() *schema.Resource {
Delete: resourceComputeNetworkPeeringDelete,
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validateGCPName,
},
"network": &schema.Schema{
"network": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validateRegexp(peerNetworkLinkRegex),
DiffSuppressFunc: compareSelfLinkRelativePaths,
},
"peer_network": &schema.Schema{
"peer_network": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validateRegexp(peerNetworkLinkRegex),
DiffSuppressFunc: compareSelfLinkRelativePaths,
},
"auto_create_routes": &schema.Schema{
"auto_create_routes": {
Type: schema.TypeBool,
ForceNew: true,
Optional: true,
Default: true,
},
"state": &schema.Schema{
"state": {
Type: schema.TypeString,
Computed: true,
},
"state_details": &schema.Schema{
"state_details": {
Type: schema.TypeString,
Computed: true,
},

View File

@ -20,7 +20,7 @@ func TestAccComputeNetworkPeering_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccComputeNetworkPeeringDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeNetworkPeering_basic(),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeNetworkPeeringExist("google_compute_network_peering.foo", &peering),

View File

@ -20,14 +20,14 @@ func TestAccComputeNetwork_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeNetworkDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeNetwork_basic(),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeNetworkExists(
"google_compute_network.foobar", &network),
),
},
resource.TestStep{
{
ResourceName: "google_compute_network.foobar",
ImportState: true,
ImportStateVerify: true,
@ -46,7 +46,7 @@ func TestAccComputeNetwork_auto_subnet(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeNetworkDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeNetwork_auto_subnet(),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeNetworkExists(
@ -55,7 +55,7 @@ func TestAccComputeNetwork_auto_subnet(t *testing.T) {
"google_compute_network.bar", &network),
),
},
resource.TestStep{
{
ResourceName: "google_compute_network.bar",
ImportState: true,
ImportStateVerify: true,
@ -74,7 +74,7 @@ func TestAccComputeNetwork_custom_subnet(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeNetworkDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeNetwork_custom_subnet(),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeNetworkExists(
@ -83,7 +83,7 @@ func TestAccComputeNetwork_custom_subnet(t *testing.T) {
"google_compute_network.baz", &network),
),
},
resource.TestStep{
{
ResourceName: "google_compute_network.baz",
ImportState: true,
ImportStateVerify: true,
@ -102,7 +102,7 @@ func TestAccComputeNetwork_routing_mode(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeNetworkDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeNetwork_routing_mode("GLOBAL"),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeNetworkExists(
@ -112,7 +112,7 @@ func TestAccComputeNetwork_routing_mode(t *testing.T) {
),
},
// Test updating the routing field (only updateable field).
resource.TestStep{
{
Config: testAccComputeNetwork_routing_mode("REGIONAL"),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeNetworkExists(
@ -137,7 +137,7 @@ func TestAccComputeNetwork_default_routing_mode(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeNetworkDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeNetwork_basic(),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeNetworkExists(

View File

@ -21,13 +21,13 @@ func resourceComputeProjectMetadata() *schema.Resource {
SchemaVersion: 0,
Schema: map[string]*schema.Schema{
"metadata": &schema.Schema{
"metadata": {
Type: schema.TypeMap,
Required: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,

View File

@ -22,10 +22,10 @@ func TestAccComputeProjectMetadata_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeProjectMetadataDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeProject_basic0_metadata(projectID, pname, org, billingId),
},
resource.TestStep{
{
ResourceName: "google_compute_project_metadata.fizzbuzz",
ImportState: true,
ImportStateVerify: true,
@ -47,19 +47,19 @@ func TestAccComputeProjectMetadata_modify_1(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeProjectMetadataDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeProject_modify0_metadata(projectID, pname, org, billingId),
},
resource.TestStep{
{
ResourceName: "google_compute_project_metadata.fizzbuzz",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAccComputeProject_modify1_metadata(projectID, pname, org, billingId),
},
resource.TestStep{
{
ResourceName: "google_compute_project_metadata.fizzbuzz",
ImportState: true,
ImportStateVerify: true,
@ -81,19 +81,19 @@ func TestAccComputeProjectMetadata_modify_2(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeProjectMetadataDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeProject_basic0_metadata(projectID, pname, org, billingId),
},
resource.TestStep{
{
ResourceName: "google_compute_project_metadata.fizzbuzz",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAccComputeProject_basic1_metadata(projectID, pname, org, billingId),
},
resource.TestStep{
{
ResourceName: "google_compute_project_metadata.fizzbuzz",
ImportState: true,
ImportStateVerify: true,

View File

@ -24,14 +24,14 @@ func TestAccComputeRegionAutoscaler_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRegionAutoscalerDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRegionAutoscaler_basic(it_name, tp_name, igm_name, autoscaler_name),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionAutoscalerExists(
"google_compute_region_autoscaler.foobar", &ascaler),
),
},
resource.TestStep{
{
ResourceName: "google_compute_region_autoscaler.foobar",
ImportState: true,
ImportStateVerify: true,
@ -53,14 +53,14 @@ func TestAccComputeRegionAutoscaler_update(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRegionAutoscalerDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRegionAutoscaler_basic(it_name, tp_name, igm_name, autoscaler_name),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionAutoscalerExists(
"google_compute_region_autoscaler.foobar", &ascaler),
),
},
resource.TestStep{
{
Config: testAccComputeRegionAutoscaler_update(it_name, tp_name, igm_name, autoscaler_name),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionAutoscalerExists(

View File

@ -19,14 +19,14 @@ func resourceComputeRegionBackendService() *schema.Resource {
Delete: resourceComputeRegionBackendServiceDelete,
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validateGCPName,
},
"health_checks": &schema.Schema{
"health_checks": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString,
@ -35,16 +35,16 @@ func resourceComputeRegionBackendService() *schema.Resource {
MaxItems: 1,
},
"backend": &schema.Schema{
"backend": {
Type: schema.TypeSet,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"group": &schema.Schema{
"group": {
Type: schema.TypeString,
Optional: true,
DiffSuppressFunc: compareSelfLinkRelativePaths,
},
"description": &schema.Schema{
"description": {
Type: schema.TypeString,
Optional: true,
},
@ -54,54 +54,54 @@ func resourceComputeRegionBackendService() *schema.Resource {
Set: resourceGoogleComputeRegionBackendServiceBackendHash,
},
"description": &schema.Schema{
"description": {
Type: schema.TypeString,
Optional: true,
},
"fingerprint": &schema.Schema{
"fingerprint": {
Type: schema.TypeString,
Computed: true,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"protocol": &schema.Schema{
"protocol": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"session_affinity": &schema.Schema{
"session_affinity": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"region": &schema.Schema{
"region": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"self_link": &schema.Schema{
"self_link": {
Type: schema.TypeString,
Computed: true,
},
"timeout_sec": &schema.Schema{
"timeout_sec": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"connection_draining_timeout_sec": &schema.Schema{
"connection_draining_timeout_sec": {
Type: schema.TypeInt,
Optional: true,
Default: 0,

View File

@ -23,14 +23,14 @@ func TestAccComputeRegionBackendService_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRegionBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRegionBackendService_basic(serviceName, checkName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionBackendServiceExists(
"google_compute_region_backend_service.foobar", &svc),
),
},
resource.TestStep{
{
Config: testAccComputeRegionBackendService_basicModified(
serviceName, checkName, extraCheckName),
Check: resource.ComposeTestCheckFunc(
@ -55,7 +55,7 @@ func TestAccComputeRegionBackendService_withBackend(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRegionBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRegionBackendService_withBackend(
serviceName, igName, itName, checkName, 10),
Check: resource.ComposeTestCheckFunc(
@ -90,7 +90,7 @@ func TestAccComputeRegionBackendService_withBackendAndUpdate(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRegionBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRegionBackendService_withBackend(
serviceName, igName, itName, checkName, 10),
Check: resource.ComposeTestCheckFunc(
@ -98,7 +98,7 @@ func TestAccComputeRegionBackendService_withBackendAndUpdate(t *testing.T) {
"google_compute_region_backend_service.lipsum", &svc),
),
},
resource.TestStep{
{
Config: testAccComputeRegionBackendService_withBackend(
serviceName, igName, itName, checkName, 20),
Check: resource.ComposeTestCheckFunc(
@ -132,7 +132,7 @@ func TestAccComputeRegionBackendService_withConnectionDraining(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRegionBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRegionBackendService_withConnectionDraining(serviceName, checkName, 10),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionBackendServiceExists(
@ -159,14 +159,14 @@ func TestAccComputeRegionBackendService_withConnectionDrainingAndUpdate(t *testi
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRegionBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRegionBackendService_withConnectionDraining(serviceName, checkName, 10),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionBackendServiceExists(
"google_compute_region_backend_service.foobar", &svc),
),
},
resource.TestStep{
{
Config: testAccComputeRegionBackendService_basic(serviceName, checkName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionBackendServiceExists(
@ -193,7 +193,7 @@ func TestAccComputeRegionBackendService_withSessionAffinity(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRegionBackendServiceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRegionBackendService_withSessionAffinity(
serviceName, checkName),
Check: resource.ComposeTestCheckFunc(

View File

@ -23,26 +23,26 @@ func TestAccComputeRegionDisk_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRegionDiskDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRegionDisk_basic(diskName, "self_link"),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionDiskExists(
"google_compute_region_disk.regiondisk", &disk),
),
},
resource.TestStep{
{
ResourceName: "google_compute_region_disk.regiondisk",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAccComputeRegionDisk_basic(diskName, "name"),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionDiskExists(
"google_compute_region_disk.regiondisk", &disk),
),
},
resource.TestStep{
{
ResourceName: "google_compute_region_disk.regiondisk",
ImportState: true,
ImportStateVerify: true,
@ -63,19 +63,19 @@ func TestAccComputeRegionDisk_basicUpdate(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRegionDiskDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRegionDisk_basic(diskName, "self_link"),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionDiskExists(
"google_compute_region_disk.regiondisk", &disk),
),
},
resource.TestStep{
{
ResourceName: "google_compute_region_disk.regiondisk",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAccComputeRegionDisk_basicUpdated(diskName, "self_link"),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionDiskExists(
@ -86,7 +86,7 @@ func TestAccComputeRegionDisk_basicUpdate(t *testing.T) {
testAccCheckComputeRegionDiskHasLabelFingerprint(&disk, "google_compute_region_disk.regiondisk"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_region_disk.regiondisk",
ImportState: true,
ImportStateVerify: true,
@ -106,7 +106,7 @@ func TestAccComputeRegionDisk_encryption(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRegionDiskDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRegionDisk_encryption(diskName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionDiskExists(
@ -133,7 +133,7 @@ func TestAccComputeRegionDisk_deleteDetach(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRegionDiskDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRegionDisk_deleteDetach(instanceName, diskName, regionDiskName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionDiskExists(
@ -144,7 +144,7 @@ func TestAccComputeRegionDisk_deleteDetach(t *testing.T) {
// listed as attached to the disk; the instance is created after the
// disk. and the disk's properties aren't refreshed unless there's
// another step
resource.TestStep{
{
Config: testAccComputeRegionDisk_deleteDetach(instanceName, diskName, regionDiskName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionDiskExists(
@ -154,7 +154,7 @@ func TestAccComputeRegionDisk_deleteDetach(t *testing.T) {
),
},
// Change the disk name to destroy it, which detaches it from the instance
resource.TestStep{
{
Config: testAccComputeRegionDisk_deleteDetach(instanceName, diskName, regionDiskName2),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionDiskExists(
@ -162,7 +162,7 @@ func TestAccComputeRegionDisk_deleteDetach(t *testing.T) {
),
},
// Add the extra step like before
resource.TestStep{
{
Config: testAccComputeRegionDisk_deleteDetach(instanceName, diskName, regionDiskName2),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRegionDiskExists(

View File

@ -36,52 +36,52 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource {
},
Schema: map[string]*schema.Schema{
"base_instance_name": &schema.Schema{
"base_instance_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"instance_template": &schema.Schema{
"instance_template": {
Type: schema.TypeString,
Optional: true,
DiffSuppressFunc: compareSelfLinkRelativePaths,
},
"version": &schema.Schema{
"version": {
Type: schema.TypeList,
Optional: true,
Computed: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
},
"instance_template": &schema.Schema{
"instance_template": {
Type: schema.TypeString,
Required: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
DiffSuppressFunc: compareSelfLinkRelativePaths,
},
"target_size": &schema.Schema{
"target_size": {
Type: schema.TypeList,
Optional: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"fixed": &schema.Schema{
"fixed": {
Type: schema.TypeInt,
Optional: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
},
"percent": &schema.Schema{
"percent": {
Type: schema.TypeInt,
Optional: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
@ -94,45 +94,45 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource {
},
},
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"region": &schema.Schema{
"region": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"description": &schema.Schema{
"description": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"fingerprint": &schema.Schema{
"fingerprint": {
Type: schema.TypeString,
Computed: true,
},
"instance_group": &schema.Schema{
"instance_group": {
Type: schema.TypeString,
Computed: true,
},
"named_port": &schema.Schema{
"named_port": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
},
"port": &schema.Schema{
"port": {
Type: schema.TypeInt,
Required: true,
},
@ -140,26 +140,26 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource {
},
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
},
"self_link": &schema.Schema{
"self_link": {
Type: schema.TypeString,
Computed: true,
},
"update_strategy": &schema.Schema{
"update_strategy": {
Type: schema.TypeString,
Deprecated: "This field is removed.",
Optional: true,
Computed: true,
},
"target_pools": &schema.Schema{
"target_pools": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{
@ -167,7 +167,7 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource {
},
Set: selfLinkRelativePathHash,
},
"target_size": &schema.Schema{
"target_size": {
Type: schema.TypeInt,
Computed: true,
Optional: true,
@ -176,27 +176,27 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource {
// If true, the resource will report ready only after no instances are being created.
// This will not block future reads if instances are being recreated, and it respects
// the "createNoRetry" parameter that's available for this resource.
"wait_for_instances": &schema.Schema{
"wait_for_instances": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"auto_healing_policies": &schema.Schema{
"auto_healing_policies": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"health_check": &schema.Schema{
"health_check": {
Type: schema.TypeString,
Required: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
DiffSuppressFunc: compareSelfLinkRelativePaths,
},
"initial_delay_sec": &schema.Schema{
"initial_delay_sec": {
Type: schema.TypeInt,
Required: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
@ -206,7 +206,7 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource {
},
},
"distribution_policy_zones": &schema.Schema{
"distribution_policy_zones": {
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
@ -218,7 +218,7 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource {
},
},
"rolling_update_policy": &schema.Schema{
"rolling_update_policy": {
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
Computed: true,
Type: schema.TypeList,
@ -226,48 +226,48 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource {
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"minimal_action": &schema.Schema{
"minimal_action": {
Type: schema.TypeString,
Required: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
ValidateFunc: validation.StringInSlice([]string{"RESTART", "REPLACE"}, false),
},
"type": &schema.Schema{
"type": {
Type: schema.TypeString,
Required: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
ValidateFunc: validation.StringInSlice([]string{"OPPORTUNISTIC", "PROACTIVE"}, false),
},
"max_surge_fixed": &schema.Schema{
"max_surge_fixed": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
},
"max_surge_percent": &schema.Schema{
"max_surge_percent": {
Type: schema.TypeInt,
Optional: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
ValidateFunc: validation.IntBetween(0, 100),
},
"max_unavailable_fixed": &schema.Schema{
"max_unavailable_fixed": {
Type: schema.TypeInt,
Optional: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
},
"max_unavailable_percent": &schema.Schema{
"max_unavailable_percent": {
Type: schema.TypeInt,
Optional: true,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
ValidateFunc: validation.IntBetween(0, 100),
},
"min_ready_sec": &schema.Schema{
"min_ready_sec": {
Type: schema.TypeInt,
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
Optional: true,

View File

@ -139,7 +139,7 @@ func TestAccRegionInstanceGroupManager_updateStrategy(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckInstanceGroupManagerDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccRegionInstanceGroupManager_updateStrategy(igm),
},
{

View File

@ -104,7 +104,7 @@ func resourceComputeRoute() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"next_hop_instance_zone": &schema.Schema{
"next_hop_instance_zone": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,

View File

@ -21,7 +21,7 @@ func TestAccComputeRoute_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRouteDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRoute_basic(),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRouteExists(
@ -30,7 +30,7 @@ func TestAccComputeRoute_basic(t *testing.T) {
"google_compute_route.foobar", "description", regexp.MustCompile("This is a route")),
),
},
resource.TestStep{
{
ResourceName: "google_compute_route.foobar",
ImportState: true,
ImportStateVerify: true,
@ -49,14 +49,14 @@ func TestAccComputeRoute_defaultInternetGateway(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRouteDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRoute_defaultInternetGateway(),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRouteExists(
"google_compute_route.foobar", &route),
),
},
resource.TestStep{
{
ResourceName: "google_compute_route.foobar",
ImportState: true,
ImportStateVerify: true,
@ -77,7 +77,7 @@ func TestAccComputeRoute_hopInstance(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRouteDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRoute_hopInstance(instanceName, zone),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeRouteExists(
@ -86,7 +86,7 @@ func TestAccComputeRoute_hopInstance(t *testing.T) {
resource.TestMatchResourceAttr("google_compute_route.foobar", "next_hop_instance", instanceNameRegexp),
),
},
resource.TestStep{
{
ResourceName: "google_compute_route.foobar",
ImportState: true,
ImportStateVerify: true,

View File

@ -21,36 +21,36 @@ func resourceComputeRouterInterface() *schema.Resource {
},
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"router": &schema.Schema{
"router": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"vpn_tunnel": &schema.Schema{
"vpn_tunnel": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DiffSuppressFunc: linkDiffSuppress,
},
"ip_range": &schema.Schema{
"ip_range": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"region": &schema.Schema{
"region": {
Type: schema.TypeString,
Optional: true,
Computed: true,

View File

@ -18,17 +18,17 @@ func TestAccComputeRouterInterface_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRouterInterfaceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRouterInterfaceBasic(testId),
Check: testAccCheckComputeRouterInterfaceExists(
"google_compute_router_interface.foobar"),
},
resource.TestStep{
{
ResourceName: "google_compute_router_interface.foobar",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAccComputeRouterInterfaceKeepRouter(testId),
Check: testAccCheckComputeRouterInterfaceDelete(
"google_compute_router_interface.foobar"),

View File

@ -17,18 +17,18 @@ import (
var (
routerNatSubnetworkConfig = &schema.Resource{
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"source_ip_ranges_to_nat": &schema.Schema{
"source_ip_ranges_to_nat": {
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"secondary_ip_range_names": &schema.Schema{
"secondary_ip_range_names": {
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
@ -54,73 +54,73 @@ func resourceComputeRouterNat() *schema.Resource {
},
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validateRFC1035Name(2, 63),
},
"router": &schema.Schema{
"router": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"nat_ip_allocate_option": &schema.Schema{
"nat_ip_allocate_option": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"MANUAL_ONLY", "AUTO_ONLY"}, false),
},
"nat_ips": &schema.Schema{
"nat_ips": {
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"source_subnetwork_ip_ranges_to_nat": &schema.Schema{
"source_subnetwork_ip_ranges_to_nat": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"ALL_SUBNETWORKS_ALL_IP_RANGES", "ALL_SUBNETWORKS_ALL_PRIMARY_IP_RANGES", "LIST_OF_SUBNETWORKS"}, false),
},
"subnetwork": &schema.Schema{
"subnetwork": {
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
Elem: routerNatSubnetworkConfig,
},
"min_ports_per_vm": &schema.Schema{
"min_ports_per_vm": {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
},
"udp_idle_timeout_sec": &schema.Schema{
"udp_idle_timeout_sec": {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
},
"icmp_idle_timeout_sec": &schema.Schema{
"icmp_idle_timeout_sec": {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
},
"tcp_established_idle_timeout_sec": &schema.Schema{
"tcp_established_idle_timeout_sec": {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
},
"tcp_transitory_idle_timeout_sec": &schema.Schema{
"tcp_transitory_idle_timeout_sec": {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"region": &schema.Schema{
"region": {
Type: schema.TypeString,
Optional: true,
Computed: true,

View File

@ -18,15 +18,15 @@ func TestAccComputeRouterNat_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRouterNatDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRouterNatBasic(testId),
},
resource.TestStep{
{
ResourceName: "google_compute_router_nat.foobar",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAccComputeRouterNatKeepRouter(testId),
Check: testAccCheckComputeRouterNatDelete(
"google_compute_router_nat.foobar"),
@ -44,10 +44,10 @@ func TestAccComputeRouterNat_withManualIpAndSubnetConfiguration(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRouterNatDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRouterNatWithManualIpAndSubnetConfiguration(testId),
},
resource.TestStep{
{
ResourceName: "google_compute_router_nat.foobar",
ImportState: true,
ImportStateVerify: true,

View File

@ -21,53 +21,53 @@ func resourceComputeRouterPeer() *schema.Resource {
},
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"router": &schema.Schema{
"router": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"interface": &schema.Schema{
"interface": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"peer_ip_address": &schema.Schema{
"peer_ip_address": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"peer_asn": &schema.Schema{
"peer_asn": {
Type: schema.TypeInt,
Required: true,
ForceNew: true,
},
"advertised_route_priority": &schema.Schema{
"advertised_route_priority": {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
},
"ip_address": &schema.Schema{
"ip_address": {
Type: schema.TypeString,
Computed: true,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"region": &schema.Schema{
"region": {
Type: schema.TypeString,
Optional: true,
Computed: true,

View File

@ -18,17 +18,17 @@ func TestAccComputeRouterPeer_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRouterPeerDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRouterPeerBasic(testId),
Check: testAccCheckComputeRouterPeerExists(
"google_compute_router_peer.foobar"),
},
resource.TestStep{
{
ResourceName: "google_compute_router_peer.foobar",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAccComputeRouterPeerKeepRouter(testId),
Check: testAccCheckComputeRouterPeerDelete(
"google_compute_router_peer.foobar"),

View File

@ -18,10 +18,10 @@ func TestAccComputeRouter_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRouterDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRouterBasic(testId, resourceRegion),
},
resource.TestStep{
{
ResourceName: "google_compute_router.foobar",
ImportState: true,
ImportStateVerify: true,
@ -40,10 +40,10 @@ func TestAccComputeRouter_noRegion(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRouterDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRouterNoRegion(testId, providerRegion),
},
resource.TestStep{
{
ResourceName: "google_compute_router.foobar",
ImportState: true,
ImportStateVerify: true,
@ -61,10 +61,10 @@ func TestAccComputeRouter_full(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRouterDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRouterFull(testId),
},
resource.TestStep{
{
ResourceName: "google_compute_router.foobar",
ImportState: true,
ImportStateVerify: true,
@ -83,26 +83,26 @@ func TestAccComputeRouter_update(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeRouterDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeRouterBasic(testId, region),
},
resource.TestStep{
{
ResourceName: "google_compute_router.foobar",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAccComputeRouterFull(testId),
},
resource.TestStep{
{
ResourceName: "google_compute_router.foobar",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAccComputeRouterBasic(testId, region),
},
resource.TestStep{
{
ResourceName: "google_compute_router.foobar",
ImportState: true,
ImportStateVerify: true,

View File

@ -29,55 +29,55 @@ func resourceComputeSecurityPolicy() *schema.Resource {
},
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validateGCPName,
},
"description": &schema.Schema{
"description": {
Type: schema.TypeString,
Optional: true,
},
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"rule": &schema.Schema{
"rule": {
Type: schema.TypeSet,
Optional: true,
Computed: true, // If no rules are set, a default rule is added
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"action": &schema.Schema{
"action": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{"allow", "deny(403)", "deny(404)", "deny(502)"}, false),
},
"priority": &schema.Schema{
"priority": {
Type: schema.TypeInt,
Required: true,
},
"match": &schema.Schema{
"match": {
Type: schema.TypeList,
Required: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"config": &schema.Schema{
"config": {
Type: schema.TypeList,
Required: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"src_ip_ranges": &schema.Schema{
"src_ip_ranges": {
Type: schema.TypeSet,
Required: true,
MinItems: 1,
@ -88,7 +88,7 @@ func resourceComputeSecurityPolicy() *schema.Resource {
},
},
"versioned_expr": &schema.Schema{
"versioned_expr": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{"SRC_IPS_V1"}, false),
@ -97,12 +97,12 @@ func resourceComputeSecurityPolicy() *schema.Resource {
},
},
"description": &schema.Schema{
"description": {
Type: schema.TypeString,
Optional: true,
},
"preview": &schema.Schema{
"preview": {
Type: schema.TypeBool,
Optional: true,
},
@ -110,12 +110,12 @@ func resourceComputeSecurityPolicy() *schema.Resource {
},
},
"fingerprint": &schema.Schema{
"fingerprint": {
Type: schema.TypeString,
Computed: true,
},
"self_link": &schema.Schema{
"self_link": {
Type: schema.TypeString,
Computed: true,
},

View File

@ -19,10 +19,10 @@ func TestAccComputeSecurityPolicy_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeSecurityPolicyDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeSecurityPolicy_basic(spName),
},
resource.TestStep{
{
ResourceName: "google_compute_security_policy.policy",
ImportState: true,
ImportStateVerify: true,
@ -41,10 +41,10 @@ func TestAccComputeSecurityPolicy_withRule(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeSecurityPolicyDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeSecurityPolicy_withRule(spName),
},
resource.TestStep{
{
ResourceName: "google_compute_security_policy.policy",
ImportState: true,
ImportStateVerify: true,
@ -63,28 +63,28 @@ func TestAccComputeSecurityPolicy_update(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeSecurityPolicyDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeSecurityPolicy_withRule(spName),
},
resource.TestStep{
{
ResourceName: "google_compute_security_policy.policy",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAccComputeSecurityPolicy_update(spName),
},
resource.TestStep{
{
ResourceName: "google_compute_security_policy.policy",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAccComputeSecurityPolicy_withRule(spName),
},
resource.TestStep{
{
ResourceName: "google_compute_security_policy.policy",
ImportState: true,
ImportStateVerify: true,

View File

@ -17,7 +17,7 @@ func resourceComputeSharedVpcHostProject() *schema.Resource {
},
Schema: map[string]*schema.Schema{
"project": &schema.Schema{
"project": {
Type: schema.TypeString,
Required: true,
ForceNew: true,

View File

@ -22,12 +22,12 @@ func resourceComputeSharedVpcServiceProject() *schema.Resource {
},
Schema: map[string]*schema.Schema{
"host_project": &schema.Schema{
"host_project": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"service_project": &schema.Schema{
"service_project": {
Type: schema.TypeString,
Required: true,
ForceNew: true,

View File

@ -23,7 +23,7 @@ func TestAccComputeSharedVpc_basic(t *testing.T) {
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeSharedVpc_basic(hostProject, serviceProject, org, billingId),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSharedVpcHostProject(hostProject, true),
@ -31,18 +31,18 @@ func TestAccComputeSharedVpc_basic(t *testing.T) {
),
},
// Test import.
resource.TestStep{
{
ResourceName: hostProjectResourceName,
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
ResourceName: serviceProjectResourceName,
ImportState: true,
ImportStateVerify: true,
},
// Use a separate TestStep rather than a CheckDestroy because we need the project to still exist.
resource.TestStep{
{
Config: testAccComputeSharedVpc_disabled(hostProject, serviceProject, org, billingId),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSharedVpcHostProject(hostProject, false),

View File

@ -17,14 +17,14 @@ func TestAccComputeSslCertificate_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeSslCertificateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeSslCertificate_basic(),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSslCertificateExists(
"google_compute_ssl_certificate.foobar"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_ssl_certificate.foobar",
ImportState: true,
ImportStateVerify: true,
@ -42,14 +42,14 @@ func TestAccComputeSslCertificate_no_name(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeSslCertificateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeSslCertificate_no_name(),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSslCertificateExists(
"google_compute_ssl_certificate.foobar"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_ssl_certificate.foobar",
ImportState: true,
ImportStateVerify: true,
@ -67,14 +67,14 @@ func TestAccComputeSslCertificate_name_prefix(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeSslCertificateDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeSslCertificate_name_prefix(),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSslCertificateExists(
"google_compute_ssl_certificate.foobar"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_ssl_certificate.foobar",
ImportState: true,
ImportStateVerify: true,

View File

@ -21,7 +21,7 @@ func TestAccComputeSslPolicy_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeSslPolicyDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeSslPolicyBasic(sslPolicyName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSslPolicyExists(
@ -33,7 +33,7 @@ func TestAccComputeSslPolicy_basic(t *testing.T) {
"google_compute_ssl_policy.basic", "min_tls_version", "TLS_1_0"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_ssl_policy.basic",
ImportState: true,
ImportStateVerify: true,
@ -53,7 +53,7 @@ func TestAccComputeSslPolicy_profile(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeSslPolicyDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeSslPolicyProfile(sslPolicyName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSslPolicyExists(
@ -62,7 +62,7 @@ func TestAccComputeSslPolicy_profile(t *testing.T) {
"google_compute_ssl_policy.profile", "profile", "MODERN"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_ssl_policy.profile",
ImportState: true,
ImportStateVerify: true,
@ -82,7 +82,7 @@ func TestAccComputeSslPolicy_update(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeSslPolicyDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeSslUpdate1(sslPolicyName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSslPolicyExists(
@ -93,12 +93,12 @@ func TestAccComputeSslPolicy_update(t *testing.T) {
"google_compute_ssl_policy.update", "min_tls_version", "TLS_1_0"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_ssl_policy.update",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAccComputeSslUpdate2(sslPolicyName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSslPolicyExists(
@ -109,7 +109,7 @@ func TestAccComputeSslPolicy_update(t *testing.T) {
"google_compute_ssl_policy.update", "min_tls_version", "TLS_1_2"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_ssl_policy.update",
ImportState: true,
ImportStateVerify: true,
@ -129,7 +129,7 @@ func TestAccComputeSslPolicy_tls_version(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeSslPolicyDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeSslPolicyTlsVersion(sslPolicyName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSslPolicyExists(
@ -138,7 +138,7 @@ func TestAccComputeSslPolicy_tls_version(t *testing.T) {
"google_compute_ssl_policy.tlsversion", "min_tls_version", "TLS_1_2"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_ssl_policy.tlsversion",
ImportState: true,
ImportStateVerify: true,
@ -158,7 +158,7 @@ func TestAccComputeSslPolicy_custom(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeSslPolicyDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeSslPolicyCustom(sslPolicyName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSslPolicyExists(
@ -169,7 +169,7 @@ func TestAccComputeSslPolicy_custom(t *testing.T) {
"google_compute_ssl_policy.custom", "profile", "CUSTOM"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_ssl_policy.custom",
ImportState: true,
ImportStateVerify: true,
@ -189,7 +189,7 @@ func TestAccComputeSslPolicy_update_to_custom(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeSslPolicyDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeSslUpdate1(sslPolicyName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSslPolicyExists(
@ -200,12 +200,12 @@ func TestAccComputeSslPolicy_update_to_custom(t *testing.T) {
"google_compute_ssl_policy.update", "min_tls_version", "TLS_1_0"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_ssl_policy.update",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAccComputeSslUpdate3(sslPolicyName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSslPolicyExists(
@ -216,7 +216,7 @@ func TestAccComputeSslPolicy_update_to_custom(t *testing.T) {
"google_compute_ssl_policy.update", "min_tls_version", "TLS_1_1"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_ssl_policy.update",
ImportState: true,
ImportStateVerify: true,
@ -236,7 +236,7 @@ func TestAccComputeSslPolicy_update_from_custom(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeSslPolicyDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeSslUpdate3(sslPolicyName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSslPolicyExists(
@ -247,12 +247,12 @@ func TestAccComputeSslPolicy_update_from_custom(t *testing.T) {
"google_compute_ssl_policy.update", "min_tls_version", "TLS_1_1"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_ssl_policy.update",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
Config: testAccComputeSslUpdate1(sslPolicyName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSslPolicyExists(
@ -263,7 +263,7 @@ func TestAccComputeSslPolicy_update_from_custom(t *testing.T) {
"google_compute_ssl_policy.update", "min_tls_version", "TLS_1_0"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_ssl_policy.update",
ImportState: true,
ImportStateVerify: true,

View File

@ -64,7 +64,7 @@ func TestAccComputeSubnetwork_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeSubnetworkDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeSubnetwork_basic(cnName, subnetwork1Name, subnetwork2Name, subnetwork3Name),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSubnetworkExists(
@ -73,12 +73,12 @@ func TestAccComputeSubnetwork_basic(t *testing.T) {
"google_compute_subnetwork.network-ref-by-name", &subnetwork2),
),
},
resource.TestStep{
{
ResourceName: "google_compute_subnetwork.network-ref-by-url",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
{
ResourceName: "google_compute_subnetwork.network-with-private-google-access",
ImportState: true,
ImportStateVerify: true,
@ -100,14 +100,14 @@ func TestAccComputeSubnetwork_update(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeSubnetworkDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeSubnetwork_update1(cnName, "10.2.0.0/24", subnetworkName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSubnetworkExists(
"google_compute_subnetwork.network-with-private-google-access", &subnetwork),
),
},
resource.TestStep{
{
// Expand IP CIDR range and update private_ip_google_access
Config: testAccComputeSubnetwork_update2(cnName, "10.2.0.0/16", subnetworkName),
Check: resource.ComposeTestCheckFunc(
@ -115,7 +115,7 @@ func TestAccComputeSubnetwork_update(t *testing.T) {
"google_compute_subnetwork.network-with-private-google-access", &subnetwork),
),
},
resource.TestStep{
{
// Shrink IP CIDR range and update private_ip_google_access
Config: testAccComputeSubnetwork_update2(cnName, "10.2.0.0/24", subnetworkName),
Check: resource.ComposeTestCheckFunc(
@ -144,14 +144,14 @@ func TestAccComputeSubnetwork_secondaryIpRanges(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeSubnetworkDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeSubnetwork_secondaryIpRanges_update1(cnName, subnetworkName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSubnetworkExists("google_compute_subnetwork.network-with-private-secondary-ip-ranges", &subnetwork),
testAccCheckComputeSubnetworkHasSecondaryIpRange(&subnetwork, "tf-test-secondary-range-update1", "192.168.10.0/24"),
),
},
resource.TestStep{
{
Config: testAccComputeSubnetwork_secondaryIpRanges_update2(cnName, subnetworkName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSubnetworkExists("google_compute_subnetwork.network-with-private-secondary-ip-ranges", &subnetwork),
@ -159,7 +159,7 @@ func TestAccComputeSubnetwork_secondaryIpRanges(t *testing.T) {
testAccCheckComputeSubnetworkHasSecondaryIpRange(&subnetwork, "tf-test-secondary-range-update2", "192.168.11.0/24"),
),
},
resource.TestStep{
{
Config: testAccComputeSubnetwork_secondaryIpRanges_update1(cnName, subnetworkName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeSubnetworkExists("google_compute_subnetwork.network-with-private-secondary-ip-ranges", &subnetwork),

View File

@ -23,14 +23,14 @@ func TestAccComputeTargetHttpProxy_basic(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeTargetHttpProxyDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeTargetHttpProxy_basic1(target, backend, hc, urlmap1, urlmap2),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeTargetHttpProxyExists(
"google_compute_target_http_proxy.foobar"),
),
},
resource.TestStep{
{
ResourceName: "google_compute_target_http_proxy.foobar",
ImportState: true,
ImportStateVerify: true,
@ -53,7 +53,7 @@ func TestAccComputeTargetHttpProxy_update(t *testing.T) {
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeTargetHttpProxyDestroy,
Steps: []resource.TestStep{
resource.TestStep{
{
Config: testAccComputeTargetHttpProxy_basic1(target, backend, hc, urlmap1, urlmap2),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeTargetHttpProxyExists(
@ -61,7 +61,7 @@ func TestAccComputeTargetHttpProxy_update(t *testing.T) {
),
},
resource.TestStep{
{
Config: testAccComputeTargetHttpProxy_basic2(target, backend, hc, urlmap1, urlmap2),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeTargetHttpProxyExists(

Some files were not shown because too many files have changed in this diff Show More