Skip to content

Commit

Permalink
deprecate 0.11 syntax in docs (datasources) (#2573)
Browse files Browse the repository at this point in the history
  • Loading branch information
megan07 authored and rileykarson committed Nov 13, 2019
1 parent b00e2b4 commit d753704
Show file tree
Hide file tree
Showing 47 changed files with 221 additions and 199 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ func TestAccDataSourceComputeLbIpRanges_basic(t *testing.T) {
}

const testAccComputeLbIpRangesConfig = `
data "google_compute_lb_ip_ranges" "some" {}
data "google_compute_lb_ip_ranges" "some" {
}
`
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ func TestAccDataSourceDnsManagedZone_basic(t *testing.T) {
func testAccDataSourceDnsManagedZone_basic() string {
return fmt.Sprintf(`
resource "google_dns_managed_zone" "foo" {
name = "qa-zone-%s"
dns_name = "qa.tf-test.club."
description = "QA DNS zone"
name = "qa-zone-%s"
dns_name = "qa.tf-test.club."
description = "QA DNS zone"
}
data "google_dns_managed_zone" "qa" {
name = "${google_dns_managed_zone.foo.name}"
name = google_dns_managed_zone.foo.name
}
`, acctest.RandString(10))
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,14 @@ func testAccDataSourceGoogleActiveFolderCheck(data_source_name string, resource_
func testAccDataSourceGoogleActiveFolderConfig(parent string, displayName string) string {
return fmt.Sprintf(`
resource "google_folder" "foobar" {
parent = "%s"
parent = "%s"
display_name = "%s"
}
data "google_active_folder" "my_folder" {
parent = "${google_folder.foobar.parent}"
display_name = "${google_folder.foobar.display_name}"
parent = google_folder.foobar.parent
display_name = google_folder.foobar.display_name
}
`, parent, displayName)
}
80 changes: 41 additions & 39 deletions third_party/terraform/tests/resource_container_cluster_test.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2097,7 +2097,7 @@ resource "google_compute_subnetwork" "container_subnetwork" {
name = "${google_compute_network.container_network.name}"
network = "${google_compute_network.container_network.name}"
ip_cidr_range = "10.0.36.0/24"
location = "us-central1"
region = "us-central1"
private_ip_google_access = true

secondary_ip_range {
Expand Down Expand Up @@ -2227,7 +2227,7 @@ resource "google_compute_network" "container_network" {
resource "google_compute_subnetwork" "container_subnetwork" {
name = "${google_compute_network.container_network.name}"
network = "${google_compute_network.container_network.name}"
location = "us-central1"
region = "us-central1"

ip_cidr_range = "10.0.35.0/24"
private_ip_google_access = true
Expand Down Expand Up @@ -2935,7 +2935,7 @@ resource "google_compute_subnetwork" "container_subnetwork" {
name = "${google_compute_network.container_network.name}"
network = "${google_compute_network.container_network.name}"
ip_cidr_range = "10.0.0.0/24"
location = "us-central1"
region = "us-central1"

secondary_ip_range {
range_name = "pods"
Expand Down Expand Up @@ -2997,7 +2997,7 @@ resource "google_compute_subnetwork" "container_subnetwork" {
name = "${google_compute_network.container_network.name}"
network = "${google_compute_network.container_network.name}"
ip_cidr_range = "10.0.0.0/24"
location = "us-central1"
region = "us-central1"
}

resource "google_container_cluster" "with_ip_allocation_policy" {
Expand Down Expand Up @@ -3126,7 +3126,7 @@ resource "google_compute_subnetwork" "container_subnetwork" {
name = "${google_compute_network.container_network.name}"
network = "${google_compute_network.container_network.name}"
ip_cidr_range = "10.0.36.0/24"
location = "us-central1"
region = "us-central1"
private_ip_google_access = true

secondary_ip_range {
Expand Down Expand Up @@ -3171,7 +3171,7 @@ resource "google_compute_subnetwork" "container_subnetwork" {
name = "${google_compute_network.container_network.name}"
network = "${google_compute_network.container_network.name}"
ip_cidr_range = "10.0.36.0/24"
location = "us-central1"
region = "us-central1"
private_ip_google_access = true

secondary_ip_range {
Expand Down Expand Up @@ -3273,7 +3273,7 @@ resource "google_compute_network" "shared_network" {
resource "google_compute_subnetwork" "shared_subnetwork" {
name = "test-%s"
ip_cidr_range = "10.0.0.0/16"
location = "us-central1"
region = "us-central1"
network = "${google_compute_network.shared_network.self_link}"
project = "${google_compute_shared_vpc_host_project.host_project.project}"

Expand Down Expand Up @@ -3385,7 +3385,7 @@ resource "google_compute_subnetwork" "container_subnetwork" {
name = "${google_compute_network.container_network.name}"
network = "${google_compute_network.container_network.name}"
ip_cidr_range = "10.0.35.0/24"
location = "us-central1"
region = "us-central1"
private_ip_google_access = true

secondary_ip_range {
Expand Down Expand Up @@ -3523,45 +3523,47 @@ resource "google_container_cluster" "with_database_encryption" {
func testAccContainerCluster_withMasterAuthorizedNetworksDisabled(clusterName string) string {
return fmt.Sprintf(`
resource "google_compute_network" "container_network" {
name = "container-net-%s"
auto_create_subnetworks = false
name = "container-net-%s"
auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "container_subnetwork" {
name = "${google_compute_network.container_network.name}"
network = "${google_compute_network.container_network.name}"
ip_cidr_range = "10.0.36.0/24"
location = "us-central1"
private_ip_google_access = true

secondary_ip_range {
range_name = "pod"
ip_cidr_range = "10.0.0.0/19"
}
name = google_compute_network.container_network.name
network = google_compute_network.container_network.name
ip_cidr_range = "10.0.36.0/24"
region = "us-central1"
private_ip_google_access = true

secondary_ip_range {
range_name = "pod"
ip_cidr_range = "10.0.0.0/19"
}

secondary_ip_range {
range_name = "svc"
ip_cidr_range = "10.0.32.0/22"
}
secondary_ip_range {
range_name = "svc"
ip_cidr_range = "10.0.32.0/22"
}
}

resource "google_container_cluster" "with_private_cluster" {
name = "cluster-test-%s"
location = "us-central1-a"
initial_node_count = 1
name = "cluster-test-%s"
location = "us-central1-a"
initial_node_count = 1

network = "${google_compute_network.container_network.name}"
subnetwork = "${google_compute_subnetwork.container_subnetwork.name}"
network = google_compute_network.container_network.name
subnetwork = google_compute_subnetwork.container_subnetwork.name

private_cluster_config {
enable_private_endpoint = false
enable_private_nodes = true
master_ipv4_cidr_block = "10.42.0.0/28"
}
private_cluster_config {
enable_private_endpoint = false
enable_private_nodes = true
master_ipv4_cidr_block = "10.42.0.0/28"
}

ip_allocation_policy {
cluster_secondary_range_name = "${google_compute_subnetwork.container_subnetwork.secondary_ip_range.0.range_name}"
services_secondary_range_name = "${google_compute_subnetwork.container_subnetwork.secondary_ip_range.1.range_name}"
}
}`, clusterName, clusterName)
ip_allocation_policy {
cluster_secondary_range_name = google_compute_subnetwork.container_subnetwork.secondary_ip_range[0].range_name
services_secondary_range_name = google_compute_subnetwork.container_subnetwork.secondary_ip_range[1].range_name
}
}

`, clusterName, clusterName)
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,33 @@ Use this data source to access the configuration of the Google Cloud provider.
## Example Usage

```tf
data "google_client_config" "current" {}
data "google_client_config" "current" {
}
output "project" {
value = "${data.google_client_config.current.project}"
value = data.google_client_config.current.project
}
```

## Example Usage: Configure Kubernetes provider with OAuth2 access token

```tf
data "google_client_config" "default" {}
data "google_client_config" "default" {
}
data "google_container_cluster" "my_cluster" {
name = "my-cluster"
zone = "us-east1-a"
name = "my-cluster"
zone = "us-east1-a"
}
provider "kubernetes" {
load_config_file = false
host = "https://${data.google_container_cluster.my_cluster.endpoint}"
token = "${data.google_client_config.default.access_token}"
cluster_ca_certificate = "${base64decode(data.google_container_cluster.my_cluster.master_auth.0.cluster_ca_certificate)}"
host = "https://${data.google_container_cluster.my_cluster.endpoint}"
token = data.google_client_config.default.access_token
cluster_ca_certificate = base64decode(
data.google_container_cluster.my_cluster.master_auth[0].cluster_ca_certificate,
)
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ resource "google_dns_record_set" "frontend" {
type = "A"
ttl = 300
managed_zone = "${google_dns_managed_zone.prod.name}"
managed_zone = google_dns_managed_zone.prod.name
rrdatas = ["${data.google_compute_address.my_address.address}"]
rrdatas = [data.google_compute_address.my_address.address]
}
resource "google_dns_managed_zone" "prod" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ resource "google_dns_record_set" "frontend" {
type = "A"
ttl = 300
managed_zone = "${google_dns_managed_zone.prod.name}"
managed_zone = google_dns_managed_zone.prod.name
rrdatas = ["${data.google_compute_global_address.my_address.address}"]
rrdatas = [data.google_compute_global_address.my_address.address]
}
resource "google_dns_managed_zone" "prod" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ resource "google_compute_instance" "default" {
boot_disk {
initialize_params {
image = "${data.google_compute_image.my_image.self_link}"
image = data.google_compute_image.my_image.self_link
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ and

```hcl
data "google_compute_instance" "appserver" {
name = "primary-application-server"
zone = "us-central1-a"
name = "primary-application-server"
zone = "us-central1-a"
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@ https://cloud.google.com/compute/docs/load-balancing/health-checks#health_check_
## Example Usage

```tf
data "google_compute_lb_ip_ranges" "ranges" {}
data "google_compute_lb_ip_ranges" "ranges" {
}
resource "google_compute_firewall" "lb" {
name = "lb-firewall"
network = "${google_compute_network.main.name}"
network = google_compute_network.main.name
allow {
protocol = "tcp"
ports = ["80"]
}
source_ranges = ["${data.google_compute_lb_ip_ranges.ranges.network}"]
source_ranges = data.google_compute_lb_ip_ranges.ranges.network
target_tags = [
"InstanceBehindLoadBalancer"
"InstanceBehindLoadBalancer",
]
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,28 @@ description: |-
Get a Compute Region Instance Group within GCE.
For more information, see [the official documentation](https://cloud.google.com/compute/docs/instance-groups/distributing-instances-with-regional-instance-groups) and [API](https://cloud.google.com/compute/docs/reference/latest/regionInstanceGroups).

```
```hcl
data "google_compute_region_instance_group" "group" {
name = "instance-group-name"
name = "instance-group-name"
}
```

The most common use of this datasource will be to fetch information about the instances inside regional managed instance groups, for instance:

```
```hcl
resource "google_compute_region_instance_group_manager" "foo" {
name = "some_name"
name = "some_name"
...
base_instance_name = "foo"
base_instance_name = "foo"
...
instance_template = "${google_compute_instance_template.foo.self_link}"
target_pools = ["${google_compute_target_pool.foo.self_link}"]
instance_template = google_compute_instance_template.foo.self_link
target_pools = [google_compute_target_pool.foo.self_link]
...
}
data "google_compute_region_instance_group" "data_source" {
self_link = "${google_compute_region_instance_group_manager.foo.instance_group}"
self_link = google_compute_region_instance_group_manager.foo.instance_group
}
```

## Argument Reference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ Get info about a Google Compute SSL Certificate from its name.

```tf
data "google_compute_ssl_certificate" "my_cert" {
name = "my-cert"
name = "my-cert"
}
output "certificate" {
value = "${data.google_compute_ssl_certificate.my_cert.certificate}"
value = data.google_compute_ssl_certificate.my_cert.certificate
}
output "certificate_id" {
value = "${data.google_compute_ssl_certificate.my_cert.certificate_id}"
value = data.google_compute_ssl_certificate.my_cert.certificate_id
}
output "self_link" {
value = "${data.google_compute_ssl_certificate.my_cert.self_link}"
value = data.google_compute_ssl_certificate.my_cert.self_link
}
```

Expand Down
Loading

0 comments on commit d753704

Please sign in to comment.