scottwinkler/terraform-provider-shell

Failed to install provider, if it's used in a sub-module

Closed this issue · 2 comments

Hello,

I'm using terraform 0.13.5 and unable to use it inside submodule. If I place this code at the root level (i.e. /main.tf then it works


data "shell_script" "administrator_role" {
    lifecycle_commands {
        read = <<-EOF
            marina --account-alias=xxx  iam-find-roles --pattern yyy
        EOF
    }

    # depends_on = [ aws_ssoadmin_account_assignment.administrators_group ]
}

If I put it anywhere in a submodule, for example inside module.team.module.sso, then I get this:

✗  terraform init
Initializing modules...

Initializing the backend...

Initializing provider plugins...
- Using previously-installed cyrilgdn/postgresql v1.11.2
- Using previously-installed hashicorp/tls v3.0.0
- Using previously-installed hashicorp/aws v3.28.0
- Using previously-installed hashicorp/local v2.0.0
- Using previously-installed scottwinkler/shell v1.7.7
- Using previously-installed hashicorp/null v3.0.0
- Using previously-installed hashicorp/random v2.3.1
- Using previously-installed hashicorp/kubernetes v1.13.3
- Using previously-installed hashicorp/github v4.3.1
- Finding latest version of hashicorp/shell...

Error: Failed to install provider

Error while installing hashicorp/shell: provider registry
registry.terraform.io does not have a provider named
registry.terraform.io/hashicorp/shell


✗  terraform providers

Providers required by configuration:
.
├── provider[registry.terraform.io/hashicorp/github]
├── provider[registry.terraform.io/scottwinkler/shell] 1.7.7
├── provider[registry.terraform.io/hashicorp/aws] ~> 3.28.0
├── provider[registry.terraform.io/hashicorp/null] ~> 3.0.0
├── provider[registry.terraform.io/hashicorp/kubernetes] ~> 1.13
├── provider[registry.terraform.io/hashicorp/random] ~> 2.1
├── provider[registry.terraform.io/cyrilgdn/postgresql] 1.11.2
├── module.team
│   ├── provider[registry.terraform.io/hashicorp/github]
│   ├── provider[registry.terraform.io/hashicorp/random]
│   ├── provider[registry.terraform.io/hashicorp/aws]
│   ├── module.github_repository_tools
│   ├── module.sso
│       ├── provider[registry.terraform.io/hashicorp/aws]
│       └── provider[registry.terraform.io/hashicorp/shell]  < REFERENCED as "hashicorp/shell" instead of "scottwinkler/shell"
│   ├── module.github_repository_boilerplate_django
│   └── module.github_repository_boilerplate_laravel
└── module.config

Providers required by state:

    provider[registry.terraform.io/hashicorp/aws]

    provider[registry.terraform.io/hashicorp/github]

    provider[registry.terraform.io/hashicorp/local]

    provider[registry.terraform.io/hashicorp/null]

    provider[registry.terraform.io/hashicorp/random]

    provider[registry.terraform.io/hashicorp/tls]


#############################################################
# TERRAFORM
#############################################################
terraform {
  required_version = ">= 0.13.5"

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 3.28.0"
    }
    null       = "~> 3.0.0"
    kubernetes = "~> 1.13"
    random     = "~> 2.1"

    postgresql = {
      source  = "cyrilgdn/postgresql"
      version = "1.11.2"
    }

    shell = {
      source = "scottwinkler/shell"
      version = "1.7.7"
    }
  }
}

#############################################################
# Shell Provider
#############################################################

provider "shell" {}


You need a versions.tf with required providers in Terraform configuration block in submodules

ok got it. worked!