Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into master
Browse files Browse the repository at this point in the history
* upstream/master:
  Add a random string to ad directory so tests can be run in parallel (hashicorp#3802) (hashicorp#6905)
  Set context early on in LoadAndValidate to prevent NPE (hashicorp#3800) (hashicorp#6903)
  Add tests for DICOM store pubsub topic removal. (hashicorp#3442) (hashicorp#6893)
  Bump Bigtable version from 1.1.0 to 1.5.0 (hashicorp#6890)
  Fix colon in doc notes (hashicorp#3796) (hashicorp#6888)
  Fix bug: diff being detected for source_repo_repository even when there are no changes (hashicorp#3786) (hashicorp#6886)
  Use proper prefix inside router_interface test (hashicorp#3795) (hashicorp#6883)
  Update Bigtable Num of Clusters Block Docs (hashicorp#3792) (hashicorp#6881)
  • Loading branch information
Drew Boshardy committed Aug 3, 2020
2 parents 117bff4 + 47eaa45 commit 3c57adf
Show file tree
Hide file tree
Showing 33 changed files with 156 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .changelog/3442.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none
healthcare: added tests for pubsub topic removal in `google_healthcare_dicom_store`
```
3 changes: 3 additions & 0 deletions .changelog/3786.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
sourcerepo: fixed perma-diff in `google_sourcerepo_repository`
```
3 changes: 3 additions & 0 deletions .changelog/3792.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
3 changes: 3 additions & 0 deletions .changelog/3795.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
3 changes: 3 additions & 0 deletions .changelog/3796.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
3 changes: 3 additions & 0 deletions .changelog/3800.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
Fixed crash due to nil context when loading credentials
```
3 changes: 3 additions & 0 deletions .changelog/3802.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/terraform-providers/terraform-provider-google

require (
cloud.google.com/go/bigtable v1.1.0
cloud.google.com/go/bigtable v1.5.0
github.com/apparentlymart/go-cidr v1.0.1
github.com/client9/misspell v0.3.4
github.com/davecgh/go-spew v1.1.1
Expand All @@ -20,9 +20,9 @@ require (
github.com/sirupsen/logrus v1.2.0 // indirect
github.com/stoewer/go-strcase v1.0.2
github.com/terraform-providers/terraform-provider-random v0.0.0-20190925200408-30dac3233094
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e
golang.org/x/net v0.0.0-20200625001655-4c5254603344
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
google.golang.org/api v0.26.0
google.golang.org/api v0.29.0
)

go 1.14
78 changes: 76 additions & 2 deletions go.sum

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion google/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ func (c *Config) LoadAndValidate(ctx context.Context) error {
c.Scopes = DefaultClientScopes
}

c.context = ctx

tokenSource, err := c.getTokenSource(c.Scopes)
if err != nil {
return err
Expand Down Expand Up @@ -318,7 +320,6 @@ func (c *Config) LoadAndValidate(ctx context.Context) error {
userAgent := fmt.Sprintf("%s %s", tfUserAgent, providerVersion)

c.client = client
c.context = ctx
c.userAgent = userAgent

// This base path and some others below need the version and possibly more of the path
Expand Down
4 changes: 3 additions & 1 deletion google/resource_active_directory_domain_update_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package google

import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
Expand All @@ -9,8 +10,9 @@ import (
func TestAccActiveDirectoryDomain_update(t *testing.T) {
t.Parallel()

domain := fmt.Sprintf("mydomain%s.org1.com", randString(t, 5))
context := map[string]interface{}{
"domain": "mydomain.org1.com",
"domain": domain,
"resource_name": "ad-domain",
}

Expand Down
2 changes: 1 addition & 1 deletion google/resource_bigtable_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func resourceBigtableInstance() *schema.Resource {
Type: schema.TypeList,
Optional: true,
Computed: true,
Description: `A block of cluster configuration options. This can be specified 1 or 2 times.`,
Description: `A block of cluster configuration options. This can be specified at least once, and up to 4 times.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"cluster_id": {
Expand Down
2 changes: 1 addition & 1 deletion google/resource_cloud_scheduler_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ a message to the provided topic`,
Required: true,
ForceNew: true,
Description: `The full resource name for the Cloud Pub/Sub topic to which
messages will be published when a job is delivered. ~>**NOTE**:
messages will be published when a job is delivered. ~>**NOTE:**
The topic name must be in the same format as required by PubSub's
PublishRequest.name, e.g. 'projects/my-project/topics/my-topic'.`,
},
Expand Down
2 changes: 1 addition & 1 deletion google/resource_compute_forwarding_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ forwarding rule. By default, if this field is empty, an ephemeral
internal IP address will be automatically allocated from the IP range
of the subnet or network configured for this forwarding rule.
An address must be specified by a literal IP address. ~> **NOTE**: While
An address must be specified by a literal IP address. ~> **NOTE:** While
the API allows you to specify various resource paths for an address resource
instead, Terraform requires this to specifically be an IP address to
avoid needing to fetching the IP address from resource paths on refresh
Expand Down
4 changes: 2 additions & 2 deletions google/resource_compute_router_interface_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ resource "google_compute_network" "foobar" {
}
resource "google_compute_subnetwork" "foobar" {
name = "router-interface-test-subnetwork-%s"
name = "tf-test-router-interface-subnetwork-%s"
network = google_compute_network.foobar.self_link
ip_cidr_range = "10.0.0.0/16"
region = "us-central1"
Expand Down Expand Up @@ -317,7 +317,7 @@ resource "google_compute_network" "foobar" {
}
resource "google_compute_subnetwork" "foobar" {
name = "router-interface-test-subnetwork-%s"
name = "tf-test-router-interface-subnetwork-%s"
network = google_compute_network.foobar.self_link
ip_cidr_range = "10.0.0.0/16"
region = "us-central1"
Expand Down
2 changes: 1 addition & 1 deletion google/resource_deployment_manager_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ actually change the deployment, just how it is updated. Default value: "DELETE"
that are not actually instantiated. This allows you to preview a
deployment. It can be updated to false to actually deploy
with real resources.
~>**NOTE**: Deployment Manager does not allow update
~>**NOTE:** Deployment Manager does not allow update
of a deployment in preview (unless updating to preview=false). Thus,
Terraform will force-recreate deployments if either preview is updated
to true or if other fields are updated while preview is true.`,
Expand Down
17 changes: 8 additions & 9 deletions google/resource_healthcare_dicom_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,14 @@ func TestAccHealthcareDicomStore_basic(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
},
// TODO(b/148536607): Uncomment once b/148536607 is fixed.
// {
// Config: testGoogleHealthcareDicomStore_basic(dicomStoreName, datasetName),
// },
// {
// ResourceName: resourceName,
// ImportState: true,
// ImportStateVerify: true,
// },
{
Config: testGoogleHealthcareDicomStore_basic(dicomStoreName, datasetName),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}
Expand Down
2 changes: 1 addition & 1 deletion google/resource_healthcare_fhir_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ value 2. The maximum depth allowed is 5.`,
"resource_types": {
Type: schema.TypeList,
Optional: true,
Description: `Supply a FHIR resource type (such as "Patient" or "Observation"). See
Description: `Supply a FHIR resource type (such as "Patient" or "Observation"). See
https://www.hl7.org/fhir/valueset-resource-types.html for a list of all FHIR resource types. The server treats
an empty list as an intent to stream all the supported resource types in this FHIR store.`,
Elem: &schema.Schema{
Expand Down
20 changes: 20 additions & 0 deletions google/resource_source_repo_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,36 @@
package google

import (
"bytes"
"fmt"
"log"
"reflect"
"strconv"
"strings"
"time"

"github.com/hashicorp/terraform-plugin-sdk/helper/hashcode"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
)

func resourceSourceRepoRepositoryPubSubConfigsHash(v interface{}) int {
if v == nil {
return 0
}

var buf bytes.Buffer
m := v.(map[string]interface{})

buf.WriteString(fmt.Sprintf("%s-", GetResourceNameFromSelfLink(m["topic"].(string))))
buf.WriteString(fmt.Sprintf("%s-", m["message_format"].(string)))
if v, ok := m["service_account_email"]; ok {
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
}

return hashcode.String(buf.String())
}

func resourceSourceRepoRepository() *schema.Resource {
return &schema.Resource{
Create: resourceSourceRepoRepositoryCreate,
Expand Down Expand Up @@ -81,6 +100,7 @@ If unspecified, it defaults to the compute engine default service account.`,
},
},
},
Set: resourceSourceRepoRepositoryPubSubConfigsHash,
},
"size": {
Type: schema.TypeInt,
Expand Down
2 changes: 1 addition & 1 deletion website/docs/d/kms_secret.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ within your resource definitions.
For more information see
[the official documentation](https://cloud.google.com/kms/docs/encrypt-decrypt).

~> **NOTE**: Using this data provider will allow you to conceal secret data within your
~> **NOTE:** Using this data provider will allow you to conceal secret data within your
resource definitions, but it does not take care of protecting that data in the
logging output, plan output, or state output. Please take care to secure your secret
data outside of resource definitions.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/d/kms_secret_ciphertext.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ciphertext within your resource definitions.
For more information see
[the official documentation](https://cloud.google.com/kms/docs/encrypt-decrypt).

~> **NOTE**: Using this data source will allow you to conceal secret data within your
~> **NOTE:** Using this data source will allow you to conceal secret data within your
resource definitions, but it does not take care of protecting that data in the
logging output, plan output, or state output. Please take care to secure your secret
data outside of resource definitions.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/guides/provider_reference.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Values are expected to include the version of the service, such as
`https://www.googleapis.com/compute/v1/`.

* `batching` - (Optional) This block controls batching GCP calls for groups of specific resource types. Structure is documented below.
~>**NOTE**: Batching is not implemented for the majority or resources/request types and is bounded by two values. If you are running into issues with slow batches
~>**NOTE:** Batching is not implemented for the majority or resources/request types and is bounded by two values. If you are running into issues with slow batches
resources, you may need to adjust one or both of 1) the core [`-parallelism`](https://www.terraform.io/docs/commands/apply.html#parallelism-n) flag, which controls how many concurrent resources are being operated on and 2) `send_after`, the time interval after which a batch is sent.

* `request_timeout` - (Optional) A duration string controlling the amount of time
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/app_engine_application.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ resource "google_app_engine_application" "app" {
The following arguments are supported:

* `project` - (Required) The project ID to create the application under.
~>**NOTE**: GCP only accepts project ID, not project number. If you are using number,
~>**NOTE:** GCP only accepts project ID, not project number. If you are using number,
you may get a "Permission denied" error.

* `location_id` - (Required) The [location](https://cloud.google.com/appengine/docs/locations)
Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/bigquery_table.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ The following arguments are supported:
* `labels` - (Optional) A mapping of labels to assign to the resource.

* `schema` - (Optional) A JSON schema for the table.
~>**NOTE**: Because this field expects a JSON string, any changes to the
~>**NOTE:** Because this field expects a JSON string, any changes to the
string will create a diff, even if the JSON itself hasn't changed.
If the API returns a different value for the same schema, e.g. it
switched the order of values or replaced `STRUCT` field type with `RECORD`
Expand Down Expand Up @@ -166,7 +166,7 @@ The `external_data_configuration` block supports:
* `schema` - (Optional) A JSON schema for the external table. Schema is required
for CSV and JSON formats if autodetect is not on. Schema is disallowed
for Google Cloud Bigtable, Cloud Datastore backups, Avro, ORC and Parquet formats.
~>**NOTE**: Because this field expects a JSON string, any changes to the
~>**NOTE:** Because this field expects a JSON string, any changes to the
string will create a diff, even if the JSON itself hasn't changed.
Furthermore drift for this field cannot not be detected because BigQuery
only uses this schema to compute the effective schema for the table, therefore
Expand Down
3 changes: 2 additions & 1 deletion website/docs/r/bigtable_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ The following arguments are supported:

* `name` - (Required) The name (also called Instance Id in the Cloud Console) of the Cloud Bigtable instance.

* `cluster` - (Required) A block of cluster configuration options. This can be specified 1 or 2 times. See structure below.
* `cluster` - (Required) A block of cluster configuration options. This can be specified at least once, and up to 4 times.
See structure below.

-----

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/bigtable_table.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Creates a Google Cloud Bigtable table inside an instance. For more information s
[the official documentation](https://cloud.google.com/bigtable/) and
[API](https://cloud.google.com/bigtable/docs/go/reference).

-> **Note**: It is strongly recommended to set `lifecycle { prevent_destroy = true }`
-> **Note:** It is strongly recommended to set `lifecycle { prevent_destroy = true }`
on tables in order to prevent accidental data loss. See
[Terraform docs](https://www.terraform.io/docs/configuration/resources.html#prevent_destroy)
for more information on lifecycle parameters.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/cloud_scheduler_job.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ The `pubsub_target` block supports:
* `topic_name` -
(Required)
The full resource name for the Cloud Pub/Sub topic to which
messages will be published when a job is delivered. ~>**NOTE**:
messages will be published when a job is delivered. ~>**NOTE:**
The topic name must be in the same format as required by PubSub's
PublishRequest.name, e.g. `projects/my-project/topics/my-topic`.

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/compute_forwarding_rule.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ The following arguments are supported:
forwarding rule. By default, if this field is empty, an ephemeral
internal IP address will be automatically allocated from the IP range
of the subnet or network configured for this forwarding rule.
An address must be specified by a literal IP address. ~> **NOTE**: While
An address must be specified by a literal IP address. ~> **NOTE:** While
the API allows you to specify various resource paths for an address resource
instead, Terraform requires this to specifically be an IP address to
avoid needing to fetching the IP address from resource paths on refresh
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/deployment_manager_deployment.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ The `imports` block supports:
that are not actually instantiated. This allows you to preview a
deployment. It can be updated to false to actually deploy
with real resources.
~>**NOTE**: Deployment Manager does not allow update
~>**NOTE:** Deployment Manager does not allow update
of a deployment in preview (unless updating to preview=false). Thus,
Terraform will force-recreate deployments if either preview is updated
to true or if other fields are updated while preview is true.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/healthcare_fhir_store.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ The `stream_configs` block supports:

* `resource_types` -
(Optional)
Supply a FHIR resource type (such as "Patient" or "Observation"). See
Supply a FHIR resource type (such as "Patient" or "Observation"). See
https://www.hl7.org/fhir/valueset-resource-types.html for a list of all FHIR resource types. The server treats
an empty list as an intent to stream all the supported resource types in this FHIR store.

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/kms_secret_ciphertext.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ description: |-
Encrypts secret data with Google Cloud KMS and provides access to the ciphertext.


~> **NOTE**: Using this resource will allow you to conceal secret data within your
~> **NOTE:** Using this resource will allow you to conceal secret data within your
resource definitions, but it does not take care of protecting that data in the
logging output, plan output, or state output. Please take care to secure your secret
data outside of resource definitions.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/spanner_database_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,6 @@ IAM policy imports use the identifier of the resource in question, e.g.
$ terraform import google_spanner_database_iam_policy.database project-name/instance-name/database-name
```

-> **Custom Roles**: If you're importing a IAM resource with a custom role, make sure to use the
-> **Custom Roles:** If you're importing a IAM resource with a custom role, make sure to use the
full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.

2 changes: 1 addition & 1 deletion website/docs/r/sql_database_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ resource "google_sql_database_instance" "postgres" {
```

### Private IP Instance
~> **NOTE**: For private IP instance setup, note that the `google_sql_database_instance` does not actually interpolate values from `google_service_networking_connection`. You must explicitly add a `depends_on`reference as shown below.
~> **NOTE:** For private IP instance setup, note that the `google_sql_database_instance` does not actually interpolate values from `google_service_networking_connection`. You must explicitly add a `depends_on`reference as shown below.

```hcl
resource "google_compute_network" "private_network" {
Expand Down

0 comments on commit 3c57adf

Please sign in to comment.