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

Error importing folders #156

Closed
askthedust opened this issue Jan 22, 2021 · 2 comments
Closed

Error importing folders #156

askthedust opened this issue Jan 22, 2021 · 2 comments

Comments

@askthedust
Copy link

Hi there,

Terraform v0.12.28
+ provider.grafana v1.8.1

Resource used

provider "grafana" {
  url    = var.url
  org_id = var.org_id
}

resource "grafana_folder" "this" {
  for_each = toset(var.folders)
  title = each.key
}

the error appears when importing a folder:

terraform import 'module.grafana_org_prod.grafana_folder.this["folder_name"]' 332

error:

module.grafana_org_prod.grafana_folder.this["folder_name"]: Importing from ID "332"...
module.grafana_org_prod.grafana_folder.this["folder_name"]: Import prepared!
  Prepared grafana_folder for import
module.grafana_org_prod.grafana_folder.this["folder_name"]: Refreshing state... [id=332]

Error: Get "/api/folders/id/332": unsupported protocol scheme ""

trying to apply the plan:

# module.grafana_org_prod.grafana_folder.this["folder_name"] will be created
  + resource "grafana_folder" "this" {
      + id    = (known after apply)
      + title = "folder_name"
      + uid   = (known after apply)
    }

Plan: 25 to add, 0 to change, 0 to destroy.

If I simply try to apply the plan I see the correct number of folders already present in the org, but I'm starting now to manage them with terraform and I have to import all of them

@nikosmeds
Copy link
Contributor

@askthedust is this still an issue?

If so, please provide complete details on how to reproduce (e.g. examples of the variable and module being used).

I attempted to recreate this locally but everything is working correctly:

variable "folders" {
  type = list(string)
  default = [
    "Imported1",
    "Imported2",
  ]
}

resource "grafana_folder" "this" {
  for_each = toset(var.folders)
  title = each.key
}

I created a few folders on a local Grafana server and was able to successfully import them with the following:

$ terraform import 'grafana_folder.this["Imported1"]' 5
$ terraform import 'grafana_folder.this["Imported2"]' 4

@julienduchesne
Copy link
Member

The issue was a missing validation on the Grafana URL: #395

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants