1.0.0 Deprecations, pt 2

Fix the CI tests we broke with the deprecations for 1.0.0, and update
the docs we missed. Also, update the examples.
This commit is contained in:
Paddy 2017-09-29 16:04:52 -07:00
parent 3db816d686
commit fccae61d61
20 changed files with 310 additions and 264 deletions

View File

@ -12,9 +12,11 @@ resource "google_compute_instance" "www" {
zone = "${var.region_zone}"
tags = ["http-tag"]
disk {
boot_disk {
initialize_params {
image = "projects/debian-cloud/global/images/family/debian-8"
}
}
network_interface {
network = "default"
@ -37,9 +39,11 @@ resource "google_compute_instance" "www-video" {
zone = "${var.region_zone}"
tags = ["http-tag"]
disk {
boot_disk {
initialize_params {
image = "projects/debian-cloud/global/images/family/debian-8"
}
}
network_interface {
network = "default"
@ -87,8 +91,7 @@ resource "google_compute_instance_group" "video-resources" {
resource "google_compute_health_check" "health-check" {
name = "tf-health-check"
http_health_check {
}
http_health_check {}
}
resource "google_compute_backend_service" "www-service" {
@ -127,7 +130,7 @@ resource "google_compute_url_map" "web-map" {
default_service = "${google_compute_backend_service.www-service.self_link}"
path_rule {
paths = ["/video", "/video/*",]
paths = ["/video", "/video/*"]
service = "${google_compute_backend_service.video-service.self_link}"
}
}

View File

@ -39,7 +39,7 @@ resource "google_compute_firewall" "allow-ssh-rdp-icmp" {
allow {
protocol = "tcp"
ports = ["22", "3389",]
ports = ["22", "3389"]
}
allow {
@ -54,12 +54,15 @@ resource "google_compute_instance" "ilb-instance-1" {
tags = ["int-lb"]
disk {
boot_disk {
initialize_params {
image = "debian-cloud/debian-8"
}
}
network_interface {
subnetwork = "${google_compute_subnetwork.my-custom-subnet.name}"
access_config {
// Ephemeral IP
}
@ -79,12 +82,15 @@ resource "google_compute_instance" "ilb-instance-2" {
tags = ["int-lb"]
disk {
boot_disk {
initialize_params {
image = "debian-cloud/debian-8"
}
}
network_interface {
subnetwork = "${google_compute_subnetwork.my-custom-subnet.name}"
access_config {
// Ephemeral IP
}
@ -104,12 +110,15 @@ resource "google_compute_instance" "ilb-instance-3" {
tags = ["int-lb"]
disk {
boot_disk {
initialize_params {
image = "debian-cloud/debian-8"
}
}
network_interface {
subnetwork = "${google_compute_subnetwork.my-custom-subnet.name}"
access_config {
// Ephemeral IP
}
@ -129,12 +138,15 @@ resource "google_compute_instance" "ilb-instance-4" {
tags = ["int-lb"]
disk {
boot_disk {
initialize_params {
image = "debian-cloud/debian-8"
}
}
network_interface {
subnetwork = "${google_compute_subnetwork.my-custom-subnet.name}"
access_config {
// Ephemeral IP
}
@ -152,7 +164,7 @@ resource "google_compute_instance_group" "us-ig1" {
instances = [
"${google_compute_instance.ilb-instance-1.self_link}",
"${google_compute_instance.ilb-instance-2.self_link}"
"${google_compute_instance.ilb-instance-2.self_link}",
]
zone = "${var.region_zone}"
@ -163,7 +175,7 @@ resource "google_compute_instance_group" "us-ig2" {
instances = [
"${google_compute_instance.ilb-instance-3.self_link}",
"${google_compute_instance.ilb-instance-4.self_link}"
"${google_compute_instance.ilb-instance-4.self_link}",
]
zone = "${var.region_zone_2}"
@ -221,7 +233,7 @@ resource "google_compute_firewall" "allow-health-check" {
protocol = "tcp"
}
source_ranges = ["130.211.0.0/22","35.191.0.0/16"]
source_ranges = ["130.211.0.0/22", "35.191.0.0/16"]
target_tags = ["int-lb"]
}
@ -232,12 +244,15 @@ resource "google_compute_instance" "standalone-instance-1" {
tags = ["standalone"]
disk {
boot_disk {
initialize_params {
image = "debian-cloud/debian-8"
}
}
network_interface {
subnetwork = "${google_compute_subnetwork.my-custom-subnet.name}"
access_config {
// Ephemeral IP
}

View File

@ -35,9 +35,11 @@ resource "google_compute_instance" "www" {
zone = "${var.region_zone}"
tags = ["www-node"]
disk {
boot_disk {
initialize_params {
image = "ubuntu-os-cloud/ubuntu-1404-trusty-v20160602"
}
}
network_interface {
network = "default"

View File

@ -149,7 +149,7 @@ resource "google_compute_instance_template" "foobar" {
can_ip_forward = false
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true
@ -209,7 +209,7 @@ resource "google_compute_instance_template" "foobar" {
can_ip_forward = false
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true

View File

@ -422,7 +422,7 @@ resource "google_compute_instance_template" "foobar" {
network = "default"
}
disk {
boot_disk {
source_image = "debian-8-jessie-v20160803"
auto_delete = true
boot = true

View File

@ -355,11 +355,11 @@ resource "google_compute_instance" "bar" {
machine_type = "n1-standard-1"
zone = "us-central1-a"
disk {
boot_disk {
image = "debian-8-jessie-v20170523"
}
disk {
attached_disk {
disk = "${google_compute_disk.foo.name}"
auto_delete = false
}

View File

@ -8,9 +8,10 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"strings"
computeBeta "google.golang.org/api/compute/v0.beta"
"google.golang.org/api/compute/v1"
"strings"
)
func TestAccComputeFirewall_basic(t *testing.T) {
@ -306,7 +307,6 @@ func testAccComputeFirewall_basic(network, firewall string) string {
return fmt.Sprintf(`
resource "google_compute_network" "foobar" {
name = "%s"
ipv4_range = "10.0.0.0/16"
}
resource "google_compute_firewall" "foobar" {
@ -325,7 +325,6 @@ func testAccComputeFirewall_update(network, firewall string) string {
return fmt.Sprintf(`
resource "google_compute_network" "foobar" {
name = "%s"
ipv4_range = "10.0.0.0/16"
}
resource "google_compute_firewall" "foobar" {
@ -345,7 +344,6 @@ func testAccComputeFirewall_priority(network, firewall string, priority int) str
return fmt.Sprintf(`
resource "google_compute_network" "foobar" {
name = "%s"
ipv4_range = "10.0.0.0/16"
}
resource "google_compute_firewall" "foobar" {
@ -365,7 +363,6 @@ func testAccComputeFirewall_noSource(network, firewall string) string {
return fmt.Sprintf(`
resource "google_compute_network" "foobar" {
name = "%s"
ipv4_range = "10.0.0.0/16"
}
resource "google_compute_firewall" "foobar" {
@ -384,7 +381,6 @@ func testAccComputeFirewall_denied(network, firewall string) string {
return fmt.Sprintf(`
resource "google_compute_network" "foobar" {
name = "%s"
ipv4_range = "10.0.0.0/16"
}
resource "google_compute_firewall" "foobar" {
@ -404,7 +400,6 @@ func testAccComputeFirewall_egress(network, firewall string) string {
return fmt.Sprintf(`
resource "google_compute_network" "foobar" {
name = "%s"
ipv4_range = "10.0.0.0/16"
}
resource "google_compute_firewall" "foobar" {

View File

@ -9,10 +9,11 @@ import (
computeBeta "google.golang.org/api/compute/v0.beta"
"google.golang.org/api/compute/v1"
"sort"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"sort"
)
func TestAccInstanceGroupManager_basic(t *testing.T) {
@ -500,7 +501,7 @@ func testAccInstanceGroupManager_basic(template, target, igm1, igm2 string) stri
can_ip_forward = false
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true
@ -554,7 +555,7 @@ func testAccInstanceGroupManager_targetSizeZero(template, igm string) string {
can_ip_forward = false
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true
@ -591,7 +592,7 @@ func testAccInstanceGroupManager_update(template, target, igm string) string {
can_ip_forward = false
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true
@ -640,7 +641,7 @@ func testAccInstanceGroupManager_update2(template1, target1, target2, template2,
can_ip_forward = false
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true
@ -677,7 +678,7 @@ func testAccInstanceGroupManager_update2(template1, target1, target2, template2,
can_ip_forward = false
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true
@ -725,7 +726,7 @@ func testAccInstanceGroupManager_updateLifecycle(tag, igm string) string {
can_ip_forward = false
tags = ["%s"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true
@ -765,7 +766,7 @@ func testAccInstanceGroupManager_updateStrategy(igm string) string {
can_ip_forward = false
tags = ["terraform-testing"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true
@ -806,7 +807,7 @@ func testAccInstanceGroupManager_separateRegions(igm1, igm2 string) string {
can_ip_forward = false
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true
@ -852,7 +853,7 @@ resource "google_compute_instance_template" "igm-basic" {
machine_type = "n1-standard-1"
can_ip_forward = false
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true
@ -908,7 +909,7 @@ resource "google_compute_instance_template" "igm-basic" {
machine_type = "n1-standard-1"
can_ip_forward = false
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true

View File

@ -269,9 +269,11 @@ func testAccComputeInstanceGroup_basic(instance string) string {
can_ip_forward = false
zone = "us-central1-c"
disk {
boot_disk {
initialize_params {
image = "debian-8-jessie-v20160803"
}
}
network_interface {
network = "default"
@ -317,9 +319,11 @@ func testAccComputeInstanceGroup_update(instance string) string {
zone = "us-central1-c"
count = 2
disk {
boot_disk {
initialize_params {
image = "debian-8-jessie-v20160803"
}
}
network_interface {
network = "default"
@ -352,9 +356,11 @@ func testAccComputeInstanceGroup_update2(instance string) string {
zone = "us-central1-c"
count = 1
disk {
boot_disk {
initialize_params {
image = "debian-8-jessie-v20160803"
}
}
network_interface {
network = "default"
@ -386,9 +392,11 @@ func testAccComputeInstanceGroup_outOfOrderInstances(instance string) string {
can_ip_forward = false
zone = "us-central1-c"
disk {
boot_disk {
initialize_params {
image = "debian-8-jessie-v20160803"
}
}
network_interface {
network = "default"
@ -401,9 +409,11 @@ func testAccComputeInstanceGroup_outOfOrderInstances(instance string) string {
can_ip_forward = false
zone = "us-central1-c"
disk {
boot_disk {
initialize_params {
image = "debian-8-jessie-v20160803"
}
}
network_interface {
network = "default"
@ -439,9 +449,11 @@ func testAccComputeInstanceGroup_network(instance string) string {
can_ip_forward = false
zone = "us-central1-c"
disk {
boot_disk {
initialize_params {
image = "debian-8-jessie-v20160803"
}
}
network_interface {
network = "${google_compute_network.ig_network.name}"

View File

@ -419,7 +419,7 @@ resource "google_compute_instance_template" "foobar" {
can_ip_forward = false
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-8-jessie-v20160803"
auto_delete = true
boot = true
@ -450,7 +450,7 @@ resource "google_compute_instance_template" "foobar" {
can_ip_forward = false
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-8-jessie-v20160803"
auto_delete = true
boot = true
@ -484,7 +484,7 @@ resource "google_compute_instance_template" "foobar" {
machine_type = "n1-standard-1"
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-8-jessie-v20160803"
}
@ -507,7 +507,7 @@ resource "google_compute_instance_template" "foobar" {
machine_type = "n1-standard-1"
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-8-jessie-v20160803"
}
@ -535,14 +535,14 @@ resource "google_compute_instance_template" "foobar" {
name = "instancet-test-%s"
machine_type = "n1-standard-1"
disk {
boot_disk {
source_image = "debian-8-jessie-v20160803"
auto_delete = true
disk_size_gb = 100
boot = true
}
disk {
attached_disk {
source = "terraform-test-foobar"
auto_delete = false
boot = false
@ -568,7 +568,7 @@ func testAccComputeInstanceTemplate_subnet_auto(network string) string {
name = "instance-tpl-%s"
machine_type = "n1-standard-1"
disk {
boot_disk {
source_image = "debian-8-jessie-v20160803"
auto_delete = true
disk_size_gb = 10
@ -603,7 +603,7 @@ resource "google_compute_instance_template" "foobar" {
machine_type = "n1-standard-1"
region = "us-central1"
disk {
boot_disk {
source_image = "debian-8-jessie-v20160803"
auto_delete = true
disk_size_gb = 10
@ -640,7 +640,7 @@ func testAccComputeInstanceTemplate_subnet_xpn(xpn_host string) string {
machine_type = "n1-standard-1"
region = "us-central1"
disk {
boot_disk {
source_image = "debian-8-jessie-v20160803"
auto_delete = true
disk_size_gb = 10
@ -663,7 +663,7 @@ resource "google_compute_instance_template" "foobar" {
name = "instance-test-%s"
machine_type = "n1-standard-1"
disk {
boot_disk {
source_image = "debian-8-jessie-v20160803"
auto_delete = true
disk_size_gb = 10

View File

@ -325,7 +325,7 @@ resource "google_compute_instance_template" "foobar" {
network = "default"
}
disk {
boot_disk {
source_image = "debian-8-jessie-v20160803"
auto_delete = true
boot = true

View File

@ -9,10 +9,11 @@ import (
computeBeta "google.golang.org/api/compute/v0.beta"
"google.golang.org/api/compute/v1"
"sort"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"sort"
)
func TestAccRegionInstanceGroupManager_basic(t *testing.T) {
@ -431,7 +432,7 @@ func testAccRegionInstanceGroupManager_basic(template, target, igm1, igm2 string
can_ip_forward = false
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true
@ -485,7 +486,7 @@ func testAccRegionInstanceGroupManager_targetSizeZero(template, igm string) stri
can_ip_forward = false
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true
@ -522,7 +523,7 @@ func testAccRegionInstanceGroupManager_update(template, target, igm string) stri
can_ip_forward = false
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true
@ -571,7 +572,7 @@ func testAccRegionInstanceGroupManager_update2(template1, target1, target2, temp
can_ip_forward = false
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true
@ -608,7 +609,7 @@ func testAccRegionInstanceGroupManager_update2(template1, target1, target2, temp
can_ip_forward = false
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true
@ -656,7 +657,7 @@ func testAccRegionInstanceGroupManager_updateLifecycle(tag, igm string) string {
can_ip_forward = false
tags = ["%s"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true
@ -696,7 +697,7 @@ func testAccRegionInstanceGroupManager_separateRegions(igm1, igm2 string) string
can_ip_forward = false
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true
@ -742,7 +743,7 @@ resource "google_compute_instance_template" "igm-basic" {
machine_type = "n1-standard-1"
can_ip_forward = false
tags = ["foo", "bar"]
disk {
boot_disk {
source_image = "debian-cloud/debian-8-jessie-v20160803"
auto_delete = true
boot = true

View File

@ -98,21 +98,33 @@ func testAccCheckComputeRouteExists(n string, route *compute.Route) resource.Tes
var testAccComputeRoute_basic = fmt.Sprintf(`
resource "google_compute_network" "foobar" {
name = "route-test-%s"
ipv4_range = "10.0.0.0/16"
}
resource "google_compute_subnetwork" "foobar" {
name = "route-test-%s"
ip_cidr_range = "10.0.0.0/16"
network = "${google_compute_network.foobar.self_link}"
region = "us-central1"
}
resource "google_compute_route" "foobar" {
name = "route-test-%s"
dest_range = "15.0.0.0/24"
network = "${google_compute_network.foobar.name}"
next_hop_ip = "10.0.1.5"
next_hop_ip = "10.154.0.1"
priority = 100
}`, acctest.RandString(10), acctest.RandString(10))
}`, acctest.RandString(10), acctest.RandString(10), acctest.RandString(10))
var testAccComputeRoute_defaultInternetGateway = fmt.Sprintf(`
resource "google_compute_network" "foobar" {
name = "route-test-%s"
ipv4_range = "10.0.0.0/16"
}
resource "google_compute_subnetwork" "foobar" {
name = "route-test-%s"
ip_cidr_range = "10.0.0.0/16"
network = "${google_compute_network.foobar.self_link}"
region = "us-central1"
}
resource "google_compute_route" "foobar" {
@ -121,4 +133,4 @@ resource "google_compute_route" "foobar" {
network = "${google_compute_network.foobar.name}"
next_hop_gateway = "default-internet-gateway"
priority = 100
}`, acctest.RandString(10), acctest.RandString(10))
}`, acctest.RandString(10), acctest.RandString(10), acctest.RandString(10))

View File

@ -156,7 +156,7 @@ func testAccComputeRouterInterfaceBasic(testId string) string {
name = "router-interface-test-%s"
}
resource "google_compute_subnetwork" "foobar" {
name = "router-interface-test-%s"
name = "router-interface-test-subnetwork-%s"
network = "${google_compute_network.foobar.self_link}"
ip_cidr_range = "10.0.0.0/16"
region = "us-central1"
@ -225,7 +225,7 @@ func testAccComputeRouterInterfaceKeepRouter(testId string) string {
name = "router-interface-test-%s"
}
resource "google_compute_subnetwork" "foobar" {
name = "router-interface-test-%s"
name = "router-interface-test-subnetwork-%s"
network = "${google_compute_network.foobar.self_link}"
ip_cidr_range = "10.0.0.0/16"
region = "us-central1"

View File

@ -156,7 +156,7 @@ func testAccComputeRouterPeerBasic(testId string) string {
name = "router-peer-test-%s"
}
resource "google_compute_subnetwork" "foobar" {
name = "router-peer-test-%s"
name = "router-peer-test-subnetwork-%s"
network = "${google_compute_network.foobar.self_link}"
ip_cidr_range = "10.0.0.0/16"
region = "us-central1"
@ -234,7 +234,7 @@ func testAccComputeRouterPeerKeepRouter(testId string) string {
name = "router-peer-test-%s"
}
resource "google_compute_subnetwork" "foobar" {
name = "router-peer-test-%s"
name = "router-peer-test-subnetwork-%s"
network = "${google_compute_network.foobar.self_link}"
ip_cidr_range = "10.0.0.0/16"
region = "us-central1"

View File

@ -140,7 +140,7 @@ func testAccComputeRouterBasic(resourceRegion string) string {
name = "router-test-%s"
}
resource "google_compute_subnetwork" "foobar" {
name = "router-test-%s"
name = "router-test-subnetwork-%s"
network = "${google_compute_network.foobar.self_link}"
ip_cidr_range = "10.0.0.0/16"
region = "%s"
@ -163,7 +163,7 @@ func testAccComputeRouterNoRegion(providerRegion string) string {
name = "router-test-%s"
}
resource "google_compute_subnetwork" "foobar" {
name = "router-test-%s"
name = "router-test-subnetwork-%s"
network = "${google_compute_network.foobar.self_link}"
ip_cidr_range = "10.0.0.0/16"
region = "%s"
@ -185,7 +185,7 @@ func testAccComputeRouterNetworkLink() string {
name = "router-test-%s"
}
resource "google_compute_subnetwork" "foobar" {
name = "router-test-%s"
name = "router-test-subnetwork-%s"
network = "${google_compute_network.foobar.self_link}"
ip_cidr_range = "10.0.0.0/16"
region = "europe-west1"

View File

@ -85,8 +85,9 @@ func testAccCheckComputeVpnGatewayExists(n string) resource.TestCheckFunc {
var testAccComputeVpnGateway_basic = fmt.Sprintf(`
resource "google_compute_network" "foobar" {
name = "gateway-test-%s"
ipv4_range = "10.0.0.0/16"
auto_create_subnetworks = true
}
resource "google_compute_vpn_gateway" "foobar" {
name = "gateway-test-%s"
network = "${google_compute_network.foobar.self_link}"

View File

@ -125,7 +125,7 @@ resource "google_compute_network" "foobar" {
name = "tunnel-test-%s"
}
resource "google_compute_subnetwork" "foobar" {
name = "tunnel-test-%s"
name = "tunnel-test-subnetwork-%s"
network = "${google_compute_network.foobar.self_link}"
ip_cidr_range = "10.0.0.0/16"
region = "us-central1"
@ -181,7 +181,7 @@ func testAccComputeVpnTunnelRouter(router string) string {
name = "tunnel-test-%s"
}
resource "google_compute_subnetwork" "foobar" {
name = "tunnel-test-%s"
name = "tunnel-test-subnetwork-%s"
network = "${google_compute_network.foobar.self_link}"
ip_cidr_range = "10.0.0.0/16"
region = "us-central1"

View File

@ -29,9 +29,11 @@ resource "google_compute_instance" "vm" {
machine_type = "n1-standard-1"
zone = "us-east1-c"
disk {
boot_disk {
initialize_params {
image = "${google_compute_image.bootable-image.self_link}"
}
}
network_interface {
network = "default"

View File

@ -30,9 +30,11 @@ resource "google_compute_instance" "frontend" {
machine_type = "g1-small"
zone = "us-central1-b"
disk {
boot_disk {
initialize_params {
image = "debian-cloud/debian-8"
}
}
network_interface {
network = "default"