由于 403,Terraform 导入应用程序引擎失败

Terraform import app engine failed due to 403

尝试运行 导入现有应用引擎默认服务时,由于 403

而失败

terraform import google_app_engine_standard_app_version.frontpage app/<project-name>/default

terraform 服务帐户既是所有者又是 Appengine 管理员(好的措施),IAP 代理和 IAP 代理被禁用。

constraints/appengine.disableCodeDownload 未在组织级别强制执行。

google_app_engine_standard_app_version.frontpage: Refreshing state... [id=apps/app/services/<project-name>/versions/default]
2020-01-21T10:10:27.517-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: 2020/01/21 10:10:27 [DEBUG] Waiting for state to become: [success]
2020-01-21T10:10:27.517-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: 2020/01/21 10:10:27 [DEBUG] Google API Request Details:
2020-01-21T10:10:27.517-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: ---[ REQUEST ]---------------------------------------
2020-01-21T10:10:27.517-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: GET /v1/apps/app/services/<project-id>/versions/default?alt=json HTTP/1.1
2020-01-21T10:10:27.517-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: Host: appengine.googleapis.com
2020-01-21T10:10:27.517-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: User-Agent: HashiCorp Terraform/0.12.19 (+https://www.terraform.io) Terraform Plugin SDK/1.4.0 terraform-provider-google/3.4.0
2020-01-21T10:10:27.517-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: Content-Type: application/json
2020-01-21T10:10:27.517-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: Accept-Encoding: gzip
2020-01-21T10:10:27.517-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: 
2020-01-21T10:10:27.517-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: 
2020-01-21T10:10:27.517-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: -----------------------------------------------------
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: 2020/01/21 10:10:28 [DEBUG] Google API Response Details:
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: ---[ RESPONSE ]--------------------------------------
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: HTTP/2.0 403 Forbidden
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: Alt-Svc: quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: Cache-Control: private
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: Content-Type: application/json; charset=UTF-8
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: Date: Tue, 21 Jan 2020 15:10:28 GMT
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: Server: ESF

2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: Vary: Origin
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: Vary: X-Origin
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: Vary: Referer
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: X-Content-Type-Options: nosniff
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: X-Frame-Options: SAMEORIGIN
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: X-Xss-Protection: 0
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: 
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: {
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5:   "error": {
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5:     "code": 403,
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5:     "message": "The caller does not have permission",
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5:     "status": "PERMISSION_DENIED"
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5:   }
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: }
2020-01-21T10:10:28.532-0500 [DEBUG] plugin.terraform-provider-google_v3.4.0_x5: 
Error: Error reading AppEngineStandardAppVersion "apps/app/services/<project-id>/versions/default": googleapi: Error 403: The caller does not have permission

我调用的资源不正确,我还需要包含版本 ID。

terraform import google_app_engine_standard_app_version.frontpage {{project}}/{{service}}/{{version_id}}