fly-apps / terraform-provider-fly

Terraform provider for the Fly.io API
BSD 3-Clause "New" or "Revised" License
113 stars 37 forks source link

"Could not resolve organization" when creating fly_app #136

Closed alexnitta closed 1 year ago

alexnitta commented 1 year ago

When creating a fly_app resource, if I specify an org other than "personal", I get an error when I run terraform apply:

│ Error: Could not resolve organization
│
│   with fly_app.main_app,
│   on main.tf line 51, in resource "fly_app" "main_app":
│   51: resource "fly_app" "main_app" {
│
│ input:3: organization Could not find

The terraform resource block is very simple:

resource "fly_app" "main_app" {
  name = local.fly_app_name
  org  = var.fly_organization
}

Though I am using a local variable and a variable for these values respectively, I have ruled out an issues with variable references by just changing the value of var.fly_organization. When the value is "personal", everything works fine. When it is set to the name of an organization that I have created in the Fly.io dashboard, it fails.

alexnitta commented 1 year ago

I realized that I was using the organization name shown in the dropdown menu for Organization, but I actually should have been using the organization ID shown in the URL, as in https://fly.io/dashboard/<organization_id>. Once I did that, I was able to create the fly_app resource as expected.