SumoLogic / terraform-provider-sumologic

Terraform provider for Sumo Logic
https://www.terraform.io/docs/providers/sumologic/
Mozilla Public License 2.0
40 stars 57 forks source link

terraform import sumologic_collector fails on name with `/` #578

Open dindurthy opened 1 year ago

dindurthy commented 1 year ago

Steps to reproduce:

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:

Terraform will perform the following actions:

sumologic_collector.collector will be created

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](https://github.com/SumoLogic/sumologic-kubernetes-collection/issues/2934)
rymancl commented 9 months ago

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.