Closed hb9cwp closed 2 years ago
Ah ok I see whats happening here. Flys api internally uses name
and id
interchangeably, so in your example both the name and id of your app would be https-helloworld-11. Terraform it seems expects that the "primary key" if it were is a field called id
not name
. Let me look into the best way to make terraform not complain about that.
Fly is now very kindly sponsoring my work on this provider. So it should move over there sometime this week and become rapidly more stable and ready for production use.
Thank you for the report! I'll keep you posted. I am doing a big cleanup today as I prepare to migrate it to the fly repo and I am hoping to clear this issue up
Should be fixed by v0.0.4 https://registry.terraform.io/providers/DAlperin/fly-io/0.0.4
Feel free to re-open or file new issue if it breaks in a new way. The fly team is working on a slight api modification that will allow importing all resources seamless, so those should work soon too.
Great, works now, thanks for the quick response! Also, glad to hear about Fly supporting you.
Just for the records, here is what I did for testing based on the above, above bumping the required version from 0.0.3 up to 0.0.4 in the .tf configuration above:
$ terraform init -upgrade
Initializing the backend...
Initializing provider plugins...
- Finding dalperin/fly-io versions matching "0.0.4"...
- Installing dalperin/fly-io v0.0.4...
- Installed dalperin/fly-io v0.0.4 (self-signed, key ID 741FCF3CF97659FF)
...
Terraform has been successfully initialized!
...
$ terraform import fly_app.exampleApp https-helloworld-11
fly_app.exampleApp: Importing from ID "https-helloworld-11"...
fly_app.exampleApp: Import prepared!
Prepared fly_app for import
fly_app.exampleApp: Refreshing state... [id=https-helloworld-11]
Import successful!
Upon trying to import the state of an app resource that I had launched on Fly.io earlier using
flyctl
while following the Learn tutorial "Import Terraform Configuration" :Outside of Terraform, start the app
$ fly launch --name https-helloworld-11
using the Dockerfile that runs a tiny static Web server written in Go "GoStatic":Then, try to import the (state of) app into the Terraform, see the "emtpy"
.tf
configuration below:Terraform configuration file, still mostly "empty", but prepared to be un-commented & merged once TF state is imported successfully: