rootlyhq / terraformer

CLI tool to generate terraform files from Rootly
https://rootly.com
Apache License 2.0
0 stars 0 forks source link

`provider.tf` is incorrectly generated causing failure to initialize terraform. #4

Open aidanmelen opened 5 months ago

aidanmelen commented 5 months ago

Terraform Version

1.5.7

Expected Behavior

terraformer rootly generates proper provider.tf files. For example:

terraform {
  required_version = ">= 0.13.1"

  required_providers {
    rootly = {
      source = "rootlyhq/rootly"
      version = "1.2.17"
    }
  }
}

provider "rootly" {
  # Configuration options
}

Actual Behavior

You will encounter this error when you initialize the any workspace generated by terraformer

$ terraform init

Initializing the backend...
╷
│ Error: Invalid legacy provider address
│
│ This configuration or its associated state refers to the unqualified provider "rootly".
│
│ You must complete the Terraform 0.13 upgrade process before upgrading to later versions.
╵

This is the file that is generated:

terraform {
    required_providers {
        rootly = {
        version = "~> 1.2.17"
        }
  }
}

Steps to Reproduce

Please list the steps required to reproduce the issue, for example: Run Rootly terraformer and look at the resulting providers.tf generated.

Important Factoids

The work around is to first generate the terraform with terraformer, then manually update the providers.tf and then update the state with:

$ terraform state replace-provider -auto-approve "registry.terraform.io/-/rootly" "rootlyhq/rootly"
Terraform will perform the following actions:

  ~ Updating provider:
    - registry.terraform.io/-/rootly
    + registry.terraform.io/rootlyhq/rootly

Changing 432 resources:
...