Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform v0.11.x causes unexpected prompts and deletion errors #77

Closed
dghubble opened this issue Dec 13, 2017 · 0 comments
Closed

Terraform v0.11.x causes unexpected prompts and deletion errors #77

dghubble opened this issue Dec 13, 2017 · 0 comments

Comments

@dghubble
Copy link
Member

dghubble commented Dec 13, 2017

Bug

Environment

  • Platform: aws, bare-metal, google-cloud, digital-ocean
  • OS: container-linux
  • Terraform: v0.11.x

Problem

Terraform v0.11.x changes the provider and module relationships significantly. This causes issues with Teraform provider version constraints which allowed modules to specify minimum versions of providers that are required. Typhoon uses these constraints to ensure end-users have appropriate plugin versions.

You can find the full saga in hashicorp/terraform#16824.

Short term

Stick with Terraform v0.10.x.

Mid term

I'm working on docs to show how v0.11.x can be used. Basically,

Explicitly add every provider in providers.tf and give it an alias, such as "default".

provider "local" {
  version = "~> 1.0"
  alias = "default"
}

provider "null" {
  version = "~> 1.0"
  alias = "default"
}

provider "template" {
  version = "~> 1.0"
  alias = "default"
}

provider "tls" {
  version = "~> 1.0"
  alias = "default"
}

Edit each instance of a module in your infrastructure to explicitly pass the providers.

module "aws-cluster" {
  source = "git::https://github.com/poseidon/typhoon//aws/container-linux/kubernetes?ref=5ea7ce0af559857591f20fe19b03aab177fd7032"
  
  providers = {
    aws = "aws.default"
    local = "local.default"
    null = "null.default"
    template = "template.default"
    tls = "tls.default"
  }

  cluster_name = "blah"
   ...

Re-run terraform plan and terraform apply on your infrastructure. Plan should claim there are 0 changes, but run apply anyway.

Now you should be able to use Terraform again normally.

  • If you run plan, you won't see random prompts for provider fields you're setting
  • If you comment or delete a module instance and terraform apply, the cluster is correctly deleted

Yes this is silly.

Long term

Upstream is aware of the impact on modules that use provider versions. They're hoping to address with hashicorp/terraform#16835 in a future v0.11.x release. We may wait on this instead of asking dear users to hop through the hoops above. Feel free to weigh in on how you'd like to see this proceed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant