I am trying to create a CloudSQL instance using terraform but its not even trying to create it appears: The CloudSQL dashboard doesnt change
google_sql_database_instance.db-instance: Still creating... [9m41s elapsed]
google_sql_database_instance.db-instance: Still creating... [9m51s elapsed]
google_sql_database_instance.db-instance: Still creating... [10m1s elapsed]
It eventually timesout. Why is that?
resource "google_sql_database_instance" "db-instance" {
# depends_on = [google_service_networking_connection.private-vpc-connection]
name = "sonarqube"
database_version = "POSTGRES_9_6"
region = "asia-southeast1"
settings {
tier = "db-f1-micro"
# ip_configuration {
# private_network = google_compute_network.private-network.self_link
# }
}
}
I even removed the private networking parts
Ok, so I set TF_LOG=DEBUG and saw
2019-11-23T22:04:41.365+0800 [DEBUG] plugin.terraform-provider-google-beta_v3.0.0-beta.1_x4: 2019/11/23 22:04:41 [DEBUG] Dismissed an error as retryable. Waiting for other concurrent Cloud SQL operations to finish - googleapi: Error 409: The instance or operation is not in an appropriate state to handle the request., invalidState
After some googling, I found https://github.com/hashicorp/terraform/issues/20972
This happens because instance names cannot be reused for up to a week after it's deleted.
So I guess the issue is because I am attempting to create an instance with a name that was recently used ...
Related
I use Terraform in order to create Api gateway stage, but when I try to set cache_cluster_enabled = false always I receive an error:
error waiting for API Gateway Stage (ags-1suu2m3o7a-dev) to be
available: unexpected state 'NOT_AVAILABLE', wanted target
'AVAILABLE'. last error: %!s()
resource "aws_api_gateway_stage" "example" {
cache_cluster_enabled = false
cache_cluster_size = 0.5
...
}
Seems for now you need to switch aws version to 3.73.0 according to this issue https://github.com/hashicorp/terraform-provider-aws/issues/22866 it will be fixed in future updates
I'd like to add an A-type DNS name on GCP with the following Terraform code:
data "google_dns_managed_zone" "env_dns_zone" {
name = "env-zone"
}
resource "google_compute_global_address" "argo_events_webhook" {
name = "argo-events-webhook"
}
/*
resource "google_dns_record_set" "argo-events-webhook" {
name = "argo-events-webhook.${data.google_dns_managed_zone.env_dns_zone.dns_name}"
managed_zone = data.google_dns_managed_zone.env_dns_zone.name
rrdatas = [google_compute_global_address.argo_events_webhook.address]
ttl = 600
type = "A"
}
*/
(The out commented part is not causing the error but maybe relevant as it shows more info about what I want to achieve)
But this yields the following error message ...
...
module.gke.google_compute_global_address.argo_events_webhook: Creating...
Error: Error creating GlobalAddress: googleapi: Error 400: STANDARD network tier (the project's default network tier) is not supported: STANDARD network tier is not supported for global address., badRequest
... for which I can't find more information. Does somebody have an idea how to solve this?
What I find confusing is that there are A-level entries added and my terraform code is c/p'ed from their corresponding tf code (+ adjustment of names).
The Standard Network Tier doesn't use the Google global fiber network and use the "standard internet", locally to the region. If you use global address, the address is globally reachable and thus you need to use the premium network tier to access to this feature.
more details here
In your case, you have to update the project configuration to Premium Network Tier. You can achieve this with Terraform
resource "google_compute_project_default_network_tier" "default" {
network_tier = "PREMIUM"
}
I use the following Terraform configuration to try to create a subnet and a Cloud SQL MySQL 5.6 instance on Google Cloud Platform.
resource "google_compute_network" "default" {
name = "my-default-network"
auto_create_subnetworks = "true"
project = "${google_project.project.project_id}"
}
resource "google_sql_database_instance" "wordpress" {
region = "${var.region}"
database_version = "MYSQL_5_6"
project = "${google_project.project.project_id}"
settings {
tier = "db-n1-standard-1"
ip_configuration {
private_network = "${google_compute_network.default.self_link}"
}
}
}
But applying this plan gives me the following vague error. I also tried to destroy the entire project and tried to build it up again, but I get the same error.
google_sql_database_instance.wordpress: Still creating... (20s elapsed)
google_sql_database_instance.wordpress: Still creating... (30s elapsed)
google_sql_database_instance.wordpress: Still creating... (40s elapsed)
Error: Error applying plan:
1 error(s) occurred:
* google_sql_database_instance.wordpress: 1 error(s) occurred:
* google_sql_database_instance.wordpress: Error waiting for Create Instance:
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
Can anyone see what I do wrong here?
Edit:
When adding TF_LOG=debug to the terraform apply-run, I get the following error.
"error": {
"kind": "sql#operationErrors",
"errors": [{
"kind": "sql#operationError",
"code": "INTERNAL_ERROR"
}]
}
Edit 2: Simplified the network setup, but getting the exact same error.
A bit late to the party but I have just had and overcome this issue. In my case it was related to using the private_networking option. My suggestion is to read the documentation paying attention to the "Network Requirements" and check the following:
You have the servicenetworking.googleapis.com API enabled in your project
The ServiceAccount you are running with Terraform has the "Service Network Admin" role
I found that verifying private networking was the issue (by removing it and setting ipv4_enabled = "true") in a temporary instance helped focus my debugging efforts.
Good Luck!
I can not create spanner instance by using nodejs client library.
{ Error: Creating an instance that is in the process of getting
deleted.
at /Users/Chipintoza/GSS Projects/accounts.gss.ge/node_modules/grpc/src/node/src/client.js:442:17
code: 9, metadata: Metadata { _internal_repr: {
'google.rpc.resourceinfo-bin': [Object] } }, note: 'Exception
occurred in retry method that was not classified as transient' }
I looked at Activity and yesterday when i deleted instance it turned out that the error occurred:
Resource name projects/spanner-gss-ge/instances/business-data Error
message Deadline exceeded (HTTP 504): Deadline expired before
operation could complete.
On Console the Instance with this name is not listed.
How can i resolve this issue?
As it is not deleted am i charged on daily basis?
I have no problem with creating instance by the other name.
Is there any way to change the terraform default timeouts?
For example on terraform apply I frequently timeout trying to destroy autoscaling groups:
module.foo.aws_autoscaling_group.bar (deposed #0): Still destroying... (10m0s elapsed)
Error applying plan:
1 error(s) occurred:
* aws_autoscaling_group.bar (deposed #0): group still has 1 instances
If I re-run the terraform apply, it works. It seems like the timeout is 10 minutes -- I'd like to double the time so that it finishes reliably. Alternatively, is there a way to get the auto scaling groups to delete faster?
You can add a timeout to a specific resource inside terraform
timeouts {
create = "60m"
delete = "2h"
}
https://www.terraform.io/docs/configuration/resources.html
i have the same problem when i try to delete autoscaling-group with terraform destroy
I solve the problem with add the follow lines on my resource creation section:
timeouts {
delete = "60m"
}