terraform-provider-sumologic
terraform-provider-sumologic copied to clipboard
terraform import sumologic_collector fails on name with `/`
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" {
│
╵
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.