poseidon / typhoon

Minimal and free Kubernetes distribution with Terraform
https://typhoon.psdn.io/
MIT License
1.93k stars 319 forks source link

digitalocean: container linux: terraform init failing due to terraform-provider-ct #297

Closed tasdikrahman closed 5 years ago

tasdikrahman commented 5 years ago

Bug

Environment

+ provider.aws v1.36.0
+ provider.ct (unversioned)
+ provider.digitalocean v0.1.3
+ provider.local v1.1.0
+ provider.null v1.0.0
+ provider.template v1.0.0
+ provider.tls v1.2.0

Problem

when trying to do a terraform plan, after the init is done

$ terraform plan                                                                 

Error: Error asking for user input: 1 error(s) occurred:

* provider.ct: fork/exec /Users/tasdikrahman/bin/terraform-provider-ct: exec format error

The terraform config used is from here https://typhoon.psdn.io/cl/digital-ocean/

where I followed

wget https://github.com/coreos/terraform-provider-ct/releases/download/v0.2.1/terraform-provider-ct-v0.2.1-linux-amd64.tar.gz
tar xzf terraform-provider-ct-v0.2.1-linux-amd64.tar.gz
sudo mv terraform-provider-ct-v0.2.1-linux-amd64/terraform-provider-ct ~/bin
module "digitalocean-homelab" {
  source = "git::https://github.com/poseidon/typhoon//digital-ocean/container-linux/kubernetes?ref=v1.11.3"

  providers = {
    digitalocean = "digitalocean.default"
    local        = "local.default"
    null         = "null.default"
    template     = "template.default"
    tls          = "tls.default"
  }

  # Digital Ocean
  cluster_name = "homelab"
  region       = "blr1"
  dns_zone     = "k8s.tasdikrahmanhomelab.com"

  # configuration
  ssh_fingerprints = ["4d:6b:79:41:e0:19:92:c4:a4:df:51:36:27:c5:0f:ed"]
  asset_dir        = "/home/tasdikrahman/.secrets/clusters/digitalocean/homelab"

  # optional
  worker_count = 1
  worker_type  = "s-1vcpu-1gb"
}

provider "digitalocean" {
  version = "0.1.3"
  token   = "${chomp(file("~/.config/digital-ocean/token"))}"
  alias   = "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"
}

provider "aws" {
  version = "1.36.0"
  profile = "tasdik"
  region  = "ap-south-1"
}

My .terraformrc has

$ cat ~/.terraformrc                                                                                                                                                                
plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"

providers {
  ct = "/Users/tasdikrahman/bin/terraform-provider-ct"
}

$ ls -la ~/bin | grep terraform-provider-ct                                                                                                                                        
-rwxr-xr-x   1 tasdikrahman  staff  15735414 Feb 23  2018 terraform-provider-ct

Desired Behavior

the terraform plan should show up

Steps to Reproduce

for the above terraform config posted, the terraform plan should show up.

tasdikrahman commented 5 years ago

If I try moving the block

providers {
  ct = "/Users/tasdikrahman/bin/terraform-provider-ct"
}

along with the same state as the config, the error message changes to

Error: Unknown root level key: providers
dghubble commented 5 years ago

You're probably on macOS, downloading a Linux binary plugin. Refer to terraform-provider-ct.

On Tue, Sep 18, 2018, 8:21 AM Tasdik Rahman notifications@github.com wrote:

If I try moving the block

providers { ct = "/Users/tasdikrahman/bin/terraform-provider-ct" }

along with the same state as the config, the error message changes to

Error: Unknown root level key: providers

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/poseidon/typhoon/issues/297#issuecomment-422436445, or mute the thread https://github.com/notifications/unsubscribe-auth/ACJidLfNfkWNF-WOPguViZGvTjYv53AEks5ucQ9igaJpZM4WuKVi .

tasdikrahman commented 5 years ago

yes, that seemed to have been it. Thanks for the help.

sampcoug commented 5 years ago

I am getting this error when trying to run terraform init in a mac. Any ideas folks?

`initializing the backend...

Successfully configured the backend "s3"! Terraform will automatically use this backend unless the backend configuration changes.

Initializing provider plugins...

Provider "ct" not available for installation.

A provider named "ct" could not be found in the official repository.

This may result from mistyping the provider name, or the given provider may be a third-party provider that cannot be installed automatically.`