Error on App Engine Application creation with Terraform - google-app-engine

I currently getting the following error when I run my Terraform Script on my google cloud project:
Error: Error creating App Engine application: googleapi: Error 409: This application already exists and cannot be re-created., alreadyExists
I know it's because it is already running from when I set up a cloud on that project before and used terraform destroy .
In the Documentation of terraform is mentioned, that it currently can not delete it when it's created.
Is there any way I can get around that? Didn't find anything about Error handling or something. Only other method would be two sperate scripts for setting up a cloud environment (with and withoud the app engine application)

Yes, this is the limitation of Terraform.
Terraform is not able to delete App Engine application when you run terraform destroy command.
Two solutions I can think of
Delete the project and recreate it if you are creating full infrastructure using terraform.
Create app manually using gcloud app create

Related

Can't deploy app to App Engine, it fails with `Unable to write to staging bucket` and `unable to resolve resource`

I'm using the gcloud SDK to try to deploy a Dockerfile and app.yaml to app engine. My App Engine service account has Project Editor and Storage Admin and SQL Client roles, and the Cloud Build, App Engine, and App Engine Flexible APIs are all enabled. Nonetheless, I keep encountering this error with gcloud beta:
ERROR: (gcloud.beta.app.deploy) Error Response: [7] Unable to write to staging bucket staging.
<project name>.appspot.com. Please grant access to the App Engine service account on your project
by visiting https://console.developers.google.com/storage/browser?project=<project name>
and this (less clear) error with vanilla gcloud:
ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: unable to resolve source
In a different sandbox/dev project, I didn't have this issue, but in this production project, that hasn't been the case. Adding the SAs manually makes no difference. And weirdly, the deploy is writing the files to the staging bucket, so I don't trust this error. Where it seems to be failing is the step immediately after that--maybe App Engine Flexible service account agent wants to access them; maybe the Dockerfile needs to be passed onward to Cloud Build SA; but in any case, I have tried every combination of granting bucket access to both App Engine and Cloud Build SAs and their agents as well, and it hasn't worked.
My user account has app engine deployer role assigned to it, and even impersonating the App Engine account with its editor role didn't make a difference. Cloud Build has App Deployer role as well.
The error of the Vanilla GCloud indicates that your service account is likely missing some permissions. Try disabling and re-enabling the Cloud Build API in your project so a new service account is created.
This ensures that Cloud Build has permission to start builds.
Also, make sure to wait a few minutes before trying to deploy (like 10 minutes or so), so that the permissions can be propagated to all systems.

Unable to create Google App Engine application

When I tried to create a Google App Engine application via gcloud app create at terminal on Ubuntu and on the web, it gives me the following error,
"ERROR: (gcloud.app.create) Error Response: [13] An internal error occurred while ensuring the default service account exists."
I guess the reason why I don't have the default service account because I deleted a default project on GCP which was made when I started using GCP, not sure though.
I made a service account at IAM & admin menu, but not work. Any idea?
Although I found this answer, it didn't work for me.
How to recover Google App Engine's "default service account"
But I didn't delete the default google app engine service account, it was missing at the first place. Maybe because I tried to create a GAE app on the web and left the page before it's done. I don't know.
Anyway, I make a new project and create a GAE app via gcloud cli, and now it's good to go.

appengine.application.create permission missing

Trying to create a new GAE app using gcloud:
gcloud app create --region "us-central"
Getting:
ERROR: (gcloud.app.create) PERMISSION_DENIED: Operation not allowed
- '#type': type.googleapis.com/google.rpc.ResourceInfo
description: The "appengine.applications.create" permission is required.
The service account has Project Editor and all App Engine roles, but looking in IAM there's actually no "appengine.application.create" permission:
This was from a VM.
Opening Cloud Shell in the same project and typing the same command, I get:
The project [xxx] already contains an App Engine application. You can deploy your application using gcloud app deploy
How can I delete the existing GAE app so that I can create one and how can I create a GAE app from my VM - basically how to add that "create" permission?
You can only create GAE once in a region that cannot be changed. This is what google says:
Important: Each GCP project can contain only a single App Engine application and you cannot change the region after you create the App Engine application.
See e.g. here:
https://cloud.google.com/appengine/docs/flexible/python/managing-projects-apps-billing

Error message "service cloudbuilt.googleapis.com is not for consumer..." when deploying App Engine application

My team and I are working on the Trendy Lights Tutorial.
We have set up all the files and also have converted the .p12 key to .pem key but failed to run the app on the Google Cloud Platform and constantly got the error message saying:
You do not have permission to access project [...] and service
"cloudbuilt.googleapis.com" is not for consumer..."
We have already whitelisted our service account for the use of Earth Engine. Does anyone know what the problem might be?
Thank you so much!
I see that you are attempting to deploy your application to the App Engine Flexible Environment.
The Flexible environment differs from the Standard environment in that it gives you more control over the individual instances that are running your deployed application. It does this by hosting your application within Docker on Compute Engine virtual machines.
Therefore, you will need to enable the Compute Engine API for your project so that the GCloud tool can start new Compute Engine virtual machines when you deploy your application.
Note: Since the Flexible environment uses Compute Engine resources, you will also need to enable billing for your project.
If after performing the above you still experience the 'cloudbuild.googleapis.com' error, I ask that you run gcloud components update, then ensure that the value of account seen in the output of the command gcloud info has Owner or Editor permissions in your project.
If it still persists after all of the above, you should then open a Public Issue Tracker to inform our backend team of the issue.

Cloud Storage Integration failed and not able to add manually created bucket in WordPress AppEngine plugin

AFter looking for several questions already present in here, I am putting here more specific problem about Google Cloud Storage Integration and WordPress AppEngine plugin.
I was following the steps mentioned here:WordPress for Google App Engine.
The problems:
For auto creation of GCS, I followed Administration -> Application Settings -> Cloud Integration. It says: An error occurred when creating the project. Please retry.
As I was unable to create the bucket using above step, so I tried to create it manually and added the same in the WordPress AppEngine plugin, but it says: Invalid bucket or bucket is not writable. Please note that I had created the bucket with the service-account id as a user with write privilege.
So in both the way It was not solving the problem.

Resources