Google cloud platform 不正确的服务网络配置,例如:xxxx:服务网络未启用
我正试图通过terraform在GCP中复制一个SQL实例。活动实例具有公共IP,但是辅助项目的子网与使用SQL实例的项目共享,并且SQL实例与辅助项目的网络相关联 我已经在Google cloud platform 不正确的服务网络配置,例如:xxxx:服务网络未启用,google-cloud-platform,terraform,google-cloud-sql,terraform-provider-gcp,google-vpc,Google Cloud Platform,Terraform,Google Cloud Sql,Terraform Provider Gcp,Google Vpc,我正试图通过terraform在GCP中复制一个SQL实例。活动实例具有公共IP,但是辅助项目的子网与使用SQL实例的项目共享,并且SQL实例与辅助项目的网络相关联 我已经在ip\u配置部分正确地添加了private\u network设置,但是我得到了以下错误: 错误:错误,未能创建实例xxxx:googleapi:Error 400:无效请求:实例xxxx:xxxxx:Service_Networking_未启用的服务网络配置不正确,无效 我在谷歌搜索那个特定错误时找不到太多文档,而且我对T
ip\u配置
部分正确地添加了private\u network
设置,但是我得到了以下错误:
错误:错误,未能创建实例xxxx:googleapi:Error 400:无效请求:实例xxxx:xxxxx:Service_Networking_未启用的服务网络配置不正确,无效
我在谷歌搜索那个特定错误时找不到太多文档,而且我对Terraform比较陌生,所以我希望有人能指出我在Terraform配置的这一部分或其他资源中遗漏了什么
resource "google_sql_database_instance" "cloudsql-instance-qa" {
depends_on = [google_project_service.project_apis]
database_version = "MYSQL_5_7"
name = "${var.env_shorthand}-${var.resource_name}"
project = var.project_id
region = var.region
settings {
activation_policy = "ALWAYS"
availability_type = "ZONAL"
backup_configuration {
binary_log_enabled = "true"
enabled = "true"
point_in_time_recovery_enabled = "false"
start_time = "15:00"
}
crash_safe_replication = "false"
disk_autoresize = "true"
disk_size = "5003"
disk_type = "PD_SSD"
ip_configuration {
ipv4_enabled = "true"
private_network = "projects/gcp-backend/global/networks/default"
require_ssl = "false"
}
location_preference {
zone = var.zone
}
maintenance_window {
day = "7"
hour = "4"
}
pricing_plan = "PER_USE"
replication_type = "SYNCHRONOUS"
tier = "db-n1-standard-1"
}
}
如果您看到以下错误: 错误:错误,创建实例xxxx:googleapi:Error 400失败: 无效请求:不正确的服务网络配置,例如: xxxx:xxxxx:服务网络未启用,无效 启用服务网络API:
gcloud services enable servicenetworking.googleapis.com --project=[PSM_PROJECT_NUMBER]
您正在定义公共IP地址(
ipv4\u enabled=“true”
)和私有IP地址(private\u network=“projects/gcp backend/global/networks/default”
)。使用一个或另一个,但不能同时使用两个。@JohnHanley我将ipv4\u enalbed
设置为false
,但仍然得到相同的错误。我需要在其他地方更新设置吗?当前的活动/工作实例是一个公用和专用IP,它与辅助项目中的网络相关联。您是否尝试在其他项目中指定网络?@JohnHanley是的,它是另一个项目中的默认网络。我想您还有其他问题。您是否启用了“服务网络API”?