Terraform Provider permission denied

tunnel error (doConnect): tunnel error (wgDev.Up()): permission denied

In terraform cloud, I added FLY_API_TOKEN into the remote environment, giving me permission denied when applying.

This is my setup.

terraform {
  required_providers {
    fly = {
      source = "fly-apps/fly"
      version = "0.0.20"
    }
  }
}

provider "fly" {
  useinternaltunnel    = true
  internaltunnelorg    = "some_org"
  internaltunnelregion = "ams"
}

resource "fly_app" "gateway" {
  name = "gateway"
  org  = "some_org"
}

The complete error

│ Error: failed to open internal tunnel
│ 
│   with module.fly_gateway.provider["registry.terraform.io/fly-apps/fly"],
│   on fly/main.tf line 10, in provider "fly":
│   10: provider "fly" {
│ 
│ tunnel error (doConnect): tunnel error (wgDev.Up()): permission denied

Hey @botch

I also had the same permission error in TF Cloud. Instead of defining the three tunnel options, adding fly_http_endpoint under the provider should work:

provider "fly" {
  fly_http_endpoint = "api.machines.dev"
}

I got this info from: https://github.com/fly-apps/terraform-provider-fly/issues/42

2 Likes