【发布时间】:2019-02-23 11:23:39
【问题描述】:
我在设置 GCP 实例模板时遇到了新问题。我假设 terraform gcp 提供程序有更新。
resource "google_compute_instance_template" "backend-template" {
name = "${var.platform_name}-backend-instance-template"
description = "Template used for backend instances"
instance_description = "backend Instance"
machine_type = "n1-standard-1"
metadata_startup_script = "${lookup(var.startup_scripts,"backend-server")}"
disk {
boot = "true"
source_image = "backend-packer-image"
}
metadata {
APP_SETTINGS = "${var.app_settings}"
URL_STAGING = "${var.url_staging}"
API_URL_STAGING = "${var.api_url_staging}"
URL_PRODUCTION = "${var.url_production}"
API_URL_PRODUCTION = "${var.api_url_production}"
LOGIN_URL = "${var.login_url}"
API_URL = "${var.api_url}"
vault_server_IP = "${lookup(var.static_ips, "vault-server")}"
environment = "${var.environment}"
}
network_interface {
subnetwork = "${google_compute_subnetwork.private-fe-be.self_link}"
}
lifecycle {
create_before_destroy = true
}
tags = ["no-ip", "backend-server"]
service_account {
scopes = ["cloud-platform"]
}
}
这是运行脚本后的当前错误。但是,图像backend-packer-image 已经创建并存在于 GCP 上
* google_compute_instance_template.backend-template: 1 error(s) occurred:
* google_compute_instance_template.backend-template: error flattening disks: Error getting relative path for source image: String was not a self link: global/images/backend-packer-image
【问题讨论】:
-
看起来这是一个已知问题,正在github.com/terraform-providers/terraform-provider-google/issues/…进行跟踪
-
@ydaetskcoR 谢谢,到目前为止,它确实有一天的历史。几个小时前它已经工作了,我也没有任何改变。
-
在
1.17.1中可以正常工作吗? changelog 中也有关于此的注释,但除非有错误,否则它似乎不应该适用于此。我也有点惊讶,因为 v2 版本没有被阻止,因为它看起来对我来说是一个重大变化(即使只是为了某些配置),但我不太了解 GCP 提供程序。
标签: google-cloud-platform terraform devops terraform-provider-gcp