Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] Add a Config Connector provider to MM #4345

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions google/error_retry_predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ func pubsubTopicProjectNotReady(err error) (bool, string) {
}
return false, ""
}

func isSqlOperationInProgressError(err error) (bool, string) {
if gerr, ok := err.(*googleapi.Error); ok && gerr.Code == 409 {
return true, "Waiting for other concurrent Cloud SQL operations to finish"
}
return false, ""
}
37 changes: 19 additions & 18 deletions google/resource_sql_database_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,11 +490,12 @@ func resourceSqlDatabaseInstanceCreate(d *schema.ResourceData, meta interface{})
defer mutexKV.Unlock(instanceMutexKey(project, instance.MasterInstanceName))
}

op, err := config.clientSqlAdmin.Instances.Insert(project, instance).Do()
var op *sqladmin.Operation
err = retryTimeDuration(func() (operr error) {
op, operr = config.clientSqlAdmin.Instances.Insert(project, instance).Do()
return operr
}, d.Timeout(schema.TimeoutCreate), isSqlOperationInProgressError)
if err != nil {
if gerr, ok := err.(*googleapi.Error); ok && gerr.Code == 409 {
return fmt.Errorf("Error, failed to create instance %s with error code 409: %s. This may be due to a name collision - SQL instance names cannot be reused within a week.", instance.Name, err)
}
return fmt.Errorf("Error, failed to create instance %s: %s", instance.Name, err)
}

Expand All @@ -515,10 +516,10 @@ func resourceSqlDatabaseInstanceCreate(d *schema.ResourceData, meta interface{})
// Users in a replica instance are inherited from the master instance and should be left alone.
if sqlDatabaseIsMaster(d) {
var users *sqladmin.UsersListResponse
err = retryTime(func() error {
err = retryTimeDuration(func() error {
users, err = config.clientSqlAdmin.Users.List(project, instance.Name).Do()
return err
}, 5)
}, d.Timeout(schema.TimeoutRead), isSqlOperationInProgressError)
if err != nil {
return fmt.Errorf("Error, attempting to list users associated with instance %s: %s", instance.Name, err)
}
Expand Down Expand Up @@ -701,13 +702,10 @@ func resourceSqlDatabaseInstanceRead(d *schema.ResourceData, meta interface{}) e
}

var instance *sqladmin.DatabaseInstance
err = retry(
func() error {
instance, err = config.clientSqlAdmin.Instances.Get(project, d.Id()).Do()
return err
},
)

err = retryTimeDuration(func() (rerr error) {
instance, rerr = config.clientSqlAdmin.Instances.Get(project, d.Id()).Do()
return rerr
}, d.Timeout(schema.TimeoutRead), isSqlOperationInProgressError)
if err != nil {
return handleNotFoundError(err, d, fmt.Sprintf("SQL Database Instance %q", d.Get("name").(string)))
}
Expand Down Expand Up @@ -781,7 +779,11 @@ func resourceSqlDatabaseInstanceUpdate(d *schema.ResourceData, meta interface{})
defer mutexKV.Unlock(instanceMutexKey(project, v.(string)))
}

op, err := config.clientSqlAdmin.Instances.Update(project, d.Get("name").(string), instance).Do()
var op *sqladmin.Operation
err = retryTimeDuration(func() (rerr error) {
op, rerr = config.clientSqlAdmin.Instances.Update(project, d.Get("name").(string), instance).Do()
return rerr
}, d.Timeout(schema.TimeoutUpdate), isSqlOperationInProgressError)
if err != nil {
return fmt.Errorf("Error, failed to update instance settings for %s: %s", instance.Name, err)
}
Expand Down Expand Up @@ -810,11 +812,10 @@ func resourceSqlDatabaseInstanceDelete(d *schema.ResourceData, meta interface{})
}

