Skip to content

Rover import  #352

@gevraud

Description

@gevraud

Hello,

I have some existing ad groups that were created manually by a collegue and I want to import them into my tfstate.

I did this command

➜  caf git:(master) ✗ rover  -lz /tf/caf/landingzones/caf_solution/ \
-tfstate_subscription_id xxx \
-tfstate caf_identity.tfstate \
-env test \
-level level2 \
-a import 'module.solution.module.azuread_groups["imported_group"].azuread_group.group' 'group_id_in_azure'

but it gives me this error :

Terraform import return code: 1
Terraform returned errors:
╷
│ Error: Invalid provider configuration
│
│   on /tf/caf/landingzones/caf_solution/main.tf line 87:
│   87: provider "azurerm" {
│
│ The configuration for
│ provider["registry.terraform.io/hashicorp/azurerm"].vhub depends on values
│ that cannot be determined until apply.
╵

╷
│ Error: Invalid count argument
│
│   on /home/vscode/.terraform.cache/prodinfra/rover_jobs/20231018080421583089290/modules/solution/locals.tf line 2, in resource "random_string" "prefix":
│    2:   count   = try(var.global_settings.prefix, null) == null ? 1 : 0
│
│ The "count" value depends on resource attributes that cannot be determined
│ until apply, so Terraform cannot predict how many instances will be
│ created. To work around this, use the -target argument to first apply only
│ the resources that the count depends on.

Should I use custom terraform like this :
import.tf

import {
  id = “i-abcd1234”
  to = module.solution.module.azuread_groups["imported_group"].azuread_group.group
}

maybe could you provide a guidance to import resources with rover + Azure Terraform SRE ?

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions