Giter Club home page Giter Club logo

terraform-provider-vultr-community's People

Contributors

afady avatar ddymko avatar jangalek avatar qheaden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

terraform-provider-vultr-community's Issues

vultr_firewall_rule expects protocol number

Using terrform-provider-vultr built from latest main branch and Terraform 0.12

$ terraform --version
Terraform v0.12.3
+ provider.vultr (unversioned)

The vultr_firewall_rule example here shows the protocol is set with a name

resource "vultr_firewall_rule" "my_firewallrule" {
    firewall_group_id = "${vultr_firewall_group.my_firewallgroup.id}"
    protocol = "TCP"
    network = "0.0.0.0/0"
    from_port = "8085"
    to_port = "8090"
}

But applying a config with a vultr_firewall_rule returns an error that the protocol should be a number. e.g

vultr_firewall_rule.ssh: Creating...

Error: Err creating firewall group : Unable to add rule: Invalid protocol (must be one of 1, 6, 17, 47, 50)

  on firewall.tf line 10, in resource "vultr_firewall_rule" "ssh":
  10: resource vultr_firewall_rule ssh {

Changing the protocol to a number (e.g. 6 for TCP) doesn't work as the apply is passing the number as a string with Terraform 0.12

Terraform will perform the following actions:

  # vultr_firewall_rule.ssh will be created
  + resource "vultr_firewall_rule" "ssh" {
      + firewall_group_id = "70d64090"
      + from_port         = 22
      + id                = (known after apply)
      + ip_type           = (known after apply)
      + network           = "0.0.0.0/0"
      + protocol          = "6"
      + to_port           = 22
    }

[BUG] - File provisioner doesn't copy my file

Describe the bug
I think file provisioner is not working correctly.
When I was on #87 , my file didn't appear on my remote host.

To Reproduce

# please apply this file to test
# common.sh originally was filled with kubectl, kubeadm and kubelet install commands.
# I failed again with common.sh replaced with echo '123'.
provider "vultr" {}
data "vultr_os" "coreos" {
  filter {
    name   = "family"
    values = ["coreos"]
  }
}
data "vultr_plan" "plan_1c2g" {
  filter {
    name   = "VPSPLANID"
    values = ["202"]
  }
}

data "vultr_plan" "plan_2c4g" {
  filter {
    name   = "VPSPLANID"
    values = ["203"]
  }
}

data "vultr_region" "tokyo" {
  filter {
    name   = "name"
    values = ["Tokyo"]
  }
}

resource "vultr_server" "master_standalone" {
	plan_id = "${data.vultr_plan.plan_2c4g.id}"
	region_id = "${data.vultr_region.tokyo.id}"
	os_id = "${data.vultr_os.coreos.id}"
	hostname = "master-01"
	provisioner "file" {
    source      = "common.sh"
    destination = "/tmp/common.sh"
  }
  provisioner "remote-exec" {
    inline = [
      "chmod +x /tmp/common.sh"
    ]
  }
}

Expected behavior

  1. timeout from client side
  2. no such file '/tmp/common.sh'

Screenshots
If applicable, add screenshots to help explain your problem.
image

Desktop (please complete the following information where applicable:

  • OS: CentOS 7 GNOME desktop, 3.10.0-957.21.3.el7.x86_64
  • Language Version : Go 1.12.7

Additional context

Add any other context about the problem here.

remote-exec ssh host not populated

When adding a remote-exec to a config it's acutally executed on the localhost as the host field is not populated:

resource "vultr_server" "this" {
  label       = var.server_name
  plan_id     = "${data.vultr_plan.starter.id}"
  os_id       = "${data.vultr_os.ubuntu-1904.id}"
  region_id   = "${data.vultr_region.sydney.id}"
  ssh_key_ids = var.ssh_key_ids
  provisioner "remote-exec" {
    inline     = [
      "apt update",
      "apt -y dist-upgrade",
    ]
  }
}

Some output:

module.vultr_server_testypants2.vultr_server.this: Still creating... [1m30s elapsed]
module.vultr_server_testypants1.vultr_server.this: Still creating... [1m30s elapsed]
module.vultr_server_testypants2.vultr_server.this: Provisioning with 'remote-exec'...
module.vultr_server_testypants2.vultr_server.this (remote-exec): Connecting to remote host via SSH...
module.vultr_server_testypants2.vultr_server.this (remote-exec):   Host:
module.vultr_server_testypants2.vultr_server.this (remote-exec):   User: root
module.vultr_server_testypants2.vultr_server.this (remote-exec):   Password: false
module.vultr_server_testypants2.vultr_server.this (remote-exec):   Private key: false
module.vultr_server_testypants2.vultr_server.this (remote-exec):   Certificate: false
module.vultr_server_testypants2.vultr_server.this (remote-exec):   SSH Agent: true
module.vultr_server_testypants2.vultr_server.this (remote-exec):   Checking Host Key: false
module.vultr_server_testypants2.vultr_server.this (remote-exec): Connected!
module.vultr_server_testypants2.vultr_server.this (remote-exec): 
module.vultr_server_testypants2.vultr_server.this (remote-exec): 0% [Working]

The reason it shows connected there is because I can SSH to my localhost.

[BUG] - Not handling API rate limit gracefully

Describe the bug
It seems I've been playing with this provider enough to get rate-limited, and so now I can't plan/refresh at all because it hits the API faster than the hard rate-limit allows.

Error: Error getting : Rate limit reached - please try your request again later. Current rate limit: 3 requests/sec

To Reproduce
Steps to reproduce the behavior:

  1. Create >N Vultr resources
  2. terraform apply
  3. Get rate-limited to N requests/sec
  4. terraform refresh

Expected behavior
Detects the limit and backs off maybe?

Additional context

I haven't been using it that much!

[Feature] - How about list all regions

Thanks for your all great work so that I can use terraform on Vultr!

General behavior for most providers, "data" can list all the data. e.g. data "xxx_region" "regions" {} will return all available regions.

But in Vultr provider, we have to add filter to it. Which means I can not setup up a generic step in the flow to show all available regions for current provider.

thinking there are 5 providers, first step - select provider, 2nd step-select region, 3rd set - select zone (or no zone), 4th - flavor and so on...

Same to other objects/resources.

[Feature] Set Connection config in Server and Baremetal

Is your feature request related to a problem? Please describe.
Relating to #98

Describe the solution you'd like
Have terraform set your default connection information for server + baremetal. This will omit users having to define the their connection blocks like so:

   connection {
        type     = "ssh"
        host     = "ip"
        user     = "root"
        password = "password"
   }

[BUG] - Impossible to `apply` after creating server from snapshot

Describe the bug
If a server is created from snapshot, subsequent refreshes read the os_id as the underlying OS in the snapshot, not the special meaning 164 (see #95 for more info), which means that a change is always detected:

      ~ os_id             = 244 -> 164
[...]
      snapshot_id       = "<checksum>"

where 244 is the underlying OS (Debian in this case) in the snapshot.

It's not good terraform practice to have spurious 'changes' like this, but it's worse in this case, since it actually prevents us from applying:

Error: Error occured while updating os_id for server <N> : Invalid operating system.

i.e. we cannot update in-place (and we certainly don't want to re-create every time!) to the special os_id = 164.

To Reproduce
Steps to reproduce the behavior:

  1. Create a vultr_server resource with os_id = 164 and valid snapshot_id
  2. terraform apply, wait for success
  3. terraform plan, note the planned 'change'
  4. terraform apply, note the failure

Expected behavior
terraform plan in reproduction step 3 should show no change.

[Feature] - timeout control for resource creation and destroying

Is your feature request related to a problem? Please describe.
I was installing Kubernetes using this, and met timeout. So I wanted to extend timeout but it doesn't work.

# first attempt - timeout
terraform apply
# ...
# vultr_server.master_standalone: Still creating... [5m40s elapsed]
# vultr_server.master_standalone: Still creating... [5m50s elapsed]
# vultr_server.master_standalone: Still creating... [6m0s elapsed]
# Error: timeout - last error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

# second attempt - timeout not supporting
terraform plan
# ...
# Error: Unsupported block type
#  on a.tf line 44, in resource "vultr_server" "master_standalone":
#  44:   timeouts {
# Blocks of type "timeouts" are not expected here.
# my template

resource "vultr_server" "master_standalone" {
	plan_id = "${data.vultr_plan.plan_2c4g.id}"
	region_id = "${data.vultr_region.tokyo.id}"
	os_id = "${data.vultr_os.coreos.id}"
	hostname = "master-01"
	provisioner "file" {
    source      = "common.sh"
    destination = "/tmp/common.sh"
  }
  provisioner "remote-exec" {
    inline = [
      "chmod +x /tmp/common.sh",
      "/tmp/common.sh",
    ]
  }
  timeouts {
    create = "10m"
  }
}

Describe the solution you'd like
timeout support
https://www.terraform.io/docs/configuration/resources.html#timeouts

Describe alternatives you've considered
I just got rid of "/tmp/common.sh" from my template.

Additional context
Thank you for official repository providing!

[BUG] - Create server that is using PXE startup_script

Describe the bug
I want to create a server and use the iPXE Custom Script option, as available in the UI (via Upload ISO -> iPXE Custom Script) which contains a iPXE script.

To Reproduce
Steps to reproduce the behavior:

  1. Create a server
resource "vultr_server" "ipxe" {
  region_id            = "1"
  plan_id              = "202"
  script_id            = "${vultr_startup_script.pxe.id}"
}

resource "vultr_startup_script" "pxe" {
  name   = "pxe"
  type   = "pxe"
  script = "pxe script"
}
  1. Run terraform apply

Expected behavior
Create the server using the iPXE custom script just as in the UI.

Desktop (please complete the following information where applicable:

  • Version : v1.0.0

Additional context

If you leaved out any of the required reference IDs, you get the error:

Error: Please select at least one of the following os_id, app_id, iso_id or snapshot_id                                                                        

If you set the os_id to the Custom one (159), you end up with:

Error: Please set a corrosponding attribute                                    

If I comment out this error (https://github.com/vultr/terraform-provider-vultr/blob/master/vultr/resource_vultr_server.go#L274), it seems to work fine (I get the result I want)

Terraform Provider Development Program - Review

Hey Team, 👋 My name is Chris, I'm a member of the Partner team @ HashiCorp.

I’ve taken a look at the provider here and would like to say great work so far! I do have feedback outlined below that I’d like to see addressed before we move on to the next steps. I’m opening this issues as a sort of checklist for tracking items and discussion. The review was done on the develop branch at git commit 01aecfc

=== RUN   TestAccVultrBackup
--- FAIL: TestAccVultrBackup (1.17s)
    testing.go:568: Step 0 error: errors during refresh:

        Error: your search returned too many results : 2. Please refine your search to be more specific

          on /var/folders/bf/6n0whcjn2x17rp19q0yc2vfc0000gn/T/tf-test568318980/main.tf line 2:
          (source code not available)

[BUG] - `os_id` is required; `snapshot_id` is ignored

Describe the bug
If you specify a snapshot_id only, you get an error on a vultr_server resource that os_id is required.

If you then add os_id = data.vultr_snapshot.mysnapshot.os_id, the apply succeeds but the resulting server was not created from the snapshot, it's just the same OS as the snapshot's os_id, as if the snapshot_id wasn't specified at all.

To Reproduce

resource "vultr_server" "test" {
  region_id         = "${data.vultr_region.test.id}"
  plan_id           = "${data.vultr_plan.test.id}"
  os_id             = "${data.vultr_snapshot.test.os_id}"  # error if not specified
  snapshot_id       = "${data.vultr_snapshot.test.id}"
  # ...
}

Expected behavior
os_id not required if snapshot_id is specified.

or at least, if it is required, snapshot_id is still used.

Desktop (please complete the following information where applicable:

Terraform v0.12.5
[...]
+ provider.vultr (unversioned)

Additional context

Add any other context about the problem here.

[BUG] - os_id collides with usage of script_id

Describe the bug
It seems like one can't use script_id with os_id.

Aka setting the OS to say Ubuntu and at the same time requiring a startup script.

To Reproduce
Steps to reproduce the behavior:
Launch server with a os_id and script_id set.

Expected behavior
Use script with specific os chosen.

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.