var op *sqladmin.Operation
err = retryTimeDuration(func() error {
op, err = config.clientSqlAdmin.Instances.Delete(project, d.Get("name").(string)).Do()
return err
err = retryTimeDuration(func() (rerr error) {
op, rerr = config.clientSqlAdmin.Instances.Delete(project, d.Get("name").(string)).Do()
return rerr
}, d.Timeout(schema.TimeoutDelete))

if err != nil {
return fmt.Errorf("Error, failed to delete instance %s: %s", d.Get("name").(string), err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ To get more information about AccessLevel, see:

## Example Usage - Access Context Manager Access Level Basic


```hcl
resource "google_access_context_manager_access_level" "access-level" {
parent = "accessPolicies/${google_access_context_manager_access_policy.test-access.name}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ To get more information about AccessPolicy, see:

## Example Usage - Access Context Manager Access Policy Basic


```hcl
resource "google_access_context_manager_access_policy" "access-policy" {
parent = "organizations/123456789"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ To get more information about ServicePerimeter, see:

## Example Usage - Access Context Manager Service Perimeter Basic


```hcl
resource "google_access_context_manager_service_perimeter" "service-perimeter" {
parent = "accessPolicies/${google_access_context_manager_access_policy.test-access.name}"
Expand Down
1 change: 0 additions & 1 deletion website/docs/r/app_engine_firewall_rule.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ To get more information about FirewallRule, see:
</div>
## Example Usage - App Engine Firewall Rule Basic


```hcl
resource "google_project" "my_project" {
name = "tf-test-project"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ To get more information about StandardAppVersion, see:
</div>
## Example Usage - App Engine Standard App Version


```hcl
resource "google_storage_bucket" "bucket" {
name = "appengine-static-content"
Expand Down
1 change: 0 additions & 1 deletion website/docs/r/bigquery_data_transfer_config.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ To get more information about Config, see:

## Example Usage - Scheduled Query


```hcl
data "google_project" "project" {}

Expand Down
1 change: 0 additions & 1 deletion website/docs/r/bigquery_dataset.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ Datasets allow you to organize and control access to your tables.
</div>
## Example Usage - Bigquery Dataset Basic


```hcl
resource "google_bigquery_dataset" "dataset" {
dataset_id = "example_dataset"
Expand Down
2 changes: 0 additions & 2 deletions website/docs/r/bigtable_app_profile.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ App profile is a configuration object describing how Cloud Bigtable should treat
</div>
## Example Usage - Bigtable App Profile Multicluster


```hcl
resource "google_bigtable_instance" "instance" {
name = "tf-test-instance-"
Expand All @@ -59,7 +58,6 @@ resource "google_bigtable_app_profile" "ap" {
</div>
## Example Usage - Bigtable App Profile Singlecluster


```hcl
resource "google_bigtable_instance" "instance" {
name = "tf-test-instance-"
Expand Down
2 changes: 0 additions & 2 deletions website/docs/r/binary_authorization_attestor.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ To get more information about Attestor, see:

## Example Usage - Binary Authorization Attestor Basic


```hcl
resource "google_binary_authorization_attestor" "attestor" {
name = "test-attestor"
Expand Down Expand Up @@ -71,7 +70,6 @@ resource "google_container_analysis_note" "note" {
```
## Example Usage - Binary Authorization Attestor Kms


```hcl
resource "google_binary_authorization_attestor" "attestor" {
name = "test-attestor"
Expand Down
2 changes: 0 additions & 2 deletions website/docs/r/binary_authorization_policy.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ To get more information about Policy, see:

## Example Usage - Binary Authorization Policy Basic


```hcl
resource "google_binary_authorization_policy" "policy" {
admission_whitelist_patterns {
Expand Down Expand Up @@ -70,7 +69,6 @@ resource "google_binary_authorization_attestor" "attestor" {
```
## Example Usage - Binary Authorization Policy Global Evaluation


```hcl
resource "google_binary_authorization_policy" "policy" {

Expand Down
5 changes: 0 additions & 5 deletions website/docs/r/cloud_scheduler_job.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ To get more information about Job, see:
</div>
## Example Usage - Scheduler Job Pubsub


```hcl
resource "google_pubsub_topic" "topic" {
name = "job-topic"
Expand All @@ -67,7 +66,6 @@ resource "google_cloud_scheduler_job" "job" {
</div>
## Example Usage - Scheduler Job Http


```hcl
resource "google_cloud_scheduler_job" "job" {
name = "test-job"
Expand All @@ -88,7 +86,6 @@ resource "google_cloud_scheduler_job" "job" {
</div>
## Example Usage - Scheduler Job App Engine


```hcl
resource "google_cloud_scheduler_job" "job" {
name = "test-job"
Expand Down Expand Up @@ -116,7 +113,6 @@ resource "google_cloud_scheduler_job" "job" {
</div>
## Example Usage - Scheduler Job Oauth


```hcl
data "google_compute_default_service_account" "default" { }

Expand All @@ -143,7 +139,6 @@ resource "google_cloud_scheduler_job" "job" {
</div>
## Example Usage - Scheduler Job Oidc


```hcl
data "google_compute_default_service_account" "default" { }

Expand Down
1 change: 0 additions & 1 deletion website/docs/r/cloudbuild_trigger.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ To get more information about Trigger, see:
</div>
## Example Usage - Cloudbuild Trigger Filename


```hcl
resource "google_cloudbuild_trigger" "filename-trigger" {
trigger_template {
Expand Down
3 changes: 0 additions & 3 deletions website/docs/r/compute_address.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ To get more information about Address, see:
</div>
## Example Usage - Address Basic


```hcl
resource "google_compute_address" "ip_address" {
name = "my-address"
Expand All @@ -63,7 +62,6 @@ resource "google_compute_address" "ip_address" {
</div>
## Example Usage - Address With Subnetwork


```hcl
resource "google_compute_network" "default" {
name = "my-network"
Expand Down Expand Up @@ -91,7 +89,6 @@ resource "google_compute_address" "internal_with_subnet_and_address" {
</div>
## Example Usage - Instance With Ip


```hcl
resource "google_compute_address" "static" {
name = "ipv4-address"
Expand Down
2 changes: 0 additions & 2 deletions website/docs/r/compute_autoscaler.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ To get more information about Autoscaler, see:
</div>
## Example Usage - Autoscaler Single Instance


```hcl
resource "google_compute_autoscaler" "default" {
provider = "google-beta"
Expand Down Expand Up @@ -129,7 +128,6 @@ provider "google-beta"{
</div>
## Example Usage - Autoscaler Basic


```hcl
resource "google_compute_autoscaler" "foobar" {
name = "my-autoscaler"
Expand Down
1 change: 0 additions & 1 deletion website/docs/r/compute_backend_bucket.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ To get more information about BackendBucket, see:
</div>
## Example Usage - Backend Bucket Basic


```hcl
resource "google_compute_backend_bucket" "image_backend" {
name = "image-backend-bucket"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ we cannot confirm or reverse changes to a key outside of Terraform.

## Example Usage - Backend Bucket Signed Url Key


```hcl
resource "google_compute_backend_bucket_signed_url_key" "backend_key" {
name = "test-key"
Expand Down
1 change: 0 additions & 1 deletion website/docs/r/compute_backend_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ To get more information about BackendService, see:
</div>
## Example Usage - Backend Service Basic


```hcl
resource "google_compute_backend_service" "default" {
name = "backend-service"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ we cannot confirm or reverse changes to a key outside of Terraform.

## Example Usage - Backend Service Signed Url Key


```hcl
resource "google_compute_backend_service_signed_url_key" "backend_key" {
name = "test-key"
Expand Down
1 change: 0 additions & 1 deletion website/docs/r/compute_disk.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ state as plain-text.
</div>
## Example Usage - Disk Basic


```hcl
resource "google_compute_disk" "default" {
name = "test-disk"
Expand Down
1 change: 0 additions & 1 deletion website/docs/r/compute_firewall.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ To get more information about Firewall, see:
</div>
## Example Usage - Firewall Basic


```hcl
resource "google_compute_firewall" "default" {
name = "test-firewall"
Expand Down
2 changes: 0 additions & 2 deletions website/docs/r/compute_forwarding_rule.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ To get more information about ForwardingRule, see:
</div>
## Example Usage - Forwarding Rule Basic


```hcl
resource "google_compute_forwarding_rule" "default" {
name = "website-forwarding-rule"
Expand All @@ -58,7 +57,6 @@ resource "google_compute_target_pool" "default" {
</div>
## Example Usage - Forwarding Rule Internallb


```hcl
// Forwarding rule for Internal Load Balancing
resource "google_compute_forwarding_rule" "default" {
Expand Down
1 change: 0 additions & 1 deletion website/docs/r/compute_global_address.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ To get more information about GlobalAddress, see:
</div>
## Example Usage - Global Address Basic


```hcl
resource "google_compute_global_address" "default" {
name = "global-appserver-ip"
Expand Down
2 changes: 0 additions & 2 deletions website/docs/r/compute_global_forwarding_rule.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ https://cloud.google.com/compute/docs/load-balancing/http/
</div>
## Example Usage - Global Forwarding Rule Http


```hcl
resource "google_compute_global_forwarding_rule" "default" {
name = "global-rule"
Expand Down Expand Up @@ -96,7 +95,6 @@ resource "google_compute_http_health_check" "default" {
</div>
## Example Usage - Global Forwarding Rule Internal


```hcl
resource "google_compute_global_forwarding_rule" "default" {
provider = "google-beta"
Expand Down
1 change: 0 additions & 1 deletion website/docs/r/compute_health_check.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ To get more information about HealthCheck, see:
</div>
## Example Usage - Health Check Basic


```hcl
resource "google_compute_health_check" "internal-health-check" {
name = "internal-service-health-check"
Expand Down
1 change: 0 additions & 1 deletion website/docs/r/compute_http_health_check.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ To get more information about HttpHealthCheck, see:
</div>
## Example Usage - Http Health Check Basic


```hcl
resource "google_compute_http_health_check" "default" {
name = "authentication-health-check"
Expand Down
1 change: 0 additions & 1 deletion website/docs/r/compute_https_health_check.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ To get more information about HttpsHealthCheck, see:
</div>
## Example Usage - Https Health Check Basic


```hcl
resource "google_compute_https_health_check" "default" {
name = "authentication-health-check"
Expand Down
1 change: 0 additions & 1 deletion website/docs/r/compute_image.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ To get more information about Image, see:
</div>
## Example Usage - Image Basic


```hcl
resource "google_compute_image" "example" {
name = "example-image"
Expand Down
Loading