terraform-provider-sumologic icon indicating copy to clipboard operation
terraform-provider-sumologic copied to clipboard

Creating a field with upper-case name results in weird state

Open mccartney opened this issue 3 years ago • 2 comments

Steps to reproduce

  1. Define a field which uses some upper-case characters in its name, e.g.
resource "sumologic_field" "TotallyDifferent" {
  count = 1
  field_name = "TotallyDifferent"
  data_type = "String"
  state = "Enabled"
}
  1. terraform apply

Observed

  1. As observed in the UI, the lower-case variant of the field is created, e.g. totallydifferent:
  2. Terraform returns an error with a weird error message:
│ Error: Field "TotallyDifferent" not found
│ 
│   with sumologic_field.TotallyDifferent[0],
│   on a.tf line 19, in resource "sumologic_field" "TotallyDifferent":
│   19: resource "sumologic_field" "TotallyDifferent" {

Expected

  • Consistent policy on whether field names should be all lower-case or not
  • As a consequence of that, proper handling of mixed-case names

mccartney avatar Jul 04 '22 05:07 mccartney

After a sequence of these operations, there's no (?) way to undo the damage from the Terraform itself. It looks like one needs to:

  1. Delete the field in the UI
  2. terraform state rm 'sumologic_field.TotallyDifferent[0]'

mccartney avatar Jul 04 '22 05:07 mccartney

Creating an all lower-case field works as expected.

mccartney avatar Jul 04 '22 05:07 mccartney