Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App Engine recreated with resource "google_app_engine_application" #2175

Closed
mkozjak opened this issue Oct 5, 2018 · 5 comments
Closed

App Engine recreated with resource "google_app_engine_application" #2175

mkozjak opened this issue Oct 5, 2018 · 5 comments
Labels

Comments

@mkozjak
Copy link
Contributor

mkozjak commented Oct 5, 2018

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
  • If an issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to "hashibot", a community member has claimed the issue already.

Terraform Version

Terraform v0.11.8

  • provider.google v1.19.0 (manually built, copied and named to .terraform/plugins)

Affected Resource(s)

  • google_project
  • google_app_engine_application

Terraform Configuration Files

main.tf

terraform {
	required_version = ">= 0.11.8"
}

// Configure the Google Cloud provider
provider "google" {
	project = "test-dev"
	region = "europe-west3"
	version = "~> 1.18"
}

// Create a project
resource "google_project" "test-dev" {
	name = "test-dev"
	project_id = "test-dev"
	org_id = "${var.org_id}"
	billing_account = "${var.billing_account}"
}

app_engine.tf

resource "google_app_engine_application" "test-dev" {
	project = "${google_project.test-dev.project_id}"
	location_id = "europe-west3"
}

Debug Output

https://gist.github.com/7940003399787e5e521db648630c9b05

Panic Output

Expected Behavior

Terraform should recognize App Engine already exists and skip recreating it.

Actual Behavior

Terraform tries to create an App Engine, but fails with "googleapi: Error 409: This application already exists and cannot be re-created., alreadyExists".
Btw, Terraform doesn't look at $GOPATH/bin for new providers.

Steps to Reproduce

Create your GCP project and App Engine via GCP Console.

  1. terraform init
  2. terraform import google_project.test-dev test-dev
  3. terraform plan
  4. terraform apply

Important Factoids

References

@ghost ghost added the bug label Oct 5, 2018
@danawillow
Copy link
Contributor

Hi @mkozjak, most of our resources don't let you use a "create" action when the resource already exists. Importing it into your state should work. I'm happy to entertain an argument about why app engine should behave differently than the rest, if you have one.

@mkozjak
Copy link
Contributor Author

mkozjak commented Oct 5, 2018

@danawillow Hi! Not sure if I reported okay, but I did import everything before trying plan/apply:

2. terraform import google_project.test-dev test-dev

So, I have created a project and an app engine initially without using terraform. Later on went with importing and trying apply. The rest is in the debug log.

@paddycarver
Copy link
Contributor

@mkozjak Have you tried terraform import google_app_engine_application.test-dev test-dev?

@mkozjak
Copy link
Contributor Author

mkozjak commented Oct 5, 2018

@paddycarver Oh yes, sorry, I haven't tried that one. For some reason I thought it would pull everthing if i did just terraform import google_project.test-dev test-dev. Thanks!

@ghost
Copy link

ghost commented Nov 16, 2018

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Nov 16, 2018
@ghost ghost removed the waiting-response label Nov 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants