Import resource not working zsh terminal

hi guys ,

i have created a team in squadcast with terraform

with this code

variable "team_map" {
  type = map(
    object({
      name        = string,
      description = optional(string)
      }
    )
  )
}
resource "squadcast_team" "teams" {
  for_each    = var.team_map
  name        = each.value.name
  description = each.value.description
}



yaml file for that

teams:
  - team:
      name: test
      description: The team responsible for the cloud

now i have one team Test that is created manually
and i want to managed that team with this configuration

i tried with this command

terragrunt import 'squadcast_team.teams["test"]' 63b55 

error

zsh:1: no matches found: squadcast_team.teams["testimp"]

how to import it ?

Hi @dhavalshah512,

The error output of no matches found: squadcast_team.teams[“testimp”] indicates that the argument was not escaped when passed to zsh, and was used as a glob expression.

This either means that you did not actually wrap the argument in single quotes as shown, or terragrunt is passing the cli arguments to a new instance of the shell without escaping them. I’m not sure what exactly terragrunt is doing here, but you could just use terraform directly to eliminate that variable in the problem.

> terragrunt import 'squadcast_team.teams["testimp"]' testimp
> terragrunt import 'squadcast_team.teams[\"testimp\"]' testimp
> terraform  import 'squadcast_team.teams[\"testimp\"]' testimp

i tried all three but same error
@jbardin

@dhavalshah512,

Make sure you are using an actual ascii single quote (apostrophe). Copying and pasting the text shown in your examples will use left and right unicode single quotation marks, which are not going to be considered in the shell’s quoting rules.

Using zsh:

% terraform import 'squadcast_team.teams["testimp"]' testimp
Error: resource address "squadcast_team.teams[\"testimp\"]" does not exist in the configuration.

(which means the command was parsed correctly)

Looking at the source for your post, it seems you may be trying to escape the quotes incorrectly too, but I cannot tell if that is because you are using the incorrect markdown for the forum or not. Make sure you are showing the exact same characters here as you are using in your terminal.

@jbardin updated the code
can you check now

In a shell, the double quotes are escaped by being nested within the single quotes, so the last example would produce a different error from Terraform about the incorrect \ characters in the argument. However the no matches found error is coming from your shell, before any commands are being executed.