我正在使用terraform
导入现有GCP App Engine
资源的状态,以便以后可以使用terraform
来管理资源
我使用以下命令导入
terraform import google_app_engine_standard_app_version.default <project>/default/20200711t113242
此后,我执行terraform show
以标识现有资源的状态,并将其输出复制粘贴到main.tf
文件中,并添加了状态信息中缺少的deployment
部分terraform show
。 app engine
应用是使用来自以下网址的sample GCP code
仓库中的Github
部署的
“ https://github.com/GoogleCloudPlatform/php-docs-samples.git”。
我的总体main.tf看起来像这样
resource "google_app_engine_standard_app_version" "default" {
delete_service_on_destroy = false
inbound_services = []
instance_class = "F1"
noop_on_destroy = false
project = "<project-d>"
runtime = "php72"
service = "default"
deployment {
files {
name = "test"
source_url = "https://github.com/GoogleCloudPlatform/php-docs-samples.git"
}
}
handlers {
auth_fail_action = "AUTH_FAIL_ACTION_REDIRECT"
login = "LOGIN_OPTIONAL"
security_level = "SECURE_OPTIONAL"
url_regex = ".*"
script {
script_path = "auto"
}
}
timeouts {}
}
现在,当我执行terraform plan
时,它会失败并显示以下错误
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.`
google_app_engine_standard_app_version.default: Refreshing state...
[id=apps/adminproject-272208/services/default/version/20200711t113242]
^CInterrupt received.
Please wait for Terraform to exit or data loss may occur. Gracefully shutting down... ^CTwo
interrupts received. Exiting immediately. Note that data loss may have occurred.
^C^C^C^C^C^C^C^C^C^C^C^C^C^C Error: operation canceled Error: rpc error: code = Unavailable
desc = transport is closing
请提出如何解决此问题的建议?从错误看来code repository
不是
可达的。
另外,我想更改label
下versions
部分的GCP Console App Engine
属性。但是我看不到下面文档中的任何参数来修改label
参数。建议
请在这里了解如何使用label
terraform
参数
https://www.terraform.io/docs/providers/google/r/app_engine_standard_app_version.html