mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-07-03 08:42:39 +00:00
Autogenerate Subnetwork. (#1661)
This commit is contained in:
parent
fbfdd47602
commit
57a2e984ca
|
@ -25,6 +25,7 @@ var GeneratedComputeResourcesMap = map[string]*schema.Resource{
|
|||
"google_compute_https_health_check": resourceComputeHttpsHealthCheck(),
|
||||
"google_compute_route": resourceComputeRoute(),
|
||||
"google_compute_ssl_policy": resourceComputeSslPolicy(),
|
||||
"google_compute_subnetwork": resourceComputeSubnetwork(),
|
||||
"google_compute_target_http_proxy": resourceComputeTargetHttpProxy(),
|
||||
"google_compute_target_https_proxy": resourceComputeTargetHttpsProxy(),
|
||||
"google_compute_target_ssl_proxy": resourceComputeTargetSslProxy(),
|
||||
|
|
|
@ -17,6 +17,7 @@ package google
|
|||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
|
@ -118,43 +119,48 @@ func resourceComputeAddressCreate(d *schema.ResourceData, meta interface{}) erro
|
|||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
addressProp, err := expandComputeAddressAddress(d.Get("address"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("address"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, addressProp)) {
|
||||
obj["address"] = addressProp
|
||||
}
|
||||
addressTypeProp, err := expandComputeAddressAddressType(d.Get("address_type"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("address_type"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, addressTypeProp)) {
|
||||
obj["addressType"] = addressTypeProp
|
||||
}
|
||||
descriptionProp, err := expandComputeAddressDescription(d.Get("description"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
|
||||
obj["description"] = descriptionProp
|
||||
}
|
||||
nameProp, err := expandComputeAddressName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
networkTierProp, err := expandComputeAddressNetworkTier(d.Get("network_tier"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("network_tier"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, networkTierProp)) {
|
||||
obj["networkTier"] = networkTierProp
|
||||
}
|
||||
subnetworkProp, err := expandComputeAddressSubnetwork(d.Get("subnetwork"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("subnetwork"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, subnetworkProp)) {
|
||||
obj["subnetwork"] = subnetworkProp
|
||||
}
|
||||
regionProp, err := expandComputeAddressRegion(d.Get("region"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"address": addressProp,
|
||||
"addressType": addressTypeProp,
|
||||
"description": descriptionProp,
|
||||
"name": nameProp,
|
||||
"networkTier": networkTierProp,
|
||||
"subnetwork": subnetworkProp,
|
||||
"region": regionProp,
|
||||
} else if v, ok := d.GetOkExists("region"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, regionProp)) {
|
||||
obj["region"] = regionProp
|
||||
}
|
||||
|
||||
url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/addresses")
|
||||
|
|
|
@ -17,6 +17,7 @@ package google
|
|||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
|
@ -85,28 +86,30 @@ func resourceComputeBackendBucketCreate(d *schema.ResourceData, meta interface{}
|
|||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
bucketNameProp, err := expandComputeBackendBucketBucketName(d.Get("bucket_name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("bucket_name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, bucketNameProp)) {
|
||||
obj["bucketName"] = bucketNameProp
|
||||
}
|
||||
descriptionProp, err := expandComputeBackendBucketDescription(d.Get("description"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
|
||||
obj["description"] = descriptionProp
|
||||
}
|
||||
enableCdnProp, err := expandComputeBackendBucketEnableCdn(d.Get("enable_cdn"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("enable_cdn"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, enableCdnProp)) {
|
||||
obj["enableCdn"] = enableCdnProp
|
||||
}
|
||||
nameProp, err := expandComputeBackendBucketName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"bucketName": bucketNameProp,
|
||||
"description": descriptionProp,
|
||||
"enableCdn": enableCdnProp,
|
||||
"name": nameProp,
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
|
||||
url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/backendBuckets")
|
||||
|
@ -199,28 +202,30 @@ func resourceComputeBackendBucketUpdate(d *schema.ResourceData, meta interface{}
|
|||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
bucketNameProp, err := expandComputeBackendBucketBucketName(d.Get("bucket_name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("bucket_name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, bucketNameProp)) {
|
||||
obj["bucketName"] = bucketNameProp
|
||||
}
|
||||
descriptionProp, err := expandComputeBackendBucketDescription(d.Get("description"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
|
||||
obj["description"] = descriptionProp
|
||||
}
|
||||
enableCdnProp, err := expandComputeBackendBucketEnableCdn(d.Get("enable_cdn"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("enable_cdn"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, enableCdnProp)) {
|
||||
obj["enableCdn"] = enableCdnProp
|
||||
}
|
||||
nameProp, err := expandComputeBackendBucketName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"bucketName": bucketNameProp,
|
||||
"description": descriptionProp,
|
||||
"enableCdn": enableCdnProp,
|
||||
"name": nameProp,
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
|
||||
url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/backendBuckets/{{name}}")
|
||||
|
|
|
@ -17,6 +17,7 @@ package google
|
|||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -434,64 +435,74 @@ func resourceComputeDiskCreate(d *schema.ResourceData, meta interface{}) error {
|
|||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
descriptionProp, err := expandComputeDiskDescription(d.Get("description"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
|
||||
obj["description"] = descriptionProp
|
||||
}
|
||||
labelsProp, err := expandComputeDiskLabels(d.Get("labels"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("labels"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, labelsProp)) {
|
||||
obj["labels"] = labelsProp
|
||||
}
|
||||
nameProp, err := expandComputeDiskName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
sizeGbProp, err := expandComputeDiskSize(d.Get("size"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("size"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, sizeGbProp)) {
|
||||
obj["sizeGb"] = sizeGbProp
|
||||
}
|
||||
sourceImageProp, err := expandComputeDiskImage(d.Get("image"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("image"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, sourceImageProp)) {
|
||||
obj["sourceImage"] = sourceImageProp
|
||||
}
|
||||
typeProp, err := expandComputeDiskType(d.Get("type"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("type"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, typeProp)) {
|
||||
obj["type"] = typeProp
|
||||
}
|
||||
zoneProp, err := expandComputeDiskZone(d.Get("zone"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("zone"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, zoneProp)) {
|
||||
obj["zone"] = zoneProp
|
||||
}
|
||||
diskEncryptionKeyProp, err := expandComputeDiskDiskEncryptionKey(d.Get("disk_encryption_key"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("disk_encryption_key"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, diskEncryptionKeyProp)) {
|
||||
obj["diskEncryptionKey"] = diskEncryptionKeyProp
|
||||
}
|
||||
sourceImageEncryptionKeyProp, err := expandComputeDiskSourceImageEncryptionKey(d.Get("source_image_encryption_key"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("source_image_encryption_key"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, sourceImageEncryptionKeyProp)) {
|
||||
obj["sourceImageEncryptionKey"] = sourceImageEncryptionKeyProp
|
||||
}
|
||||
sourceSnapshotProp, err := expandComputeDiskSnapshot(d.Get("snapshot"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("snapshot"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, sourceSnapshotProp)) {
|
||||
obj["sourceSnapshot"] = sourceSnapshotProp
|
||||
}
|
||||
sourceSnapshotEncryptionKeyProp, err := expandComputeDiskSourceSnapshotEncryptionKey(d.Get("source_snapshot_encryption_key"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("source_snapshot_encryption_key"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, sourceSnapshotEncryptionKeyProp)) {
|
||||
obj["sourceSnapshotEncryptionKey"] = sourceSnapshotEncryptionKeyProp
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"description": descriptionProp,
|
||||
"labels": labelsProp,
|
||||
"name": nameProp,
|
||||
"sizeGb": sizeGbProp,
|
||||
"sourceImage": sourceImageProp,
|
||||
"type": typeProp,
|
||||
"zone": zoneProp,
|
||||
"diskEncryptionKey": diskEncryptionKeyProp,
|
||||
"sourceImageEncryptionKey": sourceImageEncryptionKeyProp,
|
||||
"sourceSnapshot": sourceSnapshotProp,
|
||||
"sourceSnapshotEncryptionKey": sourceSnapshotEncryptionKeyProp,
|
||||
}
|
||||
obj, err = resourceComputeDiskEncoder(d, meta, obj)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -631,7 +642,6 @@ func resourceComputeDiskUpdate(d *schema.ResourceData, meta interface{}) error {
|
|||
return err
|
||||
}
|
||||
|
||||
var obj map[string]interface{}
|
||||
var url string
|
||||
var res map[string]interface{}
|
||||
op := &compute.Operation{}
|
||||
|
@ -639,16 +649,16 @@ func resourceComputeDiskUpdate(d *schema.ResourceData, meta interface{}) error {
|
|||
d.Partial(true)
|
||||
|
||||
if d.HasChange("label_fingerprint") || d.HasChange("labels") {
|
||||
obj := make(map[string]interface{})
|
||||
labelFingerprintProp := d.Get("label_fingerprint")
|
||||
obj["labelFingerprint"] = labelFingerprintProp
|
||||
labelsProp, err := expandComputeDiskLabels(d.Get("labels"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("labels"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, labelsProp)) {
|
||||
obj["labels"] = labelsProp
|
||||
}
|
||||
|
||||
obj = map[string]interface{}{
|
||||
"labelFingerprint": labelFingerprintProp,
|
||||
"labels": labelsProp,
|
||||
}
|
||||
url, err = replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/zones/{{zone}}/disks/{{name}}/setLabels")
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -675,14 +685,14 @@ func resourceComputeDiskUpdate(d *schema.ResourceData, meta interface{}) error {
|
|||
d.SetPartial("labels")
|
||||
}
|
||||
if d.HasChange("size") {
|
||||
obj := make(map[string]interface{})
|
||||
sizeGbProp, err := expandComputeDiskSize(d.Get("size"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("size"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, sizeGbProp)) {
|
||||
obj["sizeGb"] = sizeGbProp
|
||||
}
|
||||
|
||||
obj = map[string]interface{}{
|
||||
"sizeGb": sizeGbProp,
|
||||
}
|
||||
url, err = replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/zones/{{zone}}/disks/{{name}}/resize")
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -17,6 +17,7 @@ package google
|
|||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
|
@ -87,23 +88,24 @@ func resourceComputeGlobalAddressCreate(d *schema.ResourceData, meta interface{}
|
|||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
descriptionProp, err := expandComputeGlobalAddressDescription(d.Get("description"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
|
||||
obj["description"] = descriptionProp
|
||||
}
|
||||
nameProp, err := expandComputeGlobalAddressName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
ipVersionProp, err := expandComputeGlobalAddressIpVersion(d.Get("ip_version"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"description": descriptionProp,
|
||||
"name": nameProp,
|
||||
"ipVersion": ipVersionProp,
|
||||
} else if v, ok := d.GetOkExists("ip_version"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, ipVersionProp)) {
|
||||
obj["ipVersion"] = ipVersionProp
|
||||
}
|
||||
|
||||
url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/addresses")
|
||||
|
|
|
@ -17,6 +17,7 @@ package google
|
|||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
|
@ -111,53 +112,60 @@ func resourceComputeHttpHealthCheckCreate(d *schema.ResourceData, meta interface
|
|||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
checkIntervalSecProp, err := expandComputeHttpHealthCheckCheckIntervalSec(d.Get("check_interval_sec"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("check_interval_sec"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, checkIntervalSecProp)) {
|
||||
obj["checkIntervalSec"] = checkIntervalSecProp
|
||||
}
|
||||
descriptionProp, err := expandComputeHttpHealthCheckDescription(d.Get("description"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
|
||||
obj["description"] = descriptionProp
|
||||
}
|
||||
healthyThresholdProp, err := expandComputeHttpHealthCheckHealthyThreshold(d.Get("healthy_threshold"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("healthy_threshold"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, healthyThresholdProp)) {
|
||||
obj["healthyThreshold"] = healthyThresholdProp
|
||||
}
|
||||
hostProp, err := expandComputeHttpHealthCheckHost(d.Get("host"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("host"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, hostProp)) {
|
||||
obj["host"] = hostProp
|
||||
}
|
||||
nameProp, err := expandComputeHttpHealthCheckName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
portProp, err := expandComputeHttpHealthCheckPort(d.Get("port"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("port"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, portProp)) {
|
||||
obj["port"] = portProp
|
||||
}
|
||||
requestPathProp, err := expandComputeHttpHealthCheckRequestPath(d.Get("request_path"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("request_path"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, requestPathProp)) {
|
||||
obj["requestPath"] = requestPathProp
|
||||
}
|
||||
timeoutSecProp, err := expandComputeHttpHealthCheckTimeoutSec(d.Get("timeout_sec"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("timeout_sec"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, timeoutSecProp)) {
|
||||
obj["timeoutSec"] = timeoutSecProp
|
||||
}
|
||||
unhealthyThresholdProp, err := expandComputeHttpHealthCheckUnhealthyThreshold(d.Get("unhealthy_threshold"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"checkIntervalSec": checkIntervalSecProp,
|
||||
"description": descriptionProp,
|
||||
"healthyThreshold": healthyThresholdProp,
|
||||
"host": hostProp,
|
||||
"name": nameProp,
|
||||
"port": portProp,
|
||||
"requestPath": requestPathProp,
|
||||
"timeoutSec": timeoutSecProp,
|
||||
"unhealthyThreshold": unhealthyThresholdProp,
|
||||
} else if v, ok := d.GetOkExists("unhealthy_threshold"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, unhealthyThresholdProp)) {
|
||||
obj["unhealthyThreshold"] = unhealthyThresholdProp
|
||||
}
|
||||
|
||||
url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/httpHealthChecks")
|
||||
|
@ -265,53 +273,60 @@ func resourceComputeHttpHealthCheckUpdate(d *schema.ResourceData, meta interface
|
|||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
checkIntervalSecProp, err := expandComputeHttpHealthCheckCheckIntervalSec(d.Get("check_interval_sec"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("check_interval_sec"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, checkIntervalSecProp)) {
|
||||
obj["checkIntervalSec"] = checkIntervalSecProp
|
||||
}
|
||||
descriptionProp, err := expandComputeHttpHealthCheckDescription(d.Get("description"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
|
||||
obj["description"] = descriptionProp
|
||||
}
|
||||
healthyThresholdProp, err := expandComputeHttpHealthCheckHealthyThreshold(d.Get("healthy_threshold"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("healthy_threshold"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, healthyThresholdProp)) {
|
||||
obj["healthyThreshold"] = healthyThresholdProp
|
||||
}
|
||||
hostProp, err := expandComputeHttpHealthCheckHost(d.Get("host"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("host"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, hostProp)) {
|
||||
obj["host"] = hostProp
|
||||
}
|
||||
nameProp, err := expandComputeHttpHealthCheckName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
portProp, err := expandComputeHttpHealthCheckPort(d.Get("port"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("port"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, portProp)) {
|
||||
obj["port"] = portProp
|
||||
}
|
||||
requestPathProp, err := expandComputeHttpHealthCheckRequestPath(d.Get("request_path"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("request_path"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, requestPathProp)) {
|
||||
obj["requestPath"] = requestPathProp
|
||||
}
|
||||
timeoutSecProp, err := expandComputeHttpHealthCheckTimeoutSec(d.Get("timeout_sec"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("timeout_sec"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, timeoutSecProp)) {
|
||||
obj["timeoutSec"] = timeoutSecProp
|
||||
}
|
||||
unhealthyThresholdProp, err := expandComputeHttpHealthCheckUnhealthyThreshold(d.Get("unhealthy_threshold"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"checkIntervalSec": checkIntervalSecProp,
|
||||
"description": descriptionProp,
|
||||
"healthyThreshold": healthyThresholdProp,
|
||||
"host": hostProp,
|
||||
"name": nameProp,
|
||||
"port": portProp,
|
||||
"requestPath": requestPathProp,
|
||||
"timeoutSec": timeoutSecProp,
|
||||
"unhealthyThreshold": unhealthyThresholdProp,
|
||||
} else if v, ok := d.GetOkExists("unhealthy_threshold"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, unhealthyThresholdProp)) {
|
||||
obj["unhealthyThreshold"] = unhealthyThresholdProp
|
||||
}
|
||||
|
||||
url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/httpHealthChecks/{{name}}")
|
||||
|
|
|
@ -17,6 +17,7 @@ package google
|
|||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
|
@ -111,53 +112,60 @@ func resourceComputeHttpsHealthCheckCreate(d *schema.ResourceData, meta interfac
|
|||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
checkIntervalSecProp, err := expandComputeHttpsHealthCheckCheckIntervalSec(d.Get("check_interval_sec"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("check_interval_sec"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, checkIntervalSecProp)) {
|
||||
obj["checkIntervalSec"] = checkIntervalSecProp
|
||||
}
|
||||
descriptionProp, err := expandComputeHttpsHealthCheckDescription(d.Get("description"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
|
||||
obj["description"] = descriptionProp
|
||||
}
|
||||
healthyThresholdProp, err := expandComputeHttpsHealthCheckHealthyThreshold(d.Get("healthy_threshold"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("healthy_threshold"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, healthyThresholdProp)) {
|
||||
obj["healthyThreshold"] = healthyThresholdProp
|
||||
}
|
||||
hostProp, err := expandComputeHttpsHealthCheckHost(d.Get("host"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("host"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, hostProp)) {
|
||||
obj["host"] = hostProp
|
||||
}
|
||||
nameProp, err := expandComputeHttpsHealthCheckName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
portProp, err := expandComputeHttpsHealthCheckPort(d.Get("port"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("port"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, portProp)) {
|
||||
obj["port"] = portProp
|
||||
}
|
||||
requestPathProp, err := expandComputeHttpsHealthCheckRequestPath(d.Get("request_path"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("request_path"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, requestPathProp)) {
|
||||
obj["requestPath"] = requestPathProp
|
||||
}
|
||||
timeoutSecProp, err := expandComputeHttpsHealthCheckTimeoutSec(d.Get("timeout_sec"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("timeout_sec"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, timeoutSecProp)) {
|
||||
obj["timeoutSec"] = timeoutSecProp
|
||||
}
|
||||
unhealthyThresholdProp, err := expandComputeHttpsHealthCheckUnhealthyThreshold(d.Get("unhealthy_threshold"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"checkIntervalSec": checkIntervalSecProp,
|
||||
"description": descriptionProp,
|
||||
"healthyThreshold": healthyThresholdProp,
|
||||
"host": hostProp,
|
||||
"name": nameProp,
|
||||
"port": portProp,
|
||||
"requestPath": requestPathProp,
|
||||
"timeoutSec": timeoutSecProp,
|
||||
"unhealthyThreshold": unhealthyThresholdProp,
|
||||
} else if v, ok := d.GetOkExists("unhealthy_threshold"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, unhealthyThresholdProp)) {
|
||||
obj["unhealthyThreshold"] = unhealthyThresholdProp
|
||||
}
|
||||
|
||||
url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/httpsHealthChecks")
|
||||
|
@ -265,53 +273,60 @@ func resourceComputeHttpsHealthCheckUpdate(d *schema.ResourceData, meta interfac
|
|||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
checkIntervalSecProp, err := expandComputeHttpsHealthCheckCheckIntervalSec(d.Get("check_interval_sec"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("check_interval_sec"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, checkIntervalSecProp)) {
|
||||
obj["checkIntervalSec"] = checkIntervalSecProp
|
||||
}
|
||||
descriptionProp, err := expandComputeHttpsHealthCheckDescription(d.Get("description"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
|
||||
obj["description"] = descriptionProp
|
||||
}
|
||||
healthyThresholdProp, err := expandComputeHttpsHealthCheckHealthyThreshold(d.Get("healthy_threshold"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("healthy_threshold"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, healthyThresholdProp)) {
|
||||
obj["healthyThreshold"] = healthyThresholdProp
|
||||
}
|
||||
hostProp, err := expandComputeHttpsHealthCheckHost(d.Get("host"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("host"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, hostProp)) {
|
||||
obj["host"] = hostProp
|
||||
}
|
||||
nameProp, err := expandComputeHttpsHealthCheckName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
portProp, err := expandComputeHttpsHealthCheckPort(d.Get("port"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("port"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, portProp)) {
|
||||
obj["port"] = portProp
|
||||
}
|
||||
requestPathProp, err := expandComputeHttpsHealthCheckRequestPath(d.Get("request_path"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("request_path"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, requestPathProp)) {
|
||||
obj["requestPath"] = requestPathProp
|
||||
}
|
||||
timeoutSecProp, err := expandComputeHttpsHealthCheckTimeoutSec(d.Get("timeout_sec"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("timeout_sec"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, timeoutSecProp)) {
|
||||
obj["timeoutSec"] = timeoutSecProp
|
||||
}
|
||||
unhealthyThresholdProp, err := expandComputeHttpsHealthCheckUnhealthyThreshold(d.Get("unhealthy_threshold"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"checkIntervalSec": checkIntervalSecProp,
|
||||
"description": descriptionProp,
|
||||
"healthyThreshold": healthyThresholdProp,
|
||||
"host": hostProp,
|
||||
"name": nameProp,
|
||||
"port": portProp,
|
||||
"requestPath": requestPathProp,
|
||||
"timeoutSec": timeoutSecProp,
|
||||
"unhealthyThreshold": unhealthyThresholdProp,
|
||||
} else if v, ok := d.GetOkExists("unhealthy_threshold"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, unhealthyThresholdProp)) {
|
||||
obj["unhealthyThreshold"] = unhealthyThresholdProp
|
||||
}
|
||||
|
||||
url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/httpsHealthChecks/{{name}}")
|
||||
|
|
|
@ -17,6 +17,7 @@ package google
|
|||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
|
@ -130,58 +131,66 @@ func resourceComputeRouteCreate(d *schema.ResourceData, meta interface{}) error
|
|||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
destRangeProp, err := expandComputeRouteDestRange(d.Get("dest_range"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("dest_range"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, destRangeProp)) {
|
||||
obj["destRange"] = destRangeProp
|
||||
}
|
||||
descriptionProp, err := expandComputeRouteDescription(d.Get("description"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
|
||||
obj["description"] = descriptionProp
|
||||
}
|
||||
nameProp, err := expandComputeRouteName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
networkProp, err := expandComputeRouteNetwork(d.Get("network"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("network"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, networkProp)) {
|
||||
obj["network"] = networkProp
|
||||
}
|
||||
priorityProp, err := expandComputeRoutePriority(d.Get("priority"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("priority"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, priorityProp)) {
|
||||
obj["priority"] = priorityProp
|
||||
}
|
||||
tagsProp, err := expandComputeRouteTags(d.Get("tags"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("tags"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, tagsProp)) {
|
||||
obj["tags"] = tagsProp
|
||||
}
|
||||
nextHopGatewayProp, err := expandComputeRouteNextHopGateway(d.Get("next_hop_gateway"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("next_hop_gateway"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nextHopGatewayProp)) {
|
||||
obj["nextHopGateway"] = nextHopGatewayProp
|
||||
}
|
||||
nextHopInstanceProp, err := expandComputeRouteNextHopInstance(d.Get("next_hop_instance"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("next_hop_instance"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nextHopInstanceProp)) {
|
||||
obj["nextHopInstance"] = nextHopInstanceProp
|
||||
}
|
||||
nextHopIpProp, err := expandComputeRouteNextHopIp(d.Get("next_hop_ip"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("next_hop_ip"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nextHopIpProp)) {
|
||||
obj["nextHopIp"] = nextHopIpProp
|
||||
}
|
||||
nextHopVpnTunnelProp, err := expandComputeRouteNextHopVpnTunnel(d.Get("next_hop_vpn_tunnel"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"destRange": destRangeProp,
|
||||
"description": descriptionProp,
|
||||
"name": nameProp,
|
||||
"network": networkProp,
|
||||
"priority": priorityProp,
|
||||
"tags": tagsProp,
|
||||
"nextHopGateway": nextHopGatewayProp,
|
||||
"nextHopInstance": nextHopInstanceProp,
|
||||
"nextHopIp": nextHopIpProp,
|
||||
"nextHopVpnTunnel": nextHopVpnTunnelProp,
|
||||
} else if v, ok := d.GetOkExists("next_hop_vpn_tunnel"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nextHopVpnTunnelProp)) {
|
||||
obj["nextHopVpnTunnel"] = nextHopVpnTunnelProp
|
||||
}
|
||||
|
||||
url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/routes")
|
||||
|
|
|
@ -17,6 +17,7 @@ package google
|
|||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
|
@ -132,33 +133,36 @@ func resourceComputeSslPolicyCreate(d *schema.ResourceData, meta interface{}) er
|
|||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
descriptionProp, err := expandComputeSslPolicyDescription(d.Get("description"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
|
||||
obj["description"] = descriptionProp
|
||||
}
|
||||
nameProp, err := expandComputeSslPolicyName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
profileProp, err := expandComputeSslPolicyProfile(d.Get("profile"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("profile"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, profileProp)) {
|
||||
obj["profile"] = profileProp
|
||||
}
|
||||
minTlsVersionProp, err := expandComputeSslPolicyMinTlsVersion(d.Get("min_tls_version"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("min_tls_version"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, minTlsVersionProp)) {
|
||||
obj["minTlsVersion"] = minTlsVersionProp
|
||||
}
|
||||
customFeaturesProp, err := expandComputeSslPolicyCustomFeatures(d.Get("custom_features"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"description": descriptionProp,
|
||||
"name": nameProp,
|
||||
"profile": profileProp,
|
||||
"minTlsVersion": minTlsVersionProp,
|
||||
"customFeatures": customFeaturesProp,
|
||||
} else if v, ok := d.GetOkExists("custom_features"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, customFeaturesProp)) {
|
||||
obj["customFeatures"] = customFeaturesProp
|
||||
}
|
||||
|
||||
url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/sslPolicies")
|
||||
|
@ -260,33 +264,36 @@ func resourceComputeSslPolicyUpdate(d *schema.ResourceData, meta interface{}) er
|
|||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
descriptionProp, err := expandComputeSslPolicyDescription(d.Get("description"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
|
||||
obj["description"] = descriptionProp
|
||||
}
|
||||
nameProp, err := expandComputeSslPolicyName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
profileProp, err := expandComputeSslPolicyProfile(d.Get("profile"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("profile"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, profileProp)) {
|
||||
obj["profile"] = profileProp
|
||||
}
|
||||
minTlsVersionProp, err := expandComputeSslPolicyMinTlsVersion(d.Get("min_tls_version"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("min_tls_version"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, minTlsVersionProp)) {
|
||||
obj["minTlsVersion"] = minTlsVersionProp
|
||||
}
|
||||
customFeaturesProp, err := expandComputeSslPolicyCustomFeatures(d.Get("custom_features"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"description": descriptionProp,
|
||||
"name": nameProp,
|
||||
"profile": profileProp,
|
||||
"minTlsVersion": minTlsVersionProp,
|
||||
"customFeatures": customFeaturesProp,
|
||||
} else if v, ok := d.GetOkExists("custom_features"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, customFeaturesProp)) {
|
||||
obj["customFeatures"] = customFeaturesProp
|
||||
}
|
||||
|
||||
obj, err = resourceComputeSslPolicyUpdateEncoder(d, meta, obj)
|
||||
|
|
|
@ -1,396 +1,33 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// This file is automatically generated by Magic Modules and manual
|
||||
// changes will be clobbered when the file is regenerated.
|
||||
//
|
||||
// Please read more about how to change this file in
|
||||
// .github/CONTRIBUTING.md.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
package google
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/apparentlymart/go-cidr/cidr"
|
||||
"github.com/hashicorp/terraform/helper/customdiff"
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
computeBeta "google.golang.org/api/compute/v0.beta"
|
||||
"google.golang.org/api/compute/v1"
|
||||
compute "google.golang.org/api/compute/v1"
|
||||
)
|
||||
|
||||
func resourceComputeSubnetwork() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
Create: resourceComputeSubnetworkCreate,
|
||||
Read: resourceComputeSubnetworkRead,
|
||||
Update: resourceComputeSubnetworkUpdate,
|
||||
Delete: resourceComputeSubnetworkDelete,
|
||||
Importer: &schema.ResourceImporter{
|
||||
State: resourceComputeSubnetworkImportState,
|
||||
},
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Create: schema.DefaultTimeout(6 * time.Minute),
|
||||
Update: schema.DefaultTimeout(6 * time.Minute),
|
||||
Delete: schema.DefaultTimeout(6 * time.Minute),
|
||||
},
|
||||
|
||||
Schema: map[string]*schema.Schema{
|
||||
"ip_cidr_range": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ValidateFunc: validateIpCidrRange,
|
||||
// ForceNew only if it shrinks the CIDR range, this is set in CustomizeDiff below.
|
||||
},
|
||||
|
||||
"name": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
|
||||
"network": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
DiffSuppressFunc: compareSelfLinkOrResourceName,
|
||||
},
|
||||
|
||||
"description": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
|
||||
"fingerprint": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
"gateway_address": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
"project": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
|
||||
"region": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
|
||||
"private_ip_google_access": &schema.Schema{
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
},
|
||||
|
||||
"secondary_ip_range": &schema.Schema{
|
||||
Type: schema.TypeList,
|
||||
Optional: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"range_name": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ValidateFunc: validateGCPName,
|
||||
},
|
||||
"ip_cidr_range": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
"enable_flow_logs": &schema.Schema{
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
},
|
||||
|
||||
"self_link": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
|
||||
CustomizeDiff: customdiff.All(
|
||||
customdiff.ForceNewIfChange("ip_cidr_range", isShrinkageIpCidr),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func resourceComputeSubnetworkCreate(d *schema.ResourceData, meta interface{}) error {
|
||||
config := meta.(*Config)
|
||||
network, err := ParseNetworkFieldValue(d.Get("network").(string), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
region, err := getRegion(d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
project, err := getProject(d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Build the subnetwork parameters
|
||||
subnetwork := &computeBeta.Subnetwork{
|
||||
Name: d.Get("name").(string),
|
||||
Description: d.Get("description").(string),
|
||||
IpCidrRange: d.Get("ip_cidr_range").(string),
|
||||
PrivateIpGoogleAccess: d.Get("private_ip_google_access").(bool),
|
||||
SecondaryIpRanges: expandSecondaryRangesV0Beta(d.Get("secondary_ip_range").([]interface{})),
|
||||
Network: network.RelativeLink(),
|
||||
EnableFlowLogs: d.Get("enable_flow_logs").(bool),
|
||||
}
|
||||
|
||||
log.Printf("[DEBUG] Subnetwork insert request: %#v", subnetwork)
|
||||
|
||||
op, err := config.clientComputeBeta.Subnetworks.Insert(project, region, subnetwork).Do()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error creating subnetwork: %s", err)
|
||||
}
|
||||
|
||||
// It probably maybe worked, so store the ID now. ID is a combination of region + subnetwork
|
||||
// name because subnetwork names are not unique in a project, per the Google docs:
|
||||
// "When creating a new subnetwork, its name has to be unique in that project for that region, even across networks.
|
||||
// The same name can appear twice in a project, as long as each one is in a different region."
|
||||
// https://cloud.google.com/compute/docs/subnetworks
|
||||
subnetwork.Region = region
|
||||
d.SetId(createSubnetIDBeta(subnetwork))
|
||||
|
||||
err = computeSharedOperationWaitTime(config.clientCompute, op, project, int(d.Timeout(schema.TimeoutCreate).Minutes()), "Creating Subnetwork")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return resourceComputeSubnetworkRead(d, meta)
|
||||
}
|
||||
|
||||
func resourceComputeSubnetworkRead(d *schema.ResourceData, meta interface{}) error {
|
||||
config := meta.(*Config)
|
||||
|
||||
region, err := getRegion(d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
project, err := getProject(d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
name := d.Get("name").(string)
|
||||
|
||||
subnetwork, err := config.clientComputeBeta.Subnetworks.Get(project, region, name).Do()
|
||||
if err != nil {
|
||||
return handleNotFoundError(err, d, fmt.Sprintf("Subnetwork %q", name))
|
||||
}
|
||||
|
||||
d.Set("name", subnetwork.Name)
|
||||
d.Set("ip_cidr_range", subnetwork.IpCidrRange)
|
||||
d.Set("network", subnetwork.Network)
|
||||
d.Set("description", subnetwork.Description)
|
||||
d.Set("private_ip_google_access", subnetwork.PrivateIpGoogleAccess)
|
||||
d.Set("gateway_address", subnetwork.GatewayAddress)
|
||||
d.Set("secondary_ip_range", flattenSecondaryRangesV0Beta(subnetwork.SecondaryIpRanges))
|
||||
d.Set("project", project)
|
||||
d.Set("region", region)
|
||||
d.Set("enable_flow_logs", subnetwork.EnableFlowLogs)
|
||||
d.Set("self_link", ConvertSelfLinkToV1(subnetwork.SelfLink))
|
||||
d.Set("fingerprint", subnetwork.Fingerprint)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func resourceComputeSubnetworkUpdate(d *schema.ResourceData, meta interface{}) error {
|
||||
config := meta.(*Config)
|
||||
|
||||
region, err := getRegion(d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
project, err := getProject(d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
d.Partial(true)
|
||||
|
||||
if d.HasChange("private_ip_google_access") {
|
||||
subnetworksSetPrivateIpGoogleAccessRequest := &compute.SubnetworksSetPrivateIpGoogleAccessRequest{
|
||||
PrivateIpGoogleAccess: d.Get("private_ip_google_access").(bool),
|
||||
}
|
||||
|
||||
log.Printf("[DEBUG] Updating Subnetwork PrivateIpGoogleAccess %q: %#v", d.Id(), subnetworksSetPrivateIpGoogleAccessRequest)
|
||||
|
||||
op, err := config.clientCompute.Subnetworks.SetPrivateIpGoogleAccess(
|
||||
project, region, d.Get("name").(string), subnetworksSetPrivateIpGoogleAccessRequest).Do()
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error updating subnetwork PrivateIpGoogleAccess: %s", err)
|
||||
}
|
||||
|
||||
err = computeSharedOperationWaitTime(config.clientCompute, op, project, int(d.Timeout(schema.TimeoutUpdate).Minutes()), "Updating Subnetwork PrivateIpGoogleAccess")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
d.SetPartial("private_ip_google_access")
|
||||
}
|
||||
|
||||
if d.HasChange("ip_cidr_range") {
|
||||
r := &compute.SubnetworksExpandIpCidrRangeRequest{
|
||||
IpCidrRange: d.Get("ip_cidr_range").(string),
|
||||
}
|
||||
|
||||
op, err := config.clientCompute.Subnetworks.ExpandIpCidrRange(project, region, d.Get("name").(string), r).Do()
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error expanding the ip cidr range: %s", err)
|
||||
}
|
||||
|
||||
err = computeSharedOperationWaitTime(config.clientCompute, op, project, int(d.Timeout(schema.TimeoutUpdate).Minutes()), "Expanding Subnetwork IP CIDR range")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
d.SetPartial("ip_cidr_range")
|
||||
}
|
||||
|
||||
if d.HasChange("secondary_ip_range") || d.HasChange("enable_flow_logs") {
|
||||
v0BetaSubnetwork := &computeBeta.Subnetwork{
|
||||
Fingerprint: d.Get("fingerprint").(string),
|
||||
}
|
||||
if d.HasChange("secondary_ip_range") {
|
||||
v0BetaSubnetwork.SecondaryIpRanges = expandSecondaryRangesV0Beta(d.Get("secondary_ip_range").([]interface{}))
|
||||
}
|
||||
if d.HasChange("enable_flow_logs") {
|
||||
v0BetaSubnetwork.EnableFlowLogs = d.Get("enable_flow_logs").(bool)
|
||||
v0BetaSubnetwork.ForceSendFields = append(v0BetaSubnetwork.ForceSendFields, "EnableFlowLogs")
|
||||
}
|
||||
|
||||
op, err := config.clientComputeBeta.Subnetworks.Patch(
|
||||
project, region, d.Get("name").(string), v0BetaSubnetwork).Do()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error updating subnetwork %q: %s", d.Id(), err)
|
||||
}
|
||||
|
||||
err = computeSharedOperationWaitTime(config.clientCompute, op, project, int(d.Timeout(schema.TimeoutUpdate).Minutes()), "Updating Subnetwork")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
d.SetPartial("secondary_ip_range")
|
||||
d.SetPartial("enable_flow_logs")
|
||||
}
|
||||
|
||||
d.Partial(false)
|
||||
|
||||
return resourceComputeSubnetworkRead(d, meta)
|
||||
}
|
||||
|
||||
func resourceComputeSubnetworkDelete(d *schema.ResourceData, meta interface{}) error {
|
||||
config := meta.(*Config)
|
||||
|
||||
region, err := getRegion(d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
project, err := getProject(d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Delete the subnetwork
|
||||
op, err := config.clientCompute.Subnetworks.Delete(
|
||||
project, region, d.Get("name").(string)).Do()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error deleting subnetwork: %s", err)
|
||||
}
|
||||
|
||||
err = computeSharedOperationWaitTime(config.clientCompute, op, project, int(d.Timeout(schema.TimeoutDelete).Minutes()), "Deleting Subnetwork")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
d.SetId("")
|
||||
return nil
|
||||
}
|
||||
|
||||
func resourceComputeSubnetworkImportState(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
|
||||
parts := strings.Split(d.Id(), "/")
|
||||
if len(parts) != 2 {
|
||||
return nil, fmt.Errorf("Invalid compute subnetwork specifier. Expecting {region}/{name}")
|
||||
}
|
||||
|
||||
region, name := parts[0], parts[1]
|
||||
d.Set("region", region)
|
||||
d.Set("name", name)
|
||||
|
||||
d.SetId(createSubnetID(&compute.Subnetwork{
|
||||
Region: region,
|
||||
Name: name,
|
||||
}))
|
||||
|
||||
return []*schema.ResourceData{d}, nil
|
||||
}
|
||||
|
||||
func splitSubnetID(id string) (region string, name string) {
|
||||
parts := strings.Split(id, "/")
|
||||
region = parts[0]
|
||||
name = parts[1]
|
||||
return
|
||||
}
|
||||
|
||||
func expandSecondaryRanges(configured []interface{}) []*compute.SubnetworkSecondaryRange {
|
||||
secondaryRanges := make([]*compute.SubnetworkSecondaryRange, 0, len(configured))
|
||||
for _, raw := range configured {
|
||||
data := raw.(map[string]interface{})
|
||||
secondaryRange := compute.SubnetworkSecondaryRange{
|
||||
RangeName: data["range_name"].(string),
|
||||
IpCidrRange: data["ip_cidr_range"].(string),
|
||||
}
|
||||
|
||||
secondaryRanges = append(secondaryRanges, &secondaryRange)
|
||||
}
|
||||
return secondaryRanges
|
||||
}
|
||||
|
||||
func expandSecondaryRangesV0Beta(configured []interface{}) []*computeBeta.SubnetworkSecondaryRange {
|
||||
secondaryRanges := make([]*computeBeta.SubnetworkSecondaryRange, 0, len(configured))
|
||||
for _, raw := range configured {
|
||||
data := raw.(map[string]interface{})
|
||||
secondaryRange := computeBeta.SubnetworkSecondaryRange{
|
||||
RangeName: data["range_name"].(string),
|
||||
IpCidrRange: data["ip_cidr_range"].(string),
|
||||
}
|
||||
|
||||
secondaryRanges = append(secondaryRanges, &secondaryRange)
|
||||
}
|
||||
return secondaryRanges
|
||||
}
|
||||
|
||||
func flattenSecondaryRangesV0Beta(secondaryRanges []*computeBeta.SubnetworkSecondaryRange) []map[string]interface{} {
|
||||
secondaryRangesSchema := make([]map[string]interface{}, 0, len(secondaryRanges))
|
||||
for _, secondaryRange := range secondaryRanges {
|
||||
data := map[string]interface{}{
|
||||
"range_name": secondaryRange.RangeName,
|
||||
"ip_cidr_range": secondaryRange.IpCidrRange,
|
||||
}
|
||||
|
||||
secondaryRangesSchema = append(secondaryRangesSchema, data)
|
||||
}
|
||||
return secondaryRangesSchema
|
||||
}
|
||||
|
||||
// Whether the IP CIDR change shrinks the block.
|
||||
func isShrinkageIpCidr(old, new, _ interface{}) bool {
|
||||
_, oldCidr, oldErr := net.ParseCIDR(old.(string))
|
||||
|
@ -410,3 +47,580 @@ func isShrinkageIpCidr(old, new, _ interface{}) bool {
|
|||
|
||||
return true
|
||||
}
|
||||
|
||||
func splitSubnetID(id string) (region string, name string) {
|
||||
parts := strings.Split(id, "/")
|
||||
region = parts[0]
|
||||
name = parts[1]
|
||||
return
|
||||
}
|
||||
|
||||
func resourceComputeSubnetwork() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
Create: resourceComputeSubnetworkCreate,
|
||||
Read: resourceComputeSubnetworkRead,
|
||||
Update: resourceComputeSubnetworkUpdate,
|
||||
Delete: resourceComputeSubnetworkDelete,
|
||||
|
||||
Importer: &schema.ResourceImporter{
|
||||
State: resourceComputeSubnetworkImport,
|
||||
},
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Create: schema.DefaultTimeout(360 * time.Second),
|
||||
Update: schema.DefaultTimeout(360 * time.Second),
|
||||
Delete: schema.DefaultTimeout(360 * time.Second),
|
||||
},
|
||||
CustomizeDiff: customdiff.All(
|
||||
customdiff.ForceNewIfChange("ip_cidr_range", isShrinkageIpCidr),
|
||||
),
|
||||
|
||||
Schema: map[string]*schema.Schema{
|
||||
"ip_cidr_range": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ValidateFunc: validateIpCidrRange,
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
ValidateFunc: validateGCPName,
|
||||
},
|
||||
"network": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
DiffSuppressFunc: compareSelfLinkOrResourceName,
|
||||
},
|
||||
"description": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
"enable_flow_logs": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
},
|
||||
"secondary_ip_range": {
|
||||
Type: schema.TypeList,
|
||||
Optional: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"ip_cidr_range": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ValidateFunc: validateIpCidrRange,
|
||||
},
|
||||
"range_name": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ValidateFunc: validateGCPName,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"private_ip_google_access": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
},
|
||||
"region": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Optional: true,
|
||||
ForceNew: true,
|
||||
DiffSuppressFunc: compareSelfLinkOrResourceName,
|
||||
},
|
||||
"creation_timestamp": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"fingerprint": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"gateway_address": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"project": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
"self_link": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func resourceComputeSubnetworkCreate(d *schema.ResourceData, meta interface{}) error {
|
||||
config := meta.(*Config)
|
||||
|
||||
project, err := getProject(d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
descriptionProp, err := expandComputeSubnetworkDescription(d.Get("description"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
|
||||
obj["description"] = descriptionProp
|
||||
}
|
||||
ipCidrRangeProp, err := expandComputeSubnetworkIpCidrRange(d.Get("ip_cidr_range"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("ip_cidr_range"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, ipCidrRangeProp)) {
|
||||
obj["ipCidrRange"] = ipCidrRangeProp
|
||||
}
|
||||
nameProp, err := expandComputeSubnetworkName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
networkProp, err := expandComputeSubnetworkNetwork(d.Get("network"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("network"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, networkProp)) {
|
||||
obj["network"] = networkProp
|
||||
}
|
||||
enableFlowLogsProp, err := expandComputeSubnetworkEnableFlowLogs(d.Get("enable_flow_logs"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("enable_flow_logs"); ok || !reflect.DeepEqual(v, enableFlowLogsProp) {
|
||||
obj["enableFlowLogs"] = enableFlowLogsProp
|
||||
}
|
||||
secondaryIpRangesProp, err := expandComputeSubnetworkSecondaryIpRange(d.Get("secondary_ip_range"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("secondary_ip_range"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, secondaryIpRangesProp)) {
|
||||
obj["secondaryIpRanges"] = secondaryIpRangesProp
|
||||
}
|
||||
privateIpGoogleAccessProp, err := expandComputeSubnetworkPrivateIpGoogleAccess(d.Get("private_ip_google_access"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("private_ip_google_access"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, privateIpGoogleAccessProp)) {
|
||||
obj["privateIpGoogleAccess"] = privateIpGoogleAccessProp
|
||||
}
|
||||
regionProp, err := expandComputeSubnetworkRegion(d.Get("region"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("region"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, regionProp)) {
|
||||
obj["region"] = regionProp
|
||||
}
|
||||
|
||||
url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/subnetworks")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Printf("[DEBUG] Creating new Subnetwork: %#v", obj)
|
||||
res, err := Post(config, url, obj)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error creating Subnetwork: %s", err)
|
||||
}
|
||||
|
||||
// Store the ID now
|
||||
id, err := replaceVars(d, config, "{{region}}/{{name}}")
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error constructing id: %s", err)
|
||||
}
|
||||
d.SetId(id)
|
||||
|
||||
op := &compute.Operation{}
|
||||
err = Convert(res, op)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
waitErr := computeOperationWaitTime(
|
||||
config.clientCompute, op, project, "Creating Subnetwork",
|
||||
int(d.Timeout(schema.TimeoutCreate).Minutes()))
|
||||
|
||||
if waitErr != nil {
|
||||
// The resource didn't actually create
|
||||
d.SetId("")
|
||||
return fmt.Errorf("Error waiting to create Subnetwork: %s", waitErr)
|
||||
}
|
||||
|
||||
log.Printf("[DEBUG] Finished creating Subnetwork %q: %#v", d.Id(), res)
|
||||
|
||||
return resourceComputeSubnetworkRead(d, meta)
|
||||
}
|
||||
|
||||
func resourceComputeSubnetworkRead(d *schema.ResourceData, meta interface{}) error {
|
||||
config := meta.(*Config)
|
||||
|
||||
project, err := getProject(d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/subnetworks/{{name}}")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
res, err := Get(config, url)
|
||||
if err != nil {
|
||||
return handleNotFoundError(err, d, fmt.Sprintf("ComputeSubnetwork %q", d.Id()))
|
||||
}
|
||||
|
||||
if err := d.Set("creation_timestamp", flattenComputeSubnetworkCreationTimestamp(res["creationTimestamp"])); err != nil {
|
||||
return fmt.Errorf("Error reading Subnetwork: %s", err)
|
||||
}
|
||||
if err := d.Set("description", flattenComputeSubnetworkDescription(res["description"])); err != nil {
|
||||
return fmt.Errorf("Error reading Subnetwork: %s", err)
|
||||
}
|
||||
if err := d.Set("gateway_address", flattenComputeSubnetworkGatewayAddress(res["gatewayAddress"])); err != nil {
|
||||
return fmt.Errorf("Error reading Subnetwork: %s", err)
|
||||
}
|
||||
if err := d.Set("ip_cidr_range", flattenComputeSubnetworkIpCidrRange(res["ipCidrRange"])); err != nil {
|
||||
return fmt.Errorf("Error reading Subnetwork: %s", err)
|
||||
}
|
||||
if err := d.Set("name", flattenComputeSubnetworkName(res["name"])); err != nil {
|
||||
return fmt.Errorf("Error reading Subnetwork: %s", err)
|
||||
}
|
||||
if err := d.Set("network", flattenComputeSubnetworkNetwork(res["network"])); err != nil {
|
||||
return fmt.Errorf("Error reading Subnetwork: %s", err)
|
||||
}
|
||||
if err := d.Set("enable_flow_logs", flattenComputeSubnetworkEnableFlowLogs(res["enableFlowLogs"])); err != nil {
|
||||
return fmt.Errorf("Error reading Subnetwork: %s", err)
|
||||
}
|
||||
if err := d.Set("fingerprint", flattenComputeSubnetworkFingerprint(res["fingerprint"])); err != nil {
|
||||
return fmt.Errorf("Error reading Subnetwork: %s", err)
|
||||
}
|
||||
if err := d.Set("secondary_ip_range", flattenComputeSubnetworkSecondaryIpRange(res["secondaryIpRanges"])); err != nil {
|
||||
return fmt.Errorf("Error reading Subnetwork: %s", err)
|
||||
}
|
||||
if err := d.Set("private_ip_google_access", flattenComputeSubnetworkPrivateIpGoogleAccess(res["privateIpGoogleAccess"])); err != nil {
|
||||
return fmt.Errorf("Error reading Subnetwork: %s", err)
|
||||
}
|
||||
if err := d.Set("region", flattenComputeSubnetworkRegion(res["region"])); err != nil {
|
||||
return fmt.Errorf("Error reading Subnetwork: %s", err)
|
||||
}
|
||||
if err := d.Set("self_link", ConvertSelfLinkToV1(res["selfLink"].(string))); err != nil {
|
||||
return fmt.Errorf("Error reading Subnetwork: %s", err)
|
||||
}
|
||||
if err := d.Set("project", project); err != nil {
|
||||
return fmt.Errorf("Error reading Subnetwork: %s", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func resourceComputeSubnetworkUpdate(d *schema.ResourceData, meta interface{}) error {
|
||||
config := meta.(*Config)
|
||||
|
||||
project, err := getProject(d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var url string
|
||||
var res map[string]interface{}
|
||||
op := &compute.Operation{}
|
||||
|
||||
d.Partial(true)
|
||||
|
||||
if d.HasChange("ip_cidr_range") {
|
||||
obj := make(map[string]interface{})
|
||||
ipCidrRangeProp, err := expandComputeSubnetworkIpCidrRange(d.Get("ip_cidr_range"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("ip_cidr_range"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, ipCidrRangeProp)) {
|
||||
obj["ipCidrRange"] = ipCidrRangeProp
|
||||
}
|
||||
|
||||
url, err = replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/subnetworks/{{name}}/expandIpCidrRange")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
res, err = sendRequest(config, "POST", url, obj)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error updating Subnetwork %q: %s", d.Id(), err)
|
||||
}
|
||||
|
||||
err = Convert(res, op)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = computeOperationWaitTime(
|
||||
config.clientCompute, op, project, "Updating Subnetwork",
|
||||
int(d.Timeout(schema.TimeoutUpdate).Minutes()))
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
d.SetPartial("ip_cidr_range")
|
||||
}
|
||||
if d.HasChange("enable_flow_logs") || d.HasChange("fingerprint") || d.HasChange("secondary_ip_range") {
|
||||
obj := make(map[string]interface{})
|
||||
enableFlowLogsProp, err := expandComputeSubnetworkEnableFlowLogs(d.Get("enable_flow_logs"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("enable_flow_logs"); ok || !reflect.DeepEqual(v, enableFlowLogsProp) {
|
||||
obj["enableFlowLogs"] = enableFlowLogsProp
|
||||
}
|
||||
fingerprintProp := d.Get("fingerprint")
|
||||
obj["fingerprint"] = fingerprintProp
|
||||
secondaryIpRangesProp, err := expandComputeSubnetworkSecondaryIpRange(d.Get("secondary_ip_range"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("secondary_ip_range"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, secondaryIpRangesProp)) {
|
||||
obj["secondaryIpRanges"] = secondaryIpRangesProp
|
||||
}
|
||||
|
||||
url, err = replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/subnetworks/{{name}}")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
res, err = sendRequest(config, "PATCH", url, obj)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error updating Subnetwork %q: %s", d.Id(), err)
|
||||
}
|
||||
|
||||
err = Convert(res, op)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = computeOperationWaitTime(
|
||||
config.clientCompute, op, project, "Updating Subnetwork",
|
||||
int(d.Timeout(schema.TimeoutUpdate).Minutes()))
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
d.SetPartial("enable_flow_logs")
|
||||
d.SetPartial("fingerprint")
|
||||
d.SetPartial("secondary_ip_range")
|
||||
}
|
||||
if d.HasChange("private_ip_google_access") {
|
||||
obj := make(map[string]interface{})
|
||||
privateIpGoogleAccessProp, err := expandComputeSubnetworkPrivateIpGoogleAccess(d.Get("private_ip_google_access"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("private_ip_google_access"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, privateIpGoogleAccessProp)) {
|
||||
obj["privateIpGoogleAccess"] = privateIpGoogleAccessProp
|
||||
}
|
||||
|
||||
url, err = replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/subnetworks/{{name}}/setPrivateIpGoogleAccess")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
res, err = sendRequest(config, "POST", url, obj)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error updating Subnetwork %q: %s", d.Id(), err)
|
||||
}
|
||||
|
||||
err = Convert(res, op)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = computeOperationWaitTime(
|
||||
config.clientCompute, op, project, "Updating Subnetwork",
|
||||
int(d.Timeout(schema.TimeoutUpdate).Minutes()))
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
d.SetPartial("private_ip_google_access")
|
||||
}
|
||||
|
||||
d.Partial(false)
|
||||
|
||||
return resourceComputeSubnetworkRead(d, meta)
|
||||
}
|
||||
|
||||
func resourceComputeSubnetworkDelete(d *schema.ResourceData, meta interface{}) error {
|
||||
config := meta.(*Config)
|
||||
|
||||
project, err := getProject(d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
url, err := replaceVars(d, config, "https://www.googleapis.com/compute/beta/projects/{{project}}/regions/{{region}}/subnetworks/{{name}}")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Printf("[DEBUG] Deleting Subnetwork %q", d.Id())
|
||||
res, err := Delete(config, url)
|
||||
if err != nil {
|
||||
return handleNotFoundError(err, d, "Subnetwork")
|
||||
}
|
||||
|
||||
op := &compute.Operation{}
|
||||
err = Convert(res, op)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = computeOperationWaitTime(
|
||||
config.clientCompute, op, project, "Deleting Subnetwork",
|
||||
int(d.Timeout(schema.TimeoutDelete).Minutes()))
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Printf("[DEBUG] Finished deleting Subnetwork %q: %#v", d.Id(), res)
|
||||
return nil
|
||||
}
|
||||
|
||||
func resourceComputeSubnetworkImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
|
||||
config := meta.(*Config)
|
||||
parseImportId([]string{"projects/(?P<project>[^/]+)/regions/(?P<region>[^/]+)/subnetworks/(?P<name>[^/]+)", "(?P<region>[^/]+)/(?P<name>[^/]+)", "(?P<project>[^/]+)/(?P<region>[^/]+)/(?P<name>[^/]+)", "(?P<name>[^/]+)"}, d, config)
|
||||
|
||||
// Replace import id for the resource id
|
||||
id, err := replaceVars(d, config, "{{region}}/{{name}}")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Error constructing id: %s", err)
|
||||
}
|
||||
d.SetId(id)
|
||||
|
||||
return []*schema.ResourceData{d}, nil
|
||||
}
|
||||
|
||||
func flattenComputeSubnetworkCreationTimestamp(v interface{}) interface{} {
|
||||
return v
|
||||
}
|
||||
|
||||
func flattenComputeSubnetworkDescription(v interface{}) interface{} {
|
||||
return v
|
||||
}
|
||||
|
||||
func flattenComputeSubnetworkGatewayAddress(v interface{}) interface{} {
|
||||
return v
|
||||
}
|
||||
|
||||
func flattenComputeSubnetworkIpCidrRange(v interface{}) interface{} {
|
||||
return v
|
||||
}
|
||||
|
||||
func flattenComputeSubnetworkName(v interface{}) interface{} {
|
||||
return v
|
||||
}
|
||||
|
||||
func flattenComputeSubnetworkNetwork(v interface{}) interface{} {
|
||||
return v
|
||||
}
|
||||
|
||||
func flattenComputeSubnetworkEnableFlowLogs(v interface{}) interface{} {
|
||||
return v
|
||||
}
|
||||
|
||||
func flattenComputeSubnetworkFingerprint(v interface{}) interface{} {
|
||||
return v
|
||||
}
|
||||
|
||||
func flattenComputeSubnetworkSecondaryIpRange(v interface{}) interface{} {
|
||||
if v == nil {
|
||||
return v
|
||||
}
|
||||
l := v.([]interface{})
|
||||
transformed := make([]interface{}, 0, len(l))
|
||||
for _, raw := range l {
|
||||
original := raw.(map[string]interface{})
|
||||
transformed = append(transformed, map[string]interface{}{
|
||||
"range_name": flattenComputeSubnetworkSecondaryIpRangeRangeName(original["rangeName"]),
|
||||
"ip_cidr_range": flattenComputeSubnetworkSecondaryIpRangeIpCidrRange(original["ipCidrRange"]),
|
||||
})
|
||||
}
|
||||
return transformed
|
||||
}
|
||||
func flattenComputeSubnetworkSecondaryIpRangeRangeName(v interface{}) interface{} {
|
||||
return v
|
||||
}
|
||||
|
||||
func flattenComputeSubnetworkSecondaryIpRangeIpCidrRange(v interface{}) interface{} {
|
||||
return v
|
||||
}
|
||||
|
||||
func flattenComputeSubnetworkPrivateIpGoogleAccess(v interface{}) interface{} {
|
||||
return v
|
||||
}
|
||||
|
||||
func flattenComputeSubnetworkRegion(v interface{}) interface{} {
|
||||
return NameFromSelfLinkStateFunc(v)
|
||||
}
|
||||
|
||||
func expandComputeSubnetworkDescription(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func expandComputeSubnetworkIpCidrRange(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func expandComputeSubnetworkName(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func expandComputeSubnetworkNetwork(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
|
||||
f, err := parseGlobalFieldValue("networks", v.(string), "project", d, config, true)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Invalid value for network: %s", err)
|
||||
}
|
||||
return f.RelativeLink(), nil
|
||||
}
|
||||
|
||||
func expandComputeSubnetworkEnableFlowLogs(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func expandComputeSubnetworkSecondaryIpRange(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
|
||||
l := v.([]interface{})
|
||||
req := make([]interface{}, 0, len(l))
|
||||
for _, raw := range l {
|
||||
original := raw.(map[string]interface{})
|
||||
transformed := make(map[string]interface{})
|
||||
|
||||
transformedRangeName, err := expandComputeSubnetworkSecondaryIpRangeRangeName(original["range_name"], d, config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
transformed["rangeName"] = transformedRangeName
|
||||
transformedIpCidrRange, err := expandComputeSubnetworkSecondaryIpRangeIpCidrRange(original["ip_cidr_range"], d, config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
transformed["ipCidrRange"] = transformedIpCidrRange
|
||||
|
||||
req = append(req, transformed)
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func expandComputeSubnetworkSecondaryIpRangeRangeName(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func expandComputeSubnetworkSecondaryIpRangeIpCidrRange(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func expandComputeSubnetworkPrivateIpGoogleAccess(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func expandComputeSubnetworkRegion(v interface{}, d *schema.ResourceData, config *Config) (interface{}, error) {
|
||||
f, err := parseGlobalFieldValue("regions", v.(string), "project", d, config, true)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Invalid value for region: %s", err)
|
||||
}
|
||||
return f.RelativeLink(), nil
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ package google
|
|||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
|
@ -87,23 +88,24 @@ func resourceComputeTargetHttpProxyCreate(d *schema.ResourceData, meta interface
|
|||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
descriptionProp, err := expandComputeTargetHttpProxyDescription(d.Get("description"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
|
||||
obj["description"] = descriptionProp
|
||||
}
|
||||
nameProp, err := expandComputeTargetHttpProxyName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
urlMapProp, err := expandComputeTargetHttpProxyUrlMap(d.Get("url_map"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"description": descriptionProp,
|
||||
"name": nameProp,
|
||||
"urlMap": urlMapProp,
|
||||
} else if v, ok := d.GetOkExists("url_map"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, urlMapProp)) {
|
||||
obj["urlMap"] = urlMapProp
|
||||
}
|
||||
|
||||
url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/targetHttpProxies")
|
||||
|
@ -196,7 +198,6 @@ func resourceComputeTargetHttpProxyUpdate(d *schema.ResourceData, meta interface
|
|||
return err
|
||||
}
|
||||
|
||||
var obj map[string]interface{}
|
||||
var url string
|
||||
var res map[string]interface{}
|
||||
op := &compute.Operation{}
|
||||
|
@ -204,14 +205,14 @@ func resourceComputeTargetHttpProxyUpdate(d *schema.ResourceData, meta interface
|
|||
d.Partial(true)
|
||||
|
||||
if d.HasChange("url_map") {
|
||||
obj := make(map[string]interface{})
|
||||
urlMapProp, err := expandComputeTargetHttpProxyUrlMap(d.Get("url_map"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("url_map"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, urlMapProp)) {
|
||||
obj["urlMap"] = urlMapProp
|
||||
}
|
||||
|
||||
obj = map[string]interface{}{
|
||||
"urlMap": urlMapProp,
|
||||
}
|
||||
url, err = replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/targetHttpProxies/{{name}}/setUrlMap")
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -17,6 +17,7 @@ package google
|
|||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
|
@ -100,33 +101,36 @@ func resourceComputeTargetHttpsProxyCreate(d *schema.ResourceData, meta interfac
|
|||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
descriptionProp, err := expandComputeTargetHttpsProxyDescription(d.Get("description"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
|
||||
obj["description"] = descriptionProp
|
||||
}
|
||||
nameProp, err := expandComputeTargetHttpsProxyName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
sslCertificatesProp, err := expandComputeTargetHttpsProxySslCertificates(d.Get("ssl_certificates"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("ssl_certificates"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, sslCertificatesProp)) {
|
||||
obj["sslCertificates"] = sslCertificatesProp
|
||||
}
|
||||
urlMapProp, err := expandComputeTargetHttpsProxyUrlMap(d.Get("url_map"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("url_map"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, urlMapProp)) {
|
||||
obj["urlMap"] = urlMapProp
|
||||
}
|
||||
sslPolicyProp, err := expandComputeTargetHttpsProxySslPolicy(d.Get("ssl_policy"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"description": descriptionProp,
|
||||
"name": nameProp,
|
||||
"sslCertificates": sslCertificatesProp,
|
||||
"urlMap": urlMapProp,
|
||||
"sslPolicy": sslPolicyProp,
|
||||
} else if v, ok := d.GetOkExists("ssl_policy"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, sslPolicyProp)) {
|
||||
obj["sslPolicy"] = sslPolicyProp
|
||||
}
|
||||
|
||||
url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/targetHttpsProxies")
|
||||
|
@ -225,7 +229,6 @@ func resourceComputeTargetHttpsProxyUpdate(d *schema.ResourceData, meta interfac
|
|||
return err
|
||||
}
|
||||
|
||||
var obj map[string]interface{}
|
||||
var url string
|
||||
var res map[string]interface{}
|
||||
op := &compute.Operation{}
|
||||
|
@ -233,14 +236,14 @@ func resourceComputeTargetHttpsProxyUpdate(d *schema.ResourceData, meta interfac
|
|||
d.Partial(true)
|
||||
|
||||
if d.HasChange("ssl_certificates") {
|
||||
obj := make(map[string]interface{})
|
||||
sslCertificatesProp, err := expandComputeTargetHttpsProxySslCertificates(d.Get("ssl_certificates"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("ssl_certificates"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, sslCertificatesProp)) {
|
||||
obj["sslCertificates"] = sslCertificatesProp
|
||||
}
|
||||
|
||||
obj = map[string]interface{}{
|
||||
"sslCertificates": sslCertificatesProp,
|
||||
}
|
||||
url, err = replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/targetHttpsProxies/{{name}}/setSslCertificates")
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -266,14 +269,14 @@ func resourceComputeTargetHttpsProxyUpdate(d *schema.ResourceData, meta interfac
|
|||
d.SetPartial("ssl_certificates")
|
||||
}
|
||||
if d.HasChange("url_map") {
|
||||
obj := make(map[string]interface{})
|
||||
urlMapProp, err := expandComputeTargetHttpsProxyUrlMap(d.Get("url_map"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("url_map"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, urlMapProp)) {
|
||||
obj["urlMap"] = urlMapProp
|
||||
}
|
||||
|
||||
obj = map[string]interface{}{
|
||||
"urlMap": urlMapProp,
|
||||
}
|
||||
url, err = replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/targetHttpsProxies/{{name}}/setUrlMap")
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -299,14 +302,14 @@ func resourceComputeTargetHttpsProxyUpdate(d *schema.ResourceData, meta interfac
|
|||
d.SetPartial("url_map")
|
||||
}
|
||||
if d.HasChange("ssl_policy") {
|
||||
obj := make(map[string]interface{})
|
||||
sslPolicyProp, err := expandComputeTargetHttpsProxySslPolicy(d.Get("ssl_policy"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("ssl_policy"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, sslPolicyProp)) {
|
||||
obj["sslPolicy"] = sslPolicyProp
|
||||
}
|
||||
|
||||
obj = map[string]interface{}{
|
||||
"sslPolicy": sslPolicyProp,
|
||||
}
|
||||
url, err = replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/targetHttpsProxies/{{name}}/setSslPolicy")
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -17,6 +17,7 @@ package google
|
|||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
|
@ -108,38 +109,42 @@ func resourceComputeTargetSslProxyCreate(d *schema.ResourceData, meta interface{
|
|||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
descriptionProp, err := expandComputeTargetSslProxyDescription(d.Get("description"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
|
||||
obj["description"] = descriptionProp
|
||||
}
|
||||
nameProp, err := expandComputeTargetSslProxyName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
proxyHeaderProp, err := expandComputeTargetSslProxyProxyHeader(d.Get("proxy_header"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("proxy_header"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, proxyHeaderProp)) {
|
||||
obj["proxyHeader"] = proxyHeaderProp
|
||||
}
|
||||
serviceProp, err := expandComputeTargetSslProxyBackendService(d.Get("backend_service"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("backend_service"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, serviceProp)) {
|
||||
obj["service"] = serviceProp
|
||||
}
|
||||
sslCertificatesProp, err := expandComputeTargetSslProxySslCertificates(d.Get("ssl_certificates"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("ssl_certificates"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, sslCertificatesProp)) {
|
||||
obj["sslCertificates"] = sslCertificatesProp
|
||||
}
|
||||
sslPolicyProp, err := expandComputeTargetSslProxySslPolicy(d.Get("ssl_policy"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"description": descriptionProp,
|
||||
"name": nameProp,
|
||||
"proxyHeader": proxyHeaderProp,
|
||||
"service": serviceProp,
|
||||
"sslCertificates": sslCertificatesProp,
|
||||
"sslPolicy": sslPolicyProp,
|
||||
} else if v, ok := d.GetOkExists("ssl_policy"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, sslPolicyProp)) {
|
||||
obj["sslPolicy"] = sslPolicyProp
|
||||
}
|
||||
|
||||
url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/targetSslProxies")
|
||||
|
@ -241,7 +246,6 @@ func resourceComputeTargetSslProxyUpdate(d *schema.ResourceData, meta interface{
|
|||
return err
|
||||
}
|
||||
|
||||
var obj map[string]interface{}
|
||||
var url string
|
||||
var res map[string]interface{}
|
||||
op := &compute.Operation{}
|
||||
|
@ -249,14 +253,14 @@ func resourceComputeTargetSslProxyUpdate(d *schema.ResourceData, meta interface{
|
|||
d.Partial(true)
|
||||
|
||||
if d.HasChange("proxy_header") {
|
||||
obj := make(map[string]interface{})
|
||||
proxyHeaderProp, err := expandComputeTargetSslProxyProxyHeader(d.Get("proxy_header"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("proxy_header"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, proxyHeaderProp)) {
|
||||
obj["proxyHeader"] = proxyHeaderProp
|
||||
}
|
||||
|
||||
obj = map[string]interface{}{
|
||||
"proxyHeader": proxyHeaderProp,
|
||||
}
|
||||
url, err = replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/targetSslProxies/{{name}}/setProxyHeader")
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -282,14 +286,14 @@ func resourceComputeTargetSslProxyUpdate(d *schema.ResourceData, meta interface{
|
|||
d.SetPartial("proxy_header")
|
||||
}
|
||||
if d.HasChange("backend_service") {
|
||||
obj := make(map[string]interface{})
|
||||
serviceProp, err := expandComputeTargetSslProxyBackendService(d.Get("backend_service"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("backend_service"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, serviceProp)) {
|
||||
obj["service"] = serviceProp
|
||||
}
|
||||
|
||||
obj = map[string]interface{}{
|
||||
"service": serviceProp,
|
||||
}
|
||||
url, err = replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/targetSslProxies/{{name}}/setBackendService")
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -315,14 +319,14 @@ func resourceComputeTargetSslProxyUpdate(d *schema.ResourceData, meta interface{
|
|||
d.SetPartial("backend_service")
|
||||
}
|
||||
if d.HasChange("ssl_certificates") {
|
||||
obj := make(map[string]interface{})
|
||||
sslCertificatesProp, err := expandComputeTargetSslProxySslCertificates(d.Get("ssl_certificates"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("ssl_certificates"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, sslCertificatesProp)) {
|
||||
obj["sslCertificates"] = sslCertificatesProp
|
||||
}
|
||||
|
||||
obj = map[string]interface{}{
|
||||
"sslCertificates": sslCertificatesProp,
|
||||
}
|
||||
url, err = replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/targetSslProxies/{{name}}/setSslCertificates")
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -348,14 +352,14 @@ func resourceComputeTargetSslProxyUpdate(d *schema.ResourceData, meta interface{
|
|||
d.SetPartial("ssl_certificates")
|
||||
}
|
||||
if d.HasChange("ssl_policy") {
|
||||
obj := make(map[string]interface{})
|
||||
sslPolicyProp, err := expandComputeTargetSslProxySslPolicy(d.Get("ssl_policy"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("ssl_policy"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, sslPolicyProp)) {
|
||||
obj["sslPolicy"] = sslPolicyProp
|
||||
}
|
||||
|
||||
obj = map[string]interface{}{
|
||||
"sslPolicy": sslPolicyProp,
|
||||
}
|
||||
url, err = replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/targetSslProxies/{{name}}/setSslPolicy")
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -17,6 +17,7 @@ package google
|
|||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
|
@ -94,28 +95,30 @@ func resourceComputeTargetTcpProxyCreate(d *schema.ResourceData, meta interface{
|
|||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
descriptionProp, err := expandComputeTargetTcpProxyDescription(d.Get("description"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
|
||||
obj["description"] = descriptionProp
|
||||
}
|
||||
nameProp, err := expandComputeTargetTcpProxyName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
proxyHeaderProp, err := expandComputeTargetTcpProxyProxyHeader(d.Get("proxy_header"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("proxy_header"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, proxyHeaderProp)) {
|
||||
obj["proxyHeader"] = proxyHeaderProp
|
||||
}
|
||||
serviceProp, err := expandComputeTargetTcpProxyBackendService(d.Get("backend_service"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"description": descriptionProp,
|
||||
"name": nameProp,
|
||||
"proxyHeader": proxyHeaderProp,
|
||||
"service": serviceProp,
|
||||
} else if v, ok := d.GetOkExists("backend_service"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, serviceProp)) {
|
||||
obj["service"] = serviceProp
|
||||
}
|
||||
|
||||
url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/targetTcpProxies")
|
||||
|
@ -211,7 +214,6 @@ func resourceComputeTargetTcpProxyUpdate(d *schema.ResourceData, meta interface{
|
|||
return err
|
||||
}
|
||||
|
||||
var obj map[string]interface{}
|
||||
var url string
|
||||
var res map[string]interface{}
|
||||
op := &compute.Operation{}
|
||||
|
@ -219,14 +221,14 @@ func resourceComputeTargetTcpProxyUpdate(d *schema.ResourceData, meta interface{
|
|||
d.Partial(true)
|
||||
|
||||
if d.HasChange("proxy_header") {
|
||||
obj := make(map[string]interface{})
|
||||
proxyHeaderProp, err := expandComputeTargetTcpProxyProxyHeader(d.Get("proxy_header"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("proxy_header"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, proxyHeaderProp)) {
|
||||
obj["proxyHeader"] = proxyHeaderProp
|
||||
}
|
||||
|
||||
obj = map[string]interface{}{
|
||||
"proxyHeader": proxyHeaderProp,
|
||||
}
|
||||
url, err = replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/targetTcpProxies/{{name}}/setProxyHeader")
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -252,14 +254,14 @@ func resourceComputeTargetTcpProxyUpdate(d *schema.ResourceData, meta interface{
|
|||
d.SetPartial("proxy_header")
|
||||
}
|
||||
if d.HasChange("backend_service") {
|
||||
obj := make(map[string]interface{})
|
||||
serviceProp, err := expandComputeTargetTcpProxyBackendService(d.Get("backend_service"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("backend_service"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, serviceProp)) {
|
||||
obj["service"] = serviceProp
|
||||
}
|
||||
|
||||
obj = map[string]interface{}{
|
||||
"service": serviceProp,
|
||||
}
|
||||
url, err = replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/global/targetTcpProxies/{{name}}/setBackendService")
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -17,6 +17,7 @@ package google
|
|||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
|
@ -88,28 +89,30 @@ func resourceComputeVpnGatewayCreate(d *schema.ResourceData, meta interface{}) e
|
|||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
descriptionProp, err := expandComputeVpnGatewayDescription(d.Get("description"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
|
||||
obj["description"] = descriptionProp
|
||||
}
|
||||
nameProp, err := expandComputeVpnGatewayName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
networkProp, err := expandComputeVpnGatewayNetwork(d.Get("network"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("network"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, networkProp)) {
|
||||
obj["network"] = networkProp
|
||||
}
|
||||
regionProp, err := expandComputeVpnGatewayRegion(d.Get("region"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"description": descriptionProp,
|
||||
"name": nameProp,
|
||||
"network": networkProp,
|
||||
"region": regionProp,
|
||||
} else if v, ok := d.GetOkExists("region"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, regionProp)) {
|
||||
obj["region"] = regionProp
|
||||
}
|
||||
|
||||
url, err := replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/regions/{{region}}/targetVpnGateways")
|
||||
|
|
|
@ -17,6 +17,7 @@ package google
|
|||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -139,64 +140,74 @@ func resourceRedisInstanceCreate(d *schema.ResourceData, meta interface{}) error
|
|||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
alternativeLocationIdProp, err := expandRedisInstanceAlternativeLocationId(d.Get("alternative_location_id"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("alternative_location_id"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, alternativeLocationIdProp)) {
|
||||
obj["alternativeLocationId"] = alternativeLocationIdProp
|
||||
}
|
||||
authorizedNetworkProp, err := expandRedisInstanceAuthorizedNetwork(d.Get("authorized_network"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("authorized_network"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, authorizedNetworkProp)) {
|
||||
obj["authorizedNetwork"] = authorizedNetworkProp
|
||||
}
|
||||
displayNameProp, err := expandRedisInstanceDisplayName(d.Get("display_name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("display_name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, displayNameProp)) {
|
||||
obj["displayName"] = displayNameProp
|
||||
}
|
||||
labelsProp, err := expandRedisInstanceLabels(d.Get("labels"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("labels"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, labelsProp)) {
|
||||
obj["labels"] = labelsProp
|
||||
}
|
||||
locationIdProp, err := expandRedisInstanceLocationId(d.Get("location_id"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("location_id"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, locationIdProp)) {
|
||||
obj["locationId"] = locationIdProp
|
||||
}
|
||||
nameProp, err := expandRedisInstanceName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
memorySizeGbProp, err := expandRedisInstanceMemorySizeGb(d.Get("memory_size_gb"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("memory_size_gb"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, memorySizeGbProp)) {
|
||||
obj["memorySizeGb"] = memorySizeGbProp
|
||||
}
|
||||
redisVersionProp, err := expandRedisInstanceRedisVersion(d.Get("redis_version"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("redis_version"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, redisVersionProp)) {
|
||||
obj["redisVersion"] = redisVersionProp
|
||||
}
|
||||
reservedIpRangeProp, err := expandRedisInstanceReservedIpRange(d.Get("reserved_ip_range"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("reserved_ip_range"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, reservedIpRangeProp)) {
|
||||
obj["reservedIpRange"] = reservedIpRangeProp
|
||||
}
|
||||
tierProp, err := expandRedisInstanceTier(d.Get("tier"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("tier"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, tierProp)) {
|
||||
obj["tier"] = tierProp
|
||||
}
|
||||
regionProp, err := expandRedisInstanceRegion(d.Get("region"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("region"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, regionProp)) {
|
||||
obj["region"] = regionProp
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"alternativeLocationId": alternativeLocationIdProp,
|
||||
"authorizedNetwork": authorizedNetworkProp,
|
||||
"displayName": displayNameProp,
|
||||
"labels": labelsProp,
|
||||
"locationId": locationIdProp,
|
||||
"name": nameProp,
|
||||
"memorySizeGb": memorySizeGbProp,
|
||||
"redisVersion": redisVersionProp,
|
||||
"reservedIpRange": reservedIpRangeProp,
|
||||
"tier": tierProp,
|
||||
"region": regionProp,
|
||||
}
|
||||
obj, err = resourceRedisInstanceEncoder(d, meta, obj)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -324,63 +335,72 @@ func resourceRedisInstanceUpdate(d *schema.ResourceData, meta interface{}) error
|
|||
return err
|
||||
}
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
alternativeLocationIdProp, err := expandRedisInstanceAlternativeLocationId(d.Get("alternative_location_id"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("alternative_location_id"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, alternativeLocationIdProp)) {
|
||||
obj["alternativeLocationId"] = alternativeLocationIdProp
|
||||
}
|
||||
authorizedNetworkProp, err := expandRedisInstanceAuthorizedNetwork(d.Get("authorized_network"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("authorized_network"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, authorizedNetworkProp)) {
|
||||
obj["authorizedNetwork"] = authorizedNetworkProp
|
||||
}
|
||||
displayNameProp, err := expandRedisInstanceDisplayName(d.Get("display_name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("display_name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, displayNameProp)) {
|
||||
obj["displayName"] = displayNameProp
|
||||
}
|
||||
labelsProp, err := expandRedisInstanceLabels(d.Get("labels"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("labels"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, labelsProp)) {
|
||||
obj["labels"] = labelsProp
|
||||
}
|
||||
locationIdProp, err := expandRedisInstanceLocationId(d.Get("location_id"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("location_id"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, locationIdProp)) {
|
||||
obj["locationId"] = locationIdProp
|
||||
}
|
||||
nameProp, err := expandRedisInstanceName(d.Get("name"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nameProp)) {
|
||||
obj["name"] = nameProp
|
||||
}
|
||||
memorySizeGbProp, err := expandRedisInstanceMemorySizeGb(d.Get("memory_size_gb"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("memory_size_gb"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, memorySizeGbProp)) {
|
||||
obj["memorySizeGb"] = memorySizeGbProp
|
||||
}
|
||||
redisVersionProp, err := expandRedisInstanceRedisVersion(d.Get("redis_version"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("redis_version"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, redisVersionProp)) {
|
||||
obj["redisVersion"] = redisVersionProp
|
||||
}
|
||||
reservedIpRangeProp, err := expandRedisInstanceReservedIpRange(d.Get("reserved_ip_range"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("reserved_ip_range"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, reservedIpRangeProp)) {
|
||||
obj["reservedIpRange"] = reservedIpRangeProp
|
||||
}
|
||||
tierProp, err := expandRedisInstanceTier(d.Get("tier"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("tier"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, tierProp)) {
|
||||
obj["tier"] = tierProp
|
||||
}
|
||||
regionProp, err := expandRedisInstanceRegion(d.Get("region"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"alternativeLocationId": alternativeLocationIdProp,
|
||||
"authorizedNetwork": authorizedNetworkProp,
|
||||
"displayName": displayNameProp,
|
||||
"labels": labelsProp,
|
||||
"locationId": locationIdProp,
|
||||
"name": nameProp,
|
||||
"memorySizeGb": memorySizeGbProp,
|
||||
"redisVersion": redisVersionProp,
|
||||
"reservedIpRange": reservedIpRangeProp,
|
||||
"tier": tierProp,
|
||||
"region": regionProp,
|
||||
} else if v, ok := d.GetOkExists("region"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, regionProp)) {
|
||||
obj["region"] = regionProp
|
||||
}
|
||||
|
||||
obj, err = resourceRedisInstanceEncoder(d, meta, obj)
|
||||
|
|
|
@ -73,28 +73,30 @@ func resourceResourceManagerLien() *schema.Resource {
|
|||
func resourceResourceManagerLienCreate(d *schema.ResourceData, meta interface{}) error {
|
||||
config := meta.(*Config)
|
||||
|
||||
obj := make(map[string]interface{})
|
||||
reasonProp, err := expandResourceManagerLienReason(d.Get("reason"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("reason"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, reasonProp)) {
|
||||
obj["reason"] = reasonProp
|
||||
}
|
||||
originProp, err := expandResourceManagerLienOrigin(d.Get("origin"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("origin"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, originProp)) {
|
||||
obj["origin"] = originProp
|
||||
}
|
||||
parentProp, err := expandResourceManagerLienParent(d.Get("parent"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if v, ok := d.GetOkExists("parent"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, parentProp)) {
|
||||
obj["parent"] = parentProp
|
||||
}
|
||||
restrictionsProp, err := expandResourceManagerLienRestrictions(d.Get("restrictions"), d, config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
obj := map[string]interface{}{
|
||||
"reason": reasonProp,
|
||||
"origin": originProp,
|
||||
"parent": parentProp,
|
||||
"restrictions": restrictionsProp,
|
||||
} else if v, ok := d.GetOkExists("restrictions"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, restrictionsProp)) {
|
||||
obj["restrictions"] = restrictionsProp
|
||||
}
|
||||
|
||||
url, err := replaceVars(d, config, "https://cloudresourcemanager.googleapis.com/v1/liens")
|
||||
|
|
|
@ -12,52 +12,6 @@ import (
|
|||
"google.golang.org/api/googleapi"
|
||||
)
|
||||
|
||||
type serializableBody struct {
|
||||
body map[string]interface{}
|
||||
|
||||
// ForceSendFields is a list of field names (e.g. "UtilizationTarget")
|
||||
// to unconditionally include in API requests. By default, fields with
|
||||
// empty values are omitted from API requests. However, any non-pointer,
|
||||
// non-interface field appearing in ForceSendFields will be sent to the
|
||||
// server regardless of whether the field is empty or not. This may be
|
||||
// used to include empty fields in Patch requests.
|
||||
ForceSendFields []string
|
||||
|
||||
// NullFields is a list of field names (e.g. "UtilizationTarget") to
|
||||
// include in API requests with the JSON null value. By default, fields
|
||||
// with empty values are omitted from API requests. However, any field
|
||||
// with an empty value appearing in NullFields will be sent to the
|
||||
// server as null. It is an error if a field in this list has a
|
||||
// non-empty value. This may be used to include null fields in Patch
|
||||
// requests.
|
||||
NullFields []string
|
||||
}
|
||||
|
||||
// MarshalJSON returns a JSON encoding of schema containing only selected fields.
|
||||
// A field is selected if any of the following is true:
|
||||
// * it has a non-empty value
|
||||
// * its field name is present in forceSendFields and it is not a nil pointer or nil interface
|
||||
// * its field name is present in nullFields.
|
||||
func (b *serializableBody) MarshalJSON() ([]byte, error) {
|
||||
// By default, all fields in a map are added to the json output
|
||||
// This changes that to remove the entry with an empty value.
|
||||
// This mimics the "omitempty" behavior.
|
||||
|
||||
// The "omitempty" option specifies that the field should be omitted
|
||||
// from the encoding if the field has an empty value, defined as
|
||||
// false, 0, a nil pointer, a nil interface value, and any empty array,
|
||||
// slice, map, or string.
|
||||
|
||||
// TODO: Add support for ForceSendFields and NullFields.
|
||||
for k, v := range b.body {
|
||||
if isEmptyValue(reflect.ValueOf(v)) {
|
||||
delete(b.body, k)
|
||||
}
|
||||
}
|
||||
|
||||
return json.Marshal(b.body)
|
||||
}
|
||||
|
||||
func isEmptyValue(v reflect.Value) bool {
|
||||
switch v.Kind() {
|
||||
case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
|
||||
|
@ -99,8 +53,7 @@ func sendRequest(config *Config, method, rawurl string, body map[string]interfac
|
|||
|
||||
var buf bytes.Buffer
|
||||
if body != nil {
|
||||
err := json.NewEncoder(&buf).Encode(&serializableBody{
|
||||
body: body})
|
||||
err := json.NewEncoder(&buf).Encode(body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -1,98 +1,174 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file in
|
||||
# .github/CONTRIBUTING.md.
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
layout: "google"
|
||||
page_title: "Google: google_compute_subnetwork"
|
||||
sidebar_current: "docs-google-compute-subnetwork-x"
|
||||
sidebar_current: "docs-google-compute-subnetwork"
|
||||
description: |-
|
||||
Manages a subnetwork within GCE.
|
||||
A VPC network is a virtual version of the traditional physical networks
|
||||
that exist within and between physical data centers.
|
||||
---
|
||||
|
||||
# google\_compute\_subnetwork
|
||||
|
||||
Manages a subnetwork within GCE. For more information see
|
||||
[the official documentation](https://cloud.google.com/compute/docs/vpc/#vpc_networks_and_subnets)
|
||||
and
|
||||
[API](https://cloud.google.com/compute/docs/reference/latest/subnetworks).
|
||||
A VPC network is a virtual version of the traditional physical networks
|
||||
that exist within and between physical data centers. A VPC network
|
||||
provides connectivity for your Compute Engine virtual machine (VM)
|
||||
instances, Container Engine containers, App Engine Flex services, and
|
||||
other network-related resources.
|
||||
|
||||
Each GCP project contains one or more VPC networks. Each VPC network is a
|
||||
global entity spanning all GCP regions. This global VPC network allows VM
|
||||
instances and other resources to communicate with each other via internal,
|
||||
private IP addresses.
|
||||
|
||||
Each VPC network is subdivided into subnets, and each subnet is contained
|
||||
within a single region. You can have more than one subnet in a region for
|
||||
a given VPC network. Each subnet has a contiguous private RFC1918 IP
|
||||
space. You create instances, containers, and the like in these subnets.
|
||||
When you create an instance, you must create it in a subnet, and the
|
||||
instance draws its internal IP address from that subnet.
|
||||
|
||||
Virtual machine (VM) instances in a VPC network can communicate with
|
||||
instances in all other subnets of the same VPC network, regardless of
|
||||
region, using their RFC1918 private IP addresses. You can isolate portions
|
||||
of the network, even entire subnets, using firewall rules.
|
||||
|
||||
To get more information about Subnetwork, see:
|
||||
|
||||
* [API documentation](https://cloud.google.com/compute/docs/reference/rest/beta/subnetworks)
|
||||
* How-to Guides
|
||||
* [Private Google Access](https://cloud.google.com/vpc/docs/configure-private-google-access)
|
||||
* [Cloud Networking](https://cloud.google.com/vpc/docs/using-vpc)
|
||||
|
||||
## Example Usage
|
||||
|
||||
```hcl
|
||||
resource "google_compute_subnetwork" "default-us-east1" {
|
||||
name = "default-us-east1"
|
||||
ip_cidr_range = "10.0.0.0/16"
|
||||
network = "${google_compute_network.default.self_link}"
|
||||
region = "us-east1"
|
||||
}
|
||||
resource "google_compute_network" "custom-test" {
|
||||
name = "test-network"
|
||||
auto_create_subnetworks = false
|
||||
}
|
||||
|
||||
resource "google_compute_network" "default" {
|
||||
name = "test"
|
||||
}
|
||||
resource "google_compute_subnetwork" "network-with-private-secondary-ip-ranges" {
|
||||
name = "test-subnetwork"
|
||||
ip_cidr_range = "10.2.0.0/16"
|
||||
region = "us-central1"
|
||||
network = "${google_compute_network.custom-test.self_link}"
|
||||
secondary_ip_range {
|
||||
range_name = "tf-test-secondary-range-update1"
|
||||
ip_cidr_range = "192.168.10.0/24"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
|
||||
* `ip_cidr_range` - (Required) The IP address range that machines in this
|
||||
network are assigned to, represented as a CIDR block.
|
||||
|
||||
* `name` - (Required) A unique name for the resource, required by GCE.
|
||||
Changing this forces a new resource to be created.
|
||||
|
||||
* `network` - (Required) The network name or resource link to the parent
|
||||
network of this subnetwork. The parent network must have been created
|
||||
in custom subnet mode.
|
||||
|
||||
- - -
|
||||
|
||||
* `description` - (Optional) Description of this subnetwork.
|
||||
|
||||
* `project` - (Optional) The ID of the project in which the resource belongs. If it
|
||||
is not provided, the provider project is used.
|
||||
|
||||
* `region` - (Optional) The region this subnetwork will be created in. If
|
||||
unspecified, this defaults to the region configured in the provider.
|
||||
|
||||
* `private_ip_google_access` - (Optional) Whether the VMs in this subnet
|
||||
can access Google services without assigned external IP
|
||||
addresses.
|
||||
|
||||
* `enable_flow_logs` - (Optional, [Beta](/docs/providers/google/index.html#beta-features))
|
||||
Set to `true` to enable [flow logs](https://cloud.google.com/vpc/docs/using-flow-logs)
|
||||
for this subnetwork.
|
||||
* `ip_cidr_range` -
|
||||
(Required)
|
||||
The range of internal addresses that are owned by this subnetwork.
|
||||
Provide this property when you create the subnetwork. For example,
|
||||
10.0.0.0/8 or 192.168.0.0/16. Ranges must be unique and
|
||||
non-overlapping within a network. Only IPv4 is supported.
|
||||
* `name` -
|
||||
(Required)
|
||||
The name of the resource, provided by the client when initially
|
||||
creating the resource. The name must be 1-63 characters long, and
|
||||
comply with RFC1035. Specifically, the name must be 1-63 characters
|
||||
long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which
|
||||
means the first character must be a lowercase letter, and all
|
||||
following characters must be a dash, lowercase letter, or digit,
|
||||
except the last character, which cannot be a dash.
|
||||
* `network` -
|
||||
(Required)
|
||||
The network this subnet belongs to.
|
||||
Only networks that are in the distributed mode can have subnetworks.
|
||||
|
||||
|
||||
- - -
|
||||
|
||||
* `secondary_ip_range` - (Optional, [Beta](/docs/providers/google/index.html#beta-features)) An array of configurations for secondary IP ranges for VM instances contained in this subnetwork. Structure is documented below.
|
||||
* `description` -
|
||||
(Optional)
|
||||
An optional description of this resource. Provide this property when
|
||||
you create the resource. This field can be set only at resource
|
||||
creation time.
|
||||
* `enable_flow_logs` -
|
||||
(Optional)
|
||||
Whether to enable flow logging for this subnetwork.
|
||||
* `secondary_ip_range` -
|
||||
(Optional)
|
||||
An array of configurations for secondary IP ranges for VM instances
|
||||
contained in this subnetwork. The primary IP of such VM must belong
|
||||
to the primary ipCidrRange of the subnetwork. The alias IPs may belong
|
||||
to either primary or secondary ranges. Structure is documented below.
|
||||
* `private_ip_google_access` -
|
||||
(Optional)
|
||||
Whether the VMs in this subnet can access Google services without
|
||||
assigned external IP addresses.
|
||||
* `region` -
|
||||
(Optional)
|
||||
URL of the GCP region for this subnetwork.
|
||||
* `project` (Optional) The ID of the project in which the resource belongs.
|
||||
If it is not provided, the provider project is used.
|
||||
|
||||
The `secondary_ip_range` block supports:
|
||||
|
||||
* `range_name` - (Required) The name associated with this subnetwork secondary range, used when adding an alias IP range to a VM instance.
|
||||
|
||||
* `ip_cidr_range` - (Required) The range of IP addresses belonging to this subnetwork secondary range. Ranges must be unique and non-overlapping with all primary and secondary IP ranges within a network.
|
||||
* `range_name` -
|
||||
(Required)
|
||||
The name associated with this subnetwork secondary range, used
|
||||
when adding an alias IP range to a VM instance. The name must
|
||||
be 1-63 characters long, and comply with RFC1035. The name
|
||||
must be unique within the subnetwork.
|
||||
* `ip_cidr_range` -
|
||||
(Required)
|
||||
The range of IP addresses belonging to this subnetwork secondary
|
||||
range. Provide this property when you create the subnetwork.
|
||||
Ranges must be unique and non-overlapping with all primary and
|
||||
secondary IP ranges within a network. Only IPv4 is supported.
|
||||
|
||||
|
||||
## Attributes Reference
|
||||
|
||||
In addition to the arguments listed above, the following computed attributes are
|
||||
exported:
|
||||
|
||||
* `gateway_address` - The IP address of the gateway.
|
||||
In addition to the arguments listed above, the following computed attributes are exported:
|
||||
|
||||
* `creation_timestamp` -
|
||||
Creation timestamp in RFC3339 text format.
|
||||
* `gateway_address` -
|
||||
The gateway address for default routes to reach destination addresses
|
||||
outside this subnetwork.
|
||||
* `fingerprint` -
|
||||
Fingerprint of this resource. This field is used internally during
|
||||
updates of this resource.
|
||||
* `self_link` - The URI of the created resource.
|
||||
|
||||
|
||||
## Timeouts
|
||||
|
||||
This resource provides the following
|
||||
[Timeouts](/docs/configuration/resources.html#timeouts) configuration options:
|
||||
|
||||
- `create` - Default is `6 minutes`
|
||||
- `update` - Default is `6 minutes`
|
||||
- `delete` - Default is `6 minutes`
|
||||
- `create` - Default is 6 minutes.
|
||||
- `update` - Default is 6 minutes.
|
||||
- `delete` - Default is 6 minutes.
|
||||
|
||||
## Import
|
||||
|
||||
Subnetwork can be imported using the `region` and `name`, e.g.
|
||||
Subnetwork can be imported using any of these accepted formats:
|
||||
|
||||
```
|
||||
$ terraform import google_compute_subnetwork.default-us-east1 us-east1/default-us-east1
|
||||
$ terraform import google_compute_subnetwork.default projects/{{project}}/regions/{{region}}/subnetworks/{{name}}
|
||||
$ terraform import google_compute_subnetwork.default {{region}}/{{name}}
|
||||
$ terraform import google_compute_subnetwork.default {{project}}/{{region}}/{{name}}
|
||||
$ terraform import google_compute_subnetwork.default {{name}}
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue
Block a user