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

terraform import sumologic_collector fails on name with / #578

Open
dindurthy opened this issue Sep 14, 2023 · 1 comment
Open

terraform import sumologic_collector fails on name with / #578

dindurthy opened this issue Sep 14, 2023 · 1 comment
Labels

Comments

@dindurthy
Copy link

dindurthy commented Sep 14, 2023

Steps to reproduce:

  • create a collector via UI or API with / in the name, e.g. env/collector
  • Setup terraform for import
# main.tf
resource "sumologic_collector" "collector" {
  name        = "env/collector"
  description = "Just testing this"
  fields  = {
    environment = "production"
  }
}

provider "sumologic" {
    access_id   = "redacted"
    access_key  = "redacted"
    environment = "us2"
}

terraform {
    required_providers {
        sumologic = {
            source = "sumologic/sumologic"
        }
    }
    required_version = ">= 0.13"
}
  • Try to import the resource:
dharmarajindurthy@Dharmarajs-Laptop tf-sumo-collector % terraform import sumologic_collector.collector "env/collector"
sumologic_collector.collector: Importing from ID "env/collector"...
sumologic_collector.collector: Import prepared!
  Prepared sumologic_collector for import
sumologic_collector.collector: Refreshing state... [id=env/collector]
╷
│ Error: collector with name 'env/collector' does not exist
│
│
╵

But creating the resource conflicts:

% terraform apply

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following
symbols:
  + create

Terraform will perform the following actions:

  # sumologic_collector.collector will be created
  + resource "sumologic_collector" "collector" {
      + description = "Just testing this"
      + fields      = {
          + "environment" = "production"
        }
      + id          = (known after apply)
      + name        = "env/collector"
      + timezone    = "Etc/UTC"
    }

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

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

sumologic_collector.collector: Creating...
╷
│ Error: {
│   "status" : 400,
│   "id" : "2QKP5-6OPWX-6OBCI",
│   "code" : "collectors.validation.name.duplicate",
│   "message" : "A resource with the same name already exists."
│ }
│
│   with sumologic_collector.collector,
│   on main.tf line 1, in resource "sumologic_collector" "collector":
│    1: resource "sumologic_collector" "collector" {
│
╵

This impacts the sumologic kubernetes collection setup job

@rymancl
Copy link

rymancl commented Feb 16, 2024

I just hit this issue, but it isn't specifically around importing. I'm getting it when using the sumologic_collector data source.

data "sumologic_collector" "rds" {
  name = "AWS/RDS"
}

│ Error: collector with name AWS/RDS not found: collector with name 'AWS/RDS' does not exist

│ with data.sumologic_collector.rds,
│ on sumologic.tf line 9, in data "sumologic_collector" "rds":
│ 9: data "sumologic_collector" "rds" {

If I rename it to AWS RDS, it works fine.

Version 2.28.2 of the sumologic provider.

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

No branches or pull requests

3 participants