I am using terraform
to import the state of existing GCP App Engine Resource
so that the resource can be later managed with terraform
I imported using below command
terraform import google_app_engine_standard_app_version.default <project>/default/20200711t113242
After that I executed terraform show
to identify the state of existing resources and copy pasted the output of it to main.tf
file and added the deployment
section which was missing in the state information from terraform state
Now when I executed terraform show
, it was showing error for missing deployment
attribute . The app engine app was deployed using the sample GCP code from Github
repo from the below URL
“https://github.com/GoogleCloudPlatform/php-docs-samples.git” .
My overall main.tf looks like this
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 {}
}
Now when I execute terraform plan
, it fails with below error
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
- Please suggest how to resolve the issue ? It seems from the error the code repository is not reachable .
- Also I would like to change the
label
attribute from theversions
section underApp Engine
. But I don’t see any argument from the below doc to modify thelabel
argument . Also suggest here please.
https://www.terraform.io/docs/providers/google/r/app_engine_standard_app_version.html