Code Monkey home page Code Monkey logo

Comments (5)

RobertMirantis avatar RobertMirantis commented on June 11, 2024

main.tf provider.tf versions.tf
[ec2-user@ip-172-31-24-202 TF]$ cat provider.tf
provider "aws" {
profile = "default"
region = "eu-central-1"
}

provider "k0s" {
}

[ec2-user@ip-172-31-24-202 TF]$ terraform init

Initializing the backend...

Initializing provider plugins...

  • Finding latest version of hashicorp/aws...
  • Finding latest version of hashicorp/k0s...
  • Installing hashicorp/aws v5.0.1...
  • Installed hashicorp/aws v5.0.1 (signed by HashiCorp)

    │ Error: Failed to query available provider packages

    │ Could not retrieve the list of available versions for provider hashicorp/k0s: provider registry
    │ registry.terraform.io does not have a provider named registry.terraform.io/hashicorp/k0s

    │ All modules should specify their required_providers so that external consumers will get the correct providers when
    │ using a module. To see which modules are currently depending on hashicorp/k0s, run the following command:
    │ terraform providers

from terraform-provider-k0s.

alessiodionisi avatar alessiodionisi commented on June 11, 2024

It seems that you have not correctly specified the provider in the required_providers block.

You should do like this:

terraform {
  required_providers {
    k0s = {
      source = "alessiodionisi/k0s"
      version = "0.1.0"
    }
  }
}

from terraform-provider-k0s.

RobertMirantis avatar RobertMirantis commented on June 11, 2024

Hi Alessio,

Thanks that helped me, but I have hit the next challenge...

k0s_cluster.MyK0sCluster: Creating...

│ Error: k0sctl Error

│ with k0s_cluster.MyK0sCluster,
│ on main.tf line 212, in resource "k0s_cluster" "MyK0sCluster":
│ 212: resource "k0s_cluster" "MyK0sCluster" {

│ Unable to create cluster, got error: failed on 3 hosts:
│ - [SSH] 3.70.187.131: not connected: client connect: can't connect: create config: can't connect: no usable authentication method found
│ - [SSH] 3.71.5.113: not connected: client connect: can't connect: create config: can't connect: no usable authentication method found
│ - [SSH] 3.75.208.22: not connected: client connect: can't connect: create config: can't connect: no usable authentication method found

[ec2-user@ip-172-31-26-150 K0s_provider]$ ssh [email protected] -i /home/ec2-user/.ssh/roha_account2.pem
The authenticity of host '3.70.187.131 (3.70.187.131)' can't be established.
ECDSA key fingerprint is SHA256:UXOakZLxLxzUeouVBbiUBcAmzQP9/8t086sHssoC55w.
ECDSA key fingerprint is MD5:71:cd:eb:2e:c7:ac:e1:b5:b6:36:17:11:e6:c7:66:0e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '3.70.187.131' (ECDSA) to the list of known hosts.
Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 5.4.0-1038-aws x86_64)

Connection is not a problem. But it needs a fingerprint (that should be a problem hopefully...?).

resource "k0s_cluster" "MyK0sCluster" {
name = "RoHaCluster"
version = "1.23.8+k0s.0"

hosts = [
{
role = "controller+worker"

  ssh = {
    address  = aws_instance.server1.public_ip
    port     = 22
    user     = "ubuntu"
    key_path = "/home/ec2-user/.ssh/roha_account2.pem"
  }
},
{
  role = "worker"

  ssh = {
    address  = aws_instance.server2.public_ip
    port     = 22
    user     = "ubuntu"
    key_path = "/home/ec2-user/.ssh/roha_account2.pem"
  }
},
{
  role = "worker"

  ssh = {
    address  = aws_instance.server3.public_ip
    port     = 22
    user     = "ubuntu"
    key_path = "/home/ec2-user/.ssh/roha_account2.pem"
  }
} ]

depends_on = [time_sleep.wait_30_seconds]
}

As you can tell, I have already introduced a 60 (says 30) second time to build the EC2 instance and be ready for connections.

Any ideas, where I messed up?

from terraform-provider-k0s.

akosiaris avatar akosiaris commented on June 11, 2024

Hi,

Looking at https://github.com/alessiodionisi/terraform-provider-k0s/blob/main/internal/provider/cluster_resource.go#L358

It appears that key_path isn't honored. In your paste above you supply one though. So it defaults to whatever is the default key for your installation.

#51 should fix this one (although I met more down the road)

from terraform-provider-k0s.

alessiodionisi avatar alessiodionisi commented on June 11, 2024

Waiting feedbacks from @RobertMirantis

from terraform-provider-k0s.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.