Code Monkey home page Code Monkey logo

terraform-provider-spotinst's People

Contributors

alexindeed avatar alextarasov-spot avatar anuragsharma-123 avatar appilon avatar chandra1-n avatar dependabot[bot] avatar grubernaut avatar guyalt3 avatar guyklainer avatar igude2 avatar kmcgrath avatar liranp avatar lironrad avatar nadavnaor avatar omerspot avatar pripatra avatar radeksimko avatar salihaguli avatar sharadkesarwani avatar snir102002 avatar sobhanagit avatar stack72 avatar steved avatar stevenfeltner avatar talgevaspot avatar talzur avatar tamirkash avatar tamiryaarispot avatar thorsteinnth avatar zachinachshon 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

terraform-provider-spotinst's Issues

User_data with gzip & base64 encoding issue

Hi guys, I've faced issue when I'm trying to use template_cloudinit_config resource with gzip or base64 enabled. Spotinst is always trying to update userdata of elastic_group which is not what I expect.

Apparently after I apply gziped/base64 userdata first time second time when I update state spotinst is responding with ungziped/unbase64 data (which makes sense for users, but not for terraform). So terraform sees userdata doesn't match and tries to update it again.

Let me know if you need some additional info.

Terraform Version

0.11.10

Affected Resource(s)

spotinst_elastigroup_aws

Terraform Configuration Files

data "template_cloudinit_config" "infra-config" {
  gzip          = true
  base64_encode = true

  part {
    content_type = "text/cloud-config"
    content      = "teststring"
  }
}
resource "spotinst_elastigroup_aws" "infra" {
  name        = "Infra group"
  description = "created by Terraform"
  product     = "Linux/UNIX"
  user_data = "${data.template_cloudinit_config.infra-config.rendered}"
...
}

Expected Behavior

I expect that when I do not update cloud-init template provider doesn't try to update userdata

Actual Behavior

Provider updates userdata every time I use gzip = true or base64_encode = true.

Add `autoHeadroomPercentage` parameter in `resource: spotinst_ocean_ecs`'s headroom block

Terraform Version

Description

headroom block currently support setting up is_auto_config but doesn't allow configuring the headroom percentage.
The parameter autoHeadroomPercentage let you define that percentage but it is not yet supported by the provider.

Kindly provide this feature to set it configurable.

Use Cases

Potential Terraform Configuration

References

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to help the community and maintainers prioritize this request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Terraform init fails with when downloading plugin

Hello!

In my organization, we have been successfully using spotinst with terraform 0.11. Recently we started 0.12 upgrade and I just stumbled upon a problem with spotinst provider and terraform 0.12 - terraform can not find provider version compatible with 0.12

Terraform Version

$ terraform -version
Terraform v0.12.5

Affected Resource(s)

The only resource we're using is:

  • spotinst_elastigroup_aws

Terraform Configuration Files

https://gist.github.com/paranoidd/0ae2e4a1cf672bc0e5c708b85c00968c

Debug Output

Partially censored: https://gist.github.com/paranoidd/6be91e7191faf59e1870b0342d3e671c

Expected Behavior

Terraform should download spotinst provider and allow me to plan with 0.12

Actual Behavior

Terraform fails to download provider:
Error: no available version is compatible with this version of Terraform

Steps to Reproduce

  1. terraform init

Important Factoids

Fails on macos installed via brew
Fails on linux with official terraform binary
No provider version restrictions/selectors in place

References

According to the issue: hashicorp/terraform#21235 your provider is compatible with 0.12, yet no luck for me :(

elasticgroup set capacity blank in console when set to 0 in terraform

Terraform Version

Terraform v0.10.7 (bug present in 0.9.X versions also)

Affected Resource(s)

  • spotinst_aws_group

Terraform Configuration Files

No custom config

Debug Output

Plan: https://gist.github.com/k3ypad/3661f9522724bffbb0acc3a42a9996f0
Apply: https://gist.github.com/k3ypad/f016f5f4df01f32ba94caf63ccb90db6

Panic Output

No panic.

Expected Behaviour

When this is specified:

  # Scale down on weeknights
  scheduled_task {
    task_type             = "scale"
    cron_expression       = "00 20 * * 1-5"
    scale_target_capacity = 0
    scale_min_capacity    = 0
    scale_max_capacity    = 0
  }

The elastigroup should have no instances at the specified time.

Actual Behavior

In the spotinst console the values for this scheduled action are blank. This also causes a input validation error in the console when you go to edit, despite Terraform planning and applying fine.

Steps to Reproduce

  1. Create an elastigroup with the above scheduled_task
  2. terraform plan
  3. terraform apply
  4. Go to the created elastigroup in the Spotinst web console
  5. Go to edit the configuration of the elastigroup in the Spotinst web console
  6. At the bottom of the general tab, expand "scheduling"
  7. This scheduled will have no values for target, minimum, and maximum - it will also display a "Fill at least one field" message.

Important Factoids

References

Stateful deallocation is not working

We using terraform to create spotinst groups, while destroying, spotinst doesn't remove spotinst AMIs, volumes, network interfaces and snapshots.

Custom attributes for Elastigroup ECS integration are always planned as change

Hello!

When defining custom_attributes for ECS integration, every subsequent terraform plan still shows that said attributes have to be added, while they do exist in elastigroup configuration already.

Terraform Version

Terraform v0.12.26

  • provider.aws v2.64.0
  • provider.datadog v2.7.0
  • provider.spotinst v1.16.0
  • provider.template v2.1.2

Affected Resource(s)

  • spotinst_elastigroup_aws

Terraform Configuration Files

https://gist.github.com/paranoidd/8f45de6b777f235251ddb9c747f0ceb0

Debug Output

https://gist.github.com/paranoidd/e86a84b64cd3b8bfc1ece1610336f14e

Expected Behavior

Terraform plan not displaying changes in custom attributes for ECS integration when there aren't any

Actual Behavior

Despite successful creation of custom attributes for ECS integration, any subsequent plans still show changes

Steps to Reproduce

  1. terraform plan
  2. terraform apply
  3. terraform plan

spotinst_aws_group resource fails when I try to generate dynamically `dimensions` for scaling policy

This issue was originally opened by @spa-87 as hashicorp/terraform#15014. It was migrated here as part of the provider split. The original body of the issue is below.


Terraform Version

0.9.5

Affected Resource(s)

  • spotinst_aws_group

Terraform Configuration Files

variable "env" {}
variable "chef_bootstrap_sns_arn" {}

variable "spotinst_email"                 {}
variable "spotinst_token"                 {}
variable "spotinst_elastigroup_name"      {}

variable "spotinst_capacity_min"          {}
variable "spotinst_capacity_max"          {}
variable "spotinst_capacity_target"       {}
variable "spotinst_ondemand_count"        {}

variable "spotinst_availability_vs_costs" { default = "balanced" }
variable "spotinst_draining_timeout"      { default = "60" }
variable "spotinst_grace_period"          { default = "60" }

variable "aws_elbs"            { default = [], type = "list" }
variable "aws_iam_role"        {}
variable "aws_instance_type"   {}
variable "aws_region_id"       {}
variable "aws_region_name"     {}
variable "aws_security_groups" { type = "list" }
variable "aws_spot_product"    {}
variable "aws_ssh_key"         {}
variable "aws_availability_zones" { type = "list" }

variable queues { type="list", default = ["test", "test2", "test3"] }


data "template_file" "dimensions_keys" {
  count = "${length(var.queues)}"
  template = "QueueName${count.index}"
}

provider "spotinst" {
    email = "${var.spotinst_email}"
    token = "${var.spotinst_token}"
}

resource "spotinst_aws_group" "spotinst_elastigroup" {
  name        = "${var.spotinst_elastigroup_name}"
  description = "${var.spotinst_elastigroup_name}"

  availability_zones = [ "${var.aws_availability_zones}" ]
  product            = "${var.aws_spot_product}"

  capacity {
    minimum = "${var.spotinst_capacity_min}"
    maximum = "${var.spotinst_capacity_max}"
    target  = "${var.spotinst_capacity_target}"
  }

  ebs_block_device {
    delete_on_termination = true
    device_name           = "/dev/sda1"
    volume_type           = "gp2"
    volume_size           = 15
  }

  instance_types {
    ondemand = "${var.aws_instance_type}"
    spot     = "${var.od2spot["${var.aws_instance_type}"]}"
  }

  launch_specification {
    health_check_type         = "EC2"
    health_check_grace_period = "${var.spotinst_grace_period}"
    iam_instance_profile      = "${var.aws_iam_role}"
    image_id                  = "${var.region2ami["${var.aws_region_id}"]}"
    key_pair                  = "${var.aws_ssh_key}"
    load_balancer_names       = [ "${var.aws_elbs}" ]
    monitoring                = false
    security_group_ids        = [ "${var.aws_security_groups}" ]
  }

  strategy {
    availability_vs_cost = "${var.spotinst_availability_vs_costs}"
    draining_timeout     = "${var.spotinst_draining_timeout}"
    ondemand_count       = "${var.spotinst_ondemand_count}"
  }

  tags {
    Name = "${var.spotinst_elastigroup_name}-default"
  }

  scaling_up_policy {
    policy_name = "test"
    metric_name = "ApproximateNumberOfMessagesVisible",
    statistic = "average"
    unit = "count"
    threshold = 10
    adjustment = 2
    namespace = "AWS/SQS"
    operator = "gte"
    evaluation_periods = 2
    period = 300
    cooldown = 300
    dimensions = "${zipmap(data.template_file.dimensions_keys.*.rendered, var.queues)}"
  }
}

resource "spotinst_subscription" "chef_bootstrap" {
  resource_id = "${spotinst_aws_group.spotinst_elastigroup.id}"
  event_type  = "AWS_EC2_INSTANCE_LAUNCH"
  protocol    = "aws-sns"
  endpoint    = "${var.chef_bootstrap_sns_arn}"
  format {
    event        = "%event%"
    instanceId   = "%instance-id%"
    resourceId   = "%resource-id%"
    resourceName = "%resource-name%"
  }
}

Panic Output

https://gist.github.com/spa-87/5fdfe168268137eead14089ea1917778

Expected Behavior

Spotinst elastigroup should be created normally with one scaling policy based on provided set of dimensions (specified at queues list).

Actual Behavior

  • Spotinst elastigroup is created but it has 3 scaling policy with the same set of dimensions. Dimensions contain all provided queues.
  • terraform apply fails with the error mentioned at Panic Output section.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. Fill variables without default value with your parameters
  2. run terraform apply

Credentials file not working

Terraform Version

Terraform v0.12.13

  • provider.spotinst v1.13.4

Affected Resource(s)

All resources related to the spotinst provider.

Debug Output

Refer to this gist.

Expected Behavior

Spotinst provider should work using a ~/.spotinst/credentials file such as:

default:
  token: "<token>"
  account: "<account>"

Actual Behavior

I'm unable to deploy any spotinst related resources using a plain credentials file. Hardcoding my credentials works just fine:

provider "spotinst" {
  token   = "<token>"
  account = "<key>"
}

Setting environment variables (SPOTINST_TOKEN and SPOTINST_ACCOUNT) also makes the spotinst provider behave correctly

Important Factoids

Currently running terraform on Windows Powershell.

spotinst_ocean_gke_launch_spec_import node_pool_name should be immutable

This resource: spotinst_ocean_gke_launch_spec_import reports during the plan phase for a non-interrupting change

  ~ resource "spotinst_ocean_gke_launch_spec_import" "dynamic_pods" {
        id             = "ols-*****"
      ~ node_pool_name = "terraform-20200625134819133100000002" -> (known after apply)
        ocean_id       = "o-*****"
    }

but during the apply phase, it throws an immutable error. This means that the terraform provider is not correctly indicating that a delete and re-create is required.

multai_listener HTTPS creation failed

Trying to create Multai HTTPS listener as follows:

resource "spotinst_multai_listener" "ext_https_listener" {
  balancer_id = "${spotinst_multai_balancer.external_app_mlb.id}"
  protocol    = "https"
  port        = 443
}

Get error:

Error: Error applying plan:

1 error(s) occurred:
* module.ext_mlb.spotinst_multai_listener.ext_https_listener: 1 error(s) occurred:
* spotinst_multai_listener.ext_https_listener: [ERROR] failed to create listener: POST https://api.spotinst.io/loadBalancer/listener?accountId=act-6b7ccf67: 500 (request: "36a1606b-fe73-41ba-928b-91811a30c0a1") GENERAL_ERROR: Please contact your account manager.

I've got a hunch this is since there is no certificate specified.
However in multai_listener documentation cannot see option for attaching certificate.

Can you add/fix ?

Terraform Version

Terraform v0.11.13

  • provider.azurerm v1.23.0
  • provider.spotinst v1.9.0

Affected Resource(s)

  • spotinst_multai_listener

Expected Behavior

Created resource spotinst_multai_listener

Actual Behavior

spotinst_multai_listener not created

Steps to Reproduce

  • terraform apply

Feature Request: Add spotinst_organization and spotinst_account resources

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

0.12.12

Affected Resource(s)

  • spotinst_organization
  • spotinst_account

Use case:
I would like to dynamically create or import spotinst_organization resources and attach spotinst_account resources with Terraform.

Example config:

provider "aws" {
  version = "2.32.0"
  region  = "us-west-2"
  alias   = "global"
}

provider "spotinst" {
    token = var.spotinst_token
    key = var.spotinst_key
}

data "aws_organizations_organization" "my_org" {}

data "spotinst_organization" "spoinst_org" {}

locals {
  root_id = data.aws_organizations_organization.my_org.roots[0].id
  aws_ous = [
    "admin",
    "sandbox",
    "suspended",
    "service"
  ]
  aws_accounts = {
    staging      = { ou = "service", spotinst_organization = "my_org" },
    prod         = { ou = "service", spotinst_organization = "my_org" },
    dev          = { ou = "service", spotinst_organization = "my_org" },
  }
}

resource "aws_organizations_organizational_unit" "ous" {
  for_each  = toset(local.aws_ous)
  name      = title(each.value)
  parent_id = local.root_id
}

resource aws_organizations_account "accounts" {
  for_each  = local.aws_accounts
  name      = each.key
  email     = "awsroots+${each.key}@my_org.com"
  parent_id = lookup(each.value, "ou", "root") == "root" ? local.root_id : aws_organizations_organizational_unit.ous[each.value["ou"]].id
  role_name = "OrganizationAccountAccessRole"

  # There is no AWS Organizations API for reading role_name
  lifecycle {
    ignore_changes = ["role_name"]
  }
}

resource spotinst_account "spotinst_accounts" {
  for_each  = local.aws_accounts
  name      = each.key
  aws_account_id     = each.value["id"]
  spotinst_organization = lookup(each.value, "spotinst_orgnization", "my_org")
}

Problems with creating Spotinst Elastigroup from Beanstalk

Terraform Version

Terraform v0.12.18

  • provider.aws v2.44.0
  • provider.random v2.2.1
  • provider.spotinst v1.13.4

Affected Resource(s)

Please list the resources as a list, for example:

  • spotinst_elastigroup_aws_beanstalk.elastigoup-aws-beanstalk

Expected Behavior

What should have happened?
Following the documentation https://www.terraform.io/docs/providers/spotinst/r/elastigroup_aws_beanstalk.html , beanstalk_environment_name is not required (it actually is required), description is optional (it is not a valid parameter), deployment_preferences and strategy are variables but they are block variables:
Wrong: strategy = {}
Correct: strategy {}

Lack of options from spotinst console like scheduling scaling and auto scaling options.

The compatibility between terraform and spotinst console is poor, I can't change via console the Elastigroup created by Terraform.

Support for `spotPercentage` in spotinst_ocean_ecs resource

Terraform Version

Description

Please provide support for strategy.spotPercentage in ocean_ecs resource. Curently, we're using null resource to circumvent this limitation but would be great if tf provider support it at first place

Use Cases

Potential Terraform Configuration

References

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to help the community and maintainers prioritize this request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Changing elastigroup_aws.product should force a new resource

Terraform Version

Terraform v0.12.21
+ provider.aws v2.48.0
+ provider.null v2.1.2
+ provider.spotinst v1.14.2
+ provider.template v2.1.2

Affected Resource(s)

  • spotinst_elastigroup_aws.product

Terraform Configuration Files

the problem happens whenever I change the product value in spotinst_elastigroup_aws.
It complains that property is immutable, hence terraform should destroy and recreate the resource for me.

resource "spotinst_elastigroup_aws" "default-elastigroup" {
    # redacted
    product     = "Linux/UNIX"
}

to

resource "spotinst_elastigroup_aws" "default-elastigroup" {
    # redacted
    product     = "Linux/UNIX (Amazon VPC)"
}

Debug Output

Error: field [product] is immutable, cannot be changed post creation

  on ../modules_tf12/ec2_spotinst/ec2_spotinst.tf line 423, in resource "spotinst_elastigroup_aws" "default-elastigroup":
 423: resource "spotinst_elastigroup_aws" "default-elastigroup" {

Expected Behavior

Terraform should destroy and create the resource for me again

Actual Behavior

I receive an error

Steps to Reproduce

  1. create a resource with the product value being "Linux/UNIX"
  2. terraform apply
  3. change it to "Linux/UNIX (Amazon VPC)"
  4. terraform apply

Important Factoids

Yes, I know a workaround is to taint my resources, and I am doing exactly that.

That being said, I messed up because the documentation is also misleading:

https://www.terraform.io/docs/providers/spotinst/r/elastigroup_aws.html#product

product - (Required) Operation system type. Valid values: "Linux/UNIX", "SUSE Linux", "Windows". For EC2 Classic instances: "Linux/UNIX (Amazon VPC)", "SUSE Linux (Amazon VPC)", "Windows (Amazon VPC)".

I would write:

product - (Required) Operation system type. Valid values for EC2 Instances in Amazon VPC: "Linux/UNIX (Amazon VPC)", "SUSE Linux (Amazon VPC)", "Windows (Amazon VPC)". For the old EC2 Classic instances, use "Linux/UNIX", "SUSE Linux", "Windows".

And since I read somewhere that this setting affects your algorithm of getting the cheapest instances, which is your core business, this bug might be important.

Cannot create spotinst_multai_target_set using traffic port

When creating health checks for MLB routing rules, it creates the checks only with the override port.
There is no option to use traffic port like can be done through the Spotinst Console.

Example:

Annotation 2019-05-26 104612

Terraform Version

$ terraform version
Terraform v0.11.14
+ provider.spotinst v1.13.3

Affected Resource(s)

Please list the resources as a list, for example:

  • spotinst_multai_target_set

Terraform Configuration Files

resource "spotinst_multai_target_set" "my_mlb_ts" {
  count         = "${length(var.my_target_sets)}"
  name          = "my${element(var.mlb_otp_target_sets, count.index)}_mlb_ts"
  balancer_id   = "${var.my_mlb_id}"
  deployment_id = "${var.my_deployment_id}"
  protocol      = "http"
  port          = 8080
  weight        = 1

  health_check {
    protocol            = "http"
    path                = "/my-servlet/ws/serverinfo"
    **port                = 8080**
    interval            = 10
    timeout             = 5
    healthy_threshold   = 2
    unhealthy_threshold = 3
  }
}

Expected Behavior

In the health_check block, have the option to use the MLB traffic port

Actual Behavior

Only able to create an override port

Steps to Reproduce

  1. terraform apply

spotinst_elastigroup_aws resource fails when change any value

This issue was originally opened by @caiounderscore as hashicorp/terraform#20107. It was migrated here as a result of the provider split. The original body of the issue is below.


Terraform Version

Terraform v0.11.11

  • provider.spotinst v1.6.0

Affected Resource(s)

spotinst_elastigroup_aws

Terraform Configuration Files

"provider" "spotinst" {
  "token" = "$[var.token]"
  "account" = "$[var.account]"
}

resource "spotinst_elastigroup_aws" "default-elastigroup" {
  name        = "default-elastigroup"
  description = "created by Terraform"
  product     = "Linux/UNIX"

  "desired_capacity" = 2

  "min_size" = 2

  "max_size" = 4

  "capacity_unit" = "instance"

  region     = "us-east-1"
  subnet_ids = ["$[var.subnets]"]

  image_id = "${var.ami]"

  #   iam_instance_profile = "iam-profile"
  key_name          = "${var.key]"
  security_groups   = "[${var.sg]"
  user_data         = "echo hello world"
  enable_monitoring = false
  ebs_optimized     = false
  placement_tenancy = "default"

  instance_types_ondemand = "t3.small"

  instance_types_spot = ["t2.small", "t3.small"]

  instance_types_preferred_spot = ["t3.small"]

  orientation          = "balanced"
  fallback_to_ondemand = false
  cpu_credits          = "unlimited"

  wait_for_capacity         = 2
  wait_for_capacity_timeout = 900

Debug Output

spotinst_elastigroup_aws.default-elastigroup: Refreshing state... (ID: sig-983162cc)

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  ~ spotinst_elastigroup_aws.default-elastigroup
      instance_types_ondemand: "t3.micro" => "t3.small"


Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

spotinst_elastigroup_aws.default-elastigroup: Modifying... (ID: sig-983162cc)
  instance_types_ondemand: "t3.micro" => "t3.small"

Error: Error applying plan:

1 error(s) occurred:

* spotinst_elastigroup_aws.default-elastigroup: 1 error(s) occurred:

* spotinst_elastigroup_aws.default-elastigroup: unexpected EOF

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.


panic: runtime error: invalid memory address or nil pointer dereference
2019-01-24T17:17:43.282-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xbca76e]
2019-01-24T17:17:43.282-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4:
2019-01-24T17:17:43.282-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4: goroutine 106 [running]:
2019-01-24T17:17:43.282-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4: github.com/terraform-providers/terraform-provider-spotinst/spotinst.updateGroup(0xc0002d8000, 0xc0001e4230, 0xc3d840, 0xc0003ec3c0, 0x1, 0xc0002d8000)
2019-01-24T17:17:43.282-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4:      /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-spotinst/spotinst/resource_spotinst_elastigroup_aws.go:306 +0x69e
2019-01-24T17:17:43.282-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4: github.com/terraform-providers/terraform-provider-spotinst/spotinst.resourceSpotinstElastigroupAwsUpdate(0xc0001e4230, 0xc3d840, 0xc0003ec3c0, 0x24, 0x15f5860)
2019-01-24T17:17:43.282-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4:      /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-spotinst/spotinst/resource_spotinst_elastigroup_aws.go:254 +0x306
2019-01-24T17:17:43.282-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4: github.com/terraform-providers/terraform-provider-spotinst/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc0006bee40, 0xc00050e050, 0xc0000bc480, 0xc3d840, 0xc0003ec3c0, 0x40b801, 0xc000458b80, 0x4c046c)
2019-01-24T17:17:43.282-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4:      /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-spotinst/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:199 +0x257
2019-01-24T17:17:43.282-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4: github.com/terraform-providers/terraform-provider-spotinst/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc000330770, 0xc00050e000, 0xc00050e050, 0xc0000bc480, 0xc000368e00, 0x18, 0x7f6c5c8996c0)
2019-01-24T17:17:43.282-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4:      /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-spotinst/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:259 +0x9c
2019-01-24T17:17:43.283-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4: github.com/terraform-providers/terraform-provider-spotinst/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Apply(0xc0003c0160, 0xc0000bc020, 0xc000490370, 0x0, 0x0)
2019-01-24T17:17:43.283-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4:      /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-spotinst/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:488 +0x57
2019-01-24T17:17:43.283-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4: reflect.Value.call(0xc000076720, 0xc000300000, 0x13, 0xde9674, 0x4, 0xc000458f18, 0x3, 0x3, 0xc000191740, 0x4131b7, ...)
2019-01-24T17:17:43.283-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4:      /opt/goenv/versions/1.11.4/src/reflect/value.go:447 +0x454
2019-01-24T17:17:43.283-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4: reflect.Value.Call(0xc000076720, 0xc000300000, 0x13, 0xc0002d0f18, 0x3, 0x3, 0x12a05f200, 0xc0002d0f10, 0xc0002d0fb8)
2019-01-24T17:17:43.283-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4:      /opt/goenv/versions/1.11.4/src/reflect/value.go:308 +0xa4
2019-01-24T17:17:43.283-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4: net/rpc.(*service).call(0xc0003ea000, 0xc0005f21e0, 0xc00057a050, 0xc00057a060, 0xc0002d8880, 0xc00057c5a0, 0xc40980, 0xc0000bc020, 0x16, 0xc409c0, ...)
2019-01-24T17:17:43.283-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4:      /opt/goenv/versions/1.11.4/src/net/rpc/server.go:384 +0x14e
2019-01-24T17:17:43.283-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4: created by net/rpc.(*Server).ServeCodec
2019-01-24T17:17:43.283-0200 [DEBUG] plugin.terraform-provider-spotinst_v1.6.0_x4:      /opt/goenv/versions/1.11.4/src/net/rpc/server.go:481 +0x47e
2019-01-24T17:17:43.285-0200 [DEBUG] plugin: plugin process exited: path=/home/caio/projects/spotinst-elastigroup-module/.terraform/plugins/linux_amd64/terraform-provider-spotinst_v1.6.0_x4
2019/01/24 17:17:43 [TRACE] root: eval: *terraform.EvalWriteState
2019/01/24 17:17:43 [TRACE] root: eval: *terraform.EvalApplyProvisioners
2019/01/24 17:17:43 [TRACE] root: eval: *terraform.EvalIf
2019/01/24 17:17:43 [TRACE] root: eval: *terraform.EvalWriteState
2019/01/24 17:17:43 [TRACE] root: eval: *terraform.EvalWriteDiff
2019/01/24 17:17:43 [TRACE] root: eval: *terraform.EvalApplyPost
2019/01/24 17:17:43 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* spotinst_elastigroup_aws.default-elastigroup: unexpected EOF
2019/01/24 17:17:43 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* spotinst_elastigroup_aws.default-elastigroup: unexpected EOF
2019/01/24 17:17:43 [TRACE] [walkApply] Exiting eval tree: spotinst_elastigroup_aws.default-elastigroup
2019/01/24 17:17:43 [TRACE] dag/walk: upstream errored, not walking "provider.spotinst (close)"
2019/01/24 17:17:43 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2019/01/24 17:17:43 [TRACE] dag/walk: upstream errored, not walking "root"
2019/01/24 17:17:43 [TRACE] Preserving existing state lineage "5d9f79d6-de40-6585-03da-7e273f4eb8dc"
2019/01/24 17:17:43 [TRACE] Preserving existing state lineage "5d9f79d6-de40-6585-03da-7e273f4eb8dc"
2019/01/24 17:17:43 [TRACE] Preserving existing state lineage "5d9f79d6-de40-6585-03da-7e273f4eb8dc"
2019/01/24 17:17:43 [TRACE] Preserving existing state lineage "5d9f79d6-de40-6585-03da-7e273f4eb8dc"
2019/01/24 17:17:43 [DEBUG] plugin: waiting for all plugin processes to complete...
2019-01-24T17:17:43.303-0200 [WARN ] plugin: error closing client during Kill: err="connection is shut down"



!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Terraform crashed! This is always indicative of a bug within Terraform.
A crash log has been placed at "crash.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Terraform[1] so that we can fix this.

When reporting bugs, please include your terraform version. That
information is available on the first line of crash.log. You can also
get it by running 'terraform --version' on the command line.

[1]: https://github.com/hashicorp/terraform/issues

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!-->

Expected Behavior

Create elastigroup and update new changes.

Actual Behavior

Creates elastigroup normally but, when i run terraform apply any change in resource, terraform will crash

Steps to Reproduce

Please list the full steps required to reproduce the issue, for example:

  1. terraform init
  2. terraform apply
  3. change any value
  4. terraform apply

spotinst_subscription creation fails on error "Resource 'sig-XXXX' doesn't exist" although sig exists

Issue

When creating spotinst_subscription resource it's failing with error message:

CANT_CREATE_SUBSCRIPTION: Resource 'sig-XXXX' doesn't exist

However when searching for this Elastigroup sig in the console I can see it exists.
Annotation 2019-05-21 130655

Terraform Version

$ terraform version
Terraform v0.11.14
+ provider.azurerm v1.27.1
+ provider.spotinst v1.13.3

Affected Resource(s)

  • spotinst_subscription

Terraform Configuration Files

resource "spotinst_subscription" "subscription" {
  resource_id = "${var.elastigroup_id}"
  event_type  = "AZURE_VM_TERMINATE"
  protocol    = "web"
  endpoint    = "https://${var.endpoint}"

  format = {
    event       = "%event%"
    instance_id = "%instance-id%"
  }
}

Expected Behavior

Create the spotinst_notification resource

Actual Behavior

Failed with error message of non-existent Elastigroup although elastigroup with this ID exists

Steps to Reproduce

  1. terraform apply

Resource documentation does not describe how to import them

Most resources for Terraform describe how you would run a terraform import to import an existing object into the state. None of the spotinst resources have that in their documentation.

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to help the community and maintainers prioritize this request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Consolidate Tag Definition

Hi,

We're currently running into issues when running tflint and tfsec against our config when using this provider.

tflint: The argument "tags" was already set at :51,3-7. Each argument may be set only once.
tfsec: Attribute redefined; The argument "tags" was already set at

Our current config looks a little like this:

tags = {
  key = "Key1"
  value = "Value1"
}

tags = {
  key = "Key2"
  value = "Value2"
}

tags = {
  key = "Key3"
  value = "Value3"
}

It would be great to be able to do something like this:

tags = [
  {
    key = "Name"
    value = "${var.customer}-${var.envname}-eks-spotinst-green"
  },
  {
    key = "k8s.io/cluster-autoscaler/enabled"
    value = "true"
  },
  {
    key = "kubernetes.io/cluster/${var.customer}-${var.envname}"
    value = "owned"
  }
]

This would mean "tags" are only defined once and would prevent tools like tflint and tfsec from throwing errors.

Thanks!

Timeout while waiting for state to become 'success' introduced with v1.8.0

Hi there, we have encountered an issues since using v1.8.0 of this provider. When we run the script everything will progress as usual until roughly 5 minutes in when we are presented with the following error:

  • spotinst_elastigroup_aws.corporate: timeout while waiting for state to become 'success' (timeout: 5m0s)

This issue has only developed since v1.8.0 has been released. If we roll back the provider to v1.7.0 and run the same script everything will work correctly as it was doing before the update.

Also an unrelated note is the documentation correct on elastigroups as it seems there is a duplicated version of the wait_for_roll_percentage or am I just not understanding it correctly

update_policy = {
    should_resume_stateful = false
    should_roll            = false
    auto_apply_tags        = false
    wait_for_pct_complete  = 10
    wait_for_pct_timeout   = 1500

    roll_config = {
      batch_size_percentage = 33
      health_check_type     = "ELB"
      grace_period          = 300
      wait_for_roll_percentage = 10
      wait_for_roll_timeout    = 1500
    }
}

Any help would be appreciated with this.

Terraform Version

Terraform v0.11.8

  • provider.spotinst v1.8.0
  • provider.aws v2.0.0

Affected Resource(s)

  • spotinst_elastigroup_aws

Terraform Configuration Files

resource "spotinst_elastigroup_aws" "corporate" {
  name                          = "${var.octopus_project_safe}-${var.octopus_environment} - ${var.version}"
  description                   = "created by Terraform"
  product                       = "Windows"
  subnet_ids                    = ["${var.aws_subnet1}", "${var.aws_subnet2}", "${var.aws_subnet3}"]
  max_size                      = "${var.asg_max_instances}"
  min_size                      = "${var.asg_min_instances}"
  desired_capacity              = "${var.asg_desired_capacity}"
  capacity_unit                 = "instance"
  region                        = "${var.region}"
  image_id                      = "${var.aws_ami}"
  iam_instance_profile          = "webserver"
  key_name                      = "cloudit"
  security_groups               = ["${var.aws_securitygroups}"]
  user_data                     = "${file("StartService.ps1")}"
  enable_monitoring             = false
  ebs_optimized                 = false
  instance_types_ondemand       = "${var.aws_instance_type}"
  instance_types_spot           = ["${var.spotinst_instance_types}"]
  instance_types_preferred_spot = ["${var.aws_instance_type}"]
  orientation                   = "costOriented"
  fallback_to_ondemand          = true
  spot_percentage               = 100

  wait_for_capacity         = "${var.asg_min_instances}"
  wait_for_capacity_timeout = 900

  scheduled_task = [
    {
      task_type             = "scale"
      cron_expression       = "${var.asg_recurrence_night}"
      scale_target_capacity = "${var.asg_desired_capacity_night}"
      scale_min_capacity    = "${var.asg_min_instances_night}"
      scale_max_capacity    = "${var.asg_max_instances_night}"
      is_enabled            = true
    },
    {
      task_type             = "scale"
      cron_expression       = "${var.asg_recurrence_day}"
      scale_target_capacity = "${var.asg_min_instances}"
      scale_min_capacity    = "${var.asg_min_instances}"
      scale_max_capacity    = "${var.asg_max_instances}"
      is_enabled            = true
    },
  ]

  scaling_up_policy = {
    policy_name = "corporate-CPU-scaling-up"
    metric_name = "CPUUtilization"
    statistic   = "average"
    unit        = "percent"
    threshold   = 75
    action_type = "adjustment"
    adjustment  = "1"
    namespace   = "AWS/EC2"

    dimensions = {
      name = "AutoScalingGroupName" 
      value = "${var.octopus_project_safe}-${var.octopus_environment}-Up"
    }

    period             = 300
    evaluation_periods = 2
    cooldown           = 300
    operator           = "gte"
  }

  scaling_down_policy = {
    policy_name = "corporate-CPU-scaling-down"
    metric_name = "CPUUtilization"
    statistic   = "average"
    unit        = "percent"
    threshold   = 35
    action_type = "adjustment"
    adjustment  = "1"
    namespace   = "AWS/EC2"

    dimensions = {
       name = "AutoScalingGroupName" 
       value = "${var.octopus_project_safe}-${var.octopus_environment}-Down"
    }

    period             = 300
    evaluation_periods = 2
    cooldown           = 300
    operator           = "lte"
  }

  health_check_grace_period = "${var.asg_health_check_grace_period}"
  health_check_type         = "TARGET_GROUP"
  target_group_arns         = ["${aws_alb_target_group.corporate.arn}"]
  
  update_policy = {
    should_resume_stateful = false
    should_roll            = true

    roll_config = {
      batch_size_percentage = 100
      health_check_type     = "TARGET_GROUP"
      grace_period          = 900
      
      wait_for_roll_percentage = 100
      wait_for_roll_timeout = 900
    }
  }

  tags = [
    {
      key   = "Name"
      value = "${var.octopus_project_safe}-${var.octopus_environment}-${var.version}"
    },
    {
      key   = "OctopusProject"
      value = "${var.octopus_project}"
    },
    {
      key   = "OctopusEnvironment"
      value = "${var.octopus_environment}"
    },
  ]

  lifecycle {
    ignore_changes = [
      "desired_capacity",
    ]
  }
}

Panic Output

2019-03-04T13:18:41.603Z [DEBUG] plugin.terraform-provider-spotinst_v1.8.0_x4.exe: ===> waiting for at least 100% of batches to complete, currently 0% <===
2019-03-04T13:18:41.603Z [DEBUG] plugin.terraform-provider-spotinst_v1.8.0_x4.exe: [TRACE] Waiting 10s before next try
2019-03-04T13:18:41.649Z [DEBUG] plugin.terraform-provider-spotinst_v1.8.0_x4.exe: [ERROR] WaitForState exceeded refresh grace period
2019-03-04T13:18:41.649Z [DEBUG] plugin.terraform-provider-spotinst_v1.8.0_x4.exe: [ERROR] Group [sig-ccc57383] roll failed, error: timeout while waiting for state to become 'success' (timeout: 5m0s)
2019/03/04 13:18:41 [TRACE] root: eval: *terraform.EvalWriteState
2019/03/04 13:18:41 [TRACE] root: eval: *terraform.EvalApplyProvisioners
2019/03/04 13:18:41 [TRACE] root: eval: *terraform.EvalIf
2019/03/04 13:18:41 [TRACE] root: eval: *terraform.EvalWriteState
2019/03/04 13:18:41 [TRACE] root: eval: *terraform.EvalWriteDiff
2019/03/04 13:18:41 [TRACE] root: eval: *terraform.EvalApplyPost
2019/03/04 13:18:41 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* spotinst_elastigroup_aws.corporate: timeout while waiting for state to become 'success' (timeout: 5m0s)
2019/03/04 13:18:41 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* spotinst_elastigroup_aws.corporate: timeout while waiting for state to become 'success' (timeout: 5m0s)

Expected Behavior

Executed without timeout error

Actual Behavior

Timeout error appears

Steps to Reproduce

  1. terraform apply using v1.8.0

Changes of desired_capacity should be ignored

Terraform Version

0.12.29

Affected Resource(s)

  • spotinst_ocean_aws

Terraform Configuration Files

Debug Output

Panic Output

Expected Behavior

When the ocean cluster starts from desired_capacity = 0 and VNGs are spinning new nodes via ocean autoscaler, another terraform apply will not touch the capacity on the cluster itself.

Actual Behavior

When the ocean cluster starts from desired_capacity = 0 and VNGs are spinning new nodes via ocean autoscaler, another terraform apply will scale the VNGs to 0.
If the value is omitted, the default is also 0

Steps to Reproduce

  1. create an ocean cluster
  2. create vng
  3. deploy app with nodeselector for the labels of that vng
  4. wait for pods to be ready
  5. make some change in terraform and apply
    This will scaled the ocean back to 0 and up again

Error showing the Product inside elastigroup configuration

Terraform Version

Terraform v0.13.5

  • provider registry.terraform.io/spotinst/spotinst v1.29.0

Affected Resource(s)

spotinst_elastigroup_aws_beanstalk

Terraform Configuration Files

Debug Output

Panic Output

Expected Behavior

When creating an Elasigroup for AWS Beanstalk with product = "Linux/UNIX", in Spotinst console should show product "Linux/UNIX".

Actual Behavior

Product inside Spotinst console is empty.

image

Steps to Reproduce

Create an Elastigroup for AWS Beanstalk using Spoinst terraform provider with product = "Linux/UNIX" and in Spotinst console, the Product configuration is empty

Important Factoids

References

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to help the community and maintainers prioritize this request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

spotinst_elastigroup_azure image configuration fails on "apply" although "plan" succeeds

Issue

When using following image properties in spotinst_elastigroup_azure resource

image = {
    marketplace = {
      publisher = "Canonical"
      offer     = "UbuntuServer"
      sku       = "16.04-LTS"
    }
  }

Running terraform plan succeeds
But terraform apply fails

Terraform Version

$ terraform version
Terraform v0.11.12-beta1
+ provider.spotinst v1.7.0

Reproduces with Spotinst provider version: latest V2 as well. (installed manually)

Affected Resource(s)

  • spotinst_elastigroup_azure

Debug Output

Error: Error applying plan:

1 error(s) occurred:

* spotinst_elastigroup_azure.qa_core_app: 1 error(s) occurred:

* spotinst_elastigroup_azure.qa_core_app: [ERROR] failed to create group: POST https://api.spotinst.io/compute/azure/group: 400 (request: "abdb76af-94a0-444b-86ca-b437c659789f") INVALID_MARKETPLACE_IMAGE: Invalid Marketplace Image:
Canonical:UbuntuServer:16.04-LTS with version: null

Expected Behavior

fail on terraform plan

Actual Behavior

failed on terraform apply

Steps to Reproduce

  1. terraform apply

Creating spotinst_ocean_aws with long tag value

Terraform Version

Affected Resource(s)

  • spotinst_ocean_aws

Terraform Configuration Files

resource "spotinst_ocean_aws" "spotinst" {
  tags {
    key   = "KubernetesCluster"
    value = "eks-tagging-resources2.k8s.remitly.com"
  }
}

Debug Output

Error: timed out waiting for the condition

Expected Behavior

It should execute without any problem

Actual Behavior

Crashing

Steps to Reproduce

Just use the long tag

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to help the community and maintainers prioritize this request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

spot_percentage is not listed in the documentation

Terraform Version

Terraform v0.13.2
- Using previously-installed terraform-providers/spotinst v1.25.0

Affected Resource(s)

Please list the resources as a list, for example:

  • spotinst_ocean_aws

Terraform Configuration Files

it seems the terraform documentation for Spot is out of date:

https://www.terraform.io/docs/providers/spotinst/r/ocean_aws.html

this does not mention a variable that I found when exporting a cluster from the Spot UI which is spot_percentage

image

Unable to set load_balancer from module

Hi there,

I am unable to pass down load_balancer from a module to spotinst_aws_group resource.
I am getting "load_balancer.0.type": required field is not set

Terraform Version

  • provider.aws v1.3.0
  • provider.spotinst (unversioned) - v0.11.1
  • provider.template v1.0.0

Affected Resource(s)

Please list the resources as a list, for example:

  • spotinst_aws_group

Terraform Configuration Files

source tree:

repo
|-- elastigroup
|     |-- main.tf
|     `-- io.tf
`-- module.tf

module.tf

module "my_module" {
  source = "./elastigroup"
  load_balancer = [{
    name = "${aws_lb.some_load_balancer.name}"
    type = "target_group"
    arn = "${aws_lb_target_group.some_target_group.arn}"
  }]
 # more module attributes
}

elastigroup/main.tf

resource "spotinst_aws_group" "nodes" {
  # resource attributes
  load_balancer = ["${var.load_balancer}"]
  # more resource attributes
}

elastigroup/io.tf

variable "load_balancer" {
  type = "list"
  default = []
}

Expected Behavior

What should have happened?
The load balancer should have been accepted

Actual Behavior

What actually happened?
Got an error saying: "load_balancer.0.type": required field is not set

Steps to Reproduce

See the configuration above

Subsequent capacity updates for `spotinst_ocean_ecs` do not take effect

It appears that after a successful creation of a spotinst_ocean_ecs cluster with desired settings that subsequent modifications to the desired_capacity never take effect.

To Reproduce

  1. Define an ECS cluster using the spotinst_ocean_ecs resource.
  2. Set desired_capacity to 1
  3. Run terraform apply and verify successful state in Spotinst
  4. Update Terraform to use a new desired_capacity. In my case, I changed from 1 to 0.
  5. Run terraform apply.
  6. Observe terraform completes successfully; however, there is no change in Spotinst. Additionally, re-running terraform apply detects the existing capacity as 1 every time and tries to set to 0; however, it's not working.

Terraform Version

Terraform v0.12.24
+ provider.aws v2.61.0
+ provider.spotinst v1.15.0
+ provider.template v2.1.2

Affected Resource(s)

  • spotinst_ocean_ecs

Debug Warnings

2020/05/10 23:28:32 [WARN] Provider "registry.terraform.io/-/spotinst" produced an unexpected new value for 
spotinst_ocean_ecs.default, but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .desired_capacity: was cty.NumberIntVal(0), but now cty.NumberIntVal(1)

Relevant HCL stripped/modified

resource "spotinst_ocean_ecs" "default" {
  name         = "XXX-ocean-ecs-cluster"
  cluster_name = "XXX-ecs-cluster"
  region       = "us-west-2"

  min_size         = 0
  max_size         = 2
  desired_capacity = 1 # Initially 1, then re-run back to 0

  subnet_ids = module.vpc.public_subnets
  whitelist  = ["t3a.nano"]

  security_group_ids   = [aws_security_group.ecs_instance.id]
  image_id             ="ami-088bb4cd2f62fc0e1"
  iam_instance_profile = aws_iam_instance_profile.instance.name

  associate_public_ip_address = true
  monitoring                  = false
  ebs_optimized               = true

  utilize_reserved_instances = false
  draining_timeout           = 30

}

Side Notes

The problem was observed numerous times during testing of only 2 fields in terraform. Specifically the desired_capacity and whitelist. It may also be denying other attribute changes as I also noticed the whitelist not taking effect as well.

Support EBS volume tagging

Howdy folks,

At the moment as far as I can see in the docs, in the spotinst_elastigroup_aws resource, the ebs_block_device block doesn't supporting tagging.

As our EC2 running costs are quite low now (due to using spotinst ๐Ÿ˜„), a large part of our bill is spent on EBS volumes. We break this down using tags.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#tag-resources

It would be great to have this feature as it would mean we have feature parity (in terms of billing analysis) managing our instance fleets with spotinst as we would in AWS.

numBatch Causing errors

@nadavnaor
numBatch is causing issues and appears should be removed.

if v, ok := m[string(elastigroup_aws.BatchNum)].(int); ok && v >= 0 {

Example, running:

spotinst_elastigroup_aws.steven-c5-us-east-2: Modifying... [id=sig-6b0adb55]

Error: PUT https://api.spotinst.io/aws/ec2/group/sig-6b0adb55/roll?accountId=act-61e1c107: 400 (request: "26608a5e-2a1d-4aa4-9da6-f23aefed6ade") ValidationError: "batchNum" must be larger than or equal to 1 (field: body:strategy.onFailure.batchNum)

Based on our deployment documentation this is not even part of the API Body: https://docs.spot.io/api/#operation/elastigroupAwsDeploy

Please review.

Add support for credentials profile in provider configuration

Terraform and provider versions

Terraform v0.13.5
provider.spotinst: v1.27.0

Description

According to the provider documentation, there is no way to establish which profile to use in case of using a credentials file.

Use Cases

An organization with several environments, each of them in a different account. The operator has a spotinst credentials file in its filesystem:

default:
  token: <redacted>
  account: <redacted>
production:
  token: <redacted>
  account: <redacted>

It would be great to be able to establish the profile in use in the provider configuration.

Potential Terraform Configuration

Given the credentials file listed before, a provider could be configured the following way:

provider "spotinst" {
  profile = "production"
}

References

The spotinst-sdk-go seems to already have support for profiles in credentials files.

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to help the community and maintainers prioritize this request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Nomad autoscale_constraints improperly rendered with AWS Elastigroup

TL;DR - When integration_nomad {} is specified for an AWS Elastigroup, the provider doesn't properly translate autoscaler_constraints blocks into JSON for the API request.

Terraform Version

Terraform v0.12.21 (latest available in Chocolatey)

Provider versions:

  • provider.aws v2.52.0
  • provider.spotinst v1.14.2

Affected Resource(s)

  • spotinst_elastigroup_aws

Terraform Configuration Files

Truncated to relevant section:

    integration_nomad {
        autoscale_constraints {
                key = "node.class"
                value = "test"
        }
    }

Actual Behavior

When Terraform displays the plan output, it shows the correct projected actions for the resource:

Truncated to relevant section:

+ integration_nomad {
    + autoscale_constraints {
        + key   = "${node.class}"
        + value = "test"
    }
}

However, the debug output shows improper JSON being sent to the API:

Truncated to relevant section:

"thirdPartiesIntegration": {
    "nomad": {
        "autoScale": {
            "constraints": [
            {
                "key": "${node.class}",
                "value": ""
            },
            {
                "key": "${${node.class}}",
                "value": "test"
            }
            ]
        }
    }
}

This results in a ValidationError being returned from the API:

[ERROR] failed to create group: POST https://api.spotinst.io/aws/ec2/group: 400 (request: "566d5d84-eac3-4e7d-8e6d-fa59d770594f") ValidationError: "value" is not allowed to be empty (field: body:group.thirdPartiesIntegration.nomad.autoScale.constraints.0.value)

Steps to Reproduce

  1. Attempt to create a spotinst_elastigroup_aws resource that contains an autoscale_constraints{} block.

Important Factoids

This seems like this may have been introduced with Terraform 12. I have access to another configuration repository which uses TF11, and this issue does not occur.

Resizing block_device_mapping volume size doesn't work

Terraform Version

Terraform v0.14.9

Affected Resource(s)

spotinst_managed_instance_aws

Terraform Configuration Files

terraform {
  required_providers {
    spotinst = {
      source  = "spotinst/spotinst"
      version = "1.37.0"
    }
  }

  backend "s3" {
    bucket = "bucket-name"
    key    = "tf-state"
    region = "ap-southeast-1"
  }
}

provider "spotinst" {
  # use SPOTINST_TOKEN and SPOTINST_ACCOUNT environment variables
  # token   = "XXXXXXXXX"
  # account = "XXXXXXXXX"
}

# Create a Manged Instance
resource "spotinst_managed_instance_aws" "elasticsearch" {

  name        = "es-dev"
  description = "elasticsearch"
  product     = "Linux/UNIX"

  region     = "ap-southeast-1"
  subnet_ids = ["subnet-090b504d797eeaf7f"]
  vpc_id     = "vpc-0b689935850729055"

  optimization_windows = ["Sat:20:00-Sat:22:00", "Sun:20:00-Sun:22:00"]
  auto_healing         = "true"
  grace_period         = "120"
  unhealthy_duration   = "120"
  revert_to_spot {
    perform_at = "timeWindow"
  }

  persist_private_ip    = "true"
  persist_block_devices = "true"
  persist_root_device   = "true"
  block_devices_mode    = "reattach"
  health_check_type     = "EC2"

  private_ip = "172.21.2.215"

  instance_types = [
    "t3.medium",
    "t2.medium",
    "t3a.medium"
  ]

  preferred_type = "t3a.medium"
  image_id = "ami-01f7527546b557442"
  security_group_ids = ["sg-0e0ca50f1363003e8"]
  key_pair           = "nfs-server"
  cpu_credits = "standard"

  tags {
    key   = "app"
    value = "elastcisearch"
  }

  tags {
    key   = "role"
    value = "server"
  }

  tags {
    key   = "environment"
    value = "staging"
  }

  block_device_mappings {
    device_name = "/dev/xvdb"
    ebs {
      delete_on_termination = false
      volume_type           = "GP3"
      volume_size           = 210
      iops                  = 3000
      throughput            = 125
    }
  }

  network_interface {
    associate_ipv6_address      = false
    associate_public_ip_address = false
    device_index                = "0"
  }
}

Debug Output

Panic Output

Expected Behavior

Block device volume size resized according to specified config

Actual Behavior

Block device volume size remains the same

Steps to Reproduce

  1. terraform apply

Important Factoids

References

Community Note

image
image
image

Failure to create elastigroup deleted in console

Terraform Version

Terraform v0.10.7

Affected Resource(s)

  • spotinst_aws_group

Terraform Configuration Files

No custom config.

Debug Output

https://gist.github.com/k3ypad/cf1b7449207593c496179504924b409d

Panic Output

No panic.

Expected Behavior

On deletion of a resource outside of terraform, the terraform provider should not error on plan and plan to re-create the resource.

Actual Behaviour

terraform plan errors with a 400 error complaining that the deleted elastigroup doesn't exist.
Re

Steps to Reproduce

  1. Create a spotinst_aws_group resource with terraform
  2. Delete the resource manually in the console
  3. Run terraform plan - it should error complaining that the group doesn't exist.

Important Factoids

Not doing anything special.

References

No other issues found.

Add managed_service_identity to elastigroup_azure

This is probably a Feature Request.

In Spotinst console/API there is option to add Managed Service Identity to Azure Elastigroup.

        "managedServiceIdentities": [
          {
            "name": "my-Managed-Identity",
            "resourceGroupName": "my-Resource-Group"
          }
        ]

However it seems to be missing from the terraform-provider-spotinst options

Terraform Version

Terraform v0.11.13
+ provider.azurerm v1.23.0
+ provider.spotinst v1.9.0

Affected Resource

  • spotinst_elastigroup_azure

Expected Behavior

have option in provider for managedServiceIdentities

Actual Behavior

no such option AFAIK

Alter resource.spotinst_aws_group.tags schema to allow dynamic keys

Terraform Version

$ terraform version
Terraform v0.9.7

Affected Resource(s)

  • spotinst_aws_group

Terraform Configuration Files

resource "spotinst_aws_group" "workers" {
  name = "workers-group"
  description = "created by Terraform"
  product = "Linux/UNIX"
  count  = "${var.use_spotinst == true ? 1 : 0}"

  capacity {
    target = 2
  }

  launch_specification {
    monitoring = false
    image_id = "${data.aws_ami.coreos_ami.image_id}"
    key_pair = "${var.ssh_key}"
    security_group_ids = ["${var.sg_ids}"]
    iam_instance_profile = "${aws_iam_instance_profile.worker_profile.arn}"
    user_data = "${var.user_data}"
  }

  tags {
    Name = "${var.cluster_name}-worker"
    tectonicClusterID = "${var.cluster_id}"
    "kubernetes.io/cluster/${var.cluster_name}" = "owned"
  }

Expected Behavior

Note the following tag from the configuration above.

 "kubernetes.io/cluster/${var.cluster_name}" = "owned"

There are situations, such as spinning up a kubernetes cluster, where tag keys should be evaluated dynamically.

My suggestion is to change the resource.spotinst_aws_group.tags schema similar to that of the AWS provider. The following example is pulled from the aws_autoscaling_groups resource.

  tags = [
    {
      key                 = "Name"
      value               = "${var.cluster_name}-worker"
    },
    {
      key                 = "kubernetes.io/cluster/${var.cluster_name}"
      value               = "owned"
    },
    {
      key                 = "clusterID"
      value               = "${var.cluster_id}"
    },
  ]

Actual Behavior

The key in the example above is not evaluated and is created as its static value.

support for IMDSV2 configuration in AWS

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

0.13.4 (but this would affect any version)

Affected Resource(s)

Please list the resources as a list, for example:

  • spotinst_ocean_aws
  • spotinst_ocean_aws_launch_spec
  • spotinst_ocean_ecs
  • spotinst_ocean_ecs_launch_spec

Expected Behavior

Support requiring http tokens, support hop limits, etc.

Actual Behavior

There are currently no options for configuring IMDSV2

Unexpected user_data change in spotinst_elastigroup_aws

Terraform Version

Terraform v0.11.10

  • provider.aws v2.1.0
  • provider.null v2.1.0
  • provider.spotinst v1.8.0
  • provider.template v2.1.0

Affected Resource(s)

  • spotinst_elastigroup_aws

Terraform Configuration Files

"resource" "spotinst_elastigroup_aws" "default" {
  "name" = "default"

  "spot_percentage" = 100

  "orientation" = "balanced"

  "draining_timeout" = 120

  "fallback_to_ondemand" = true

  "lifetime_period" = "days"

  "desired_capacity" = 2

  "min_size" = 0

  "max_size" = 4

  "capacity_unit" = "instance"

  "instance_types_ondemand" = "t2.small"

  "instance_types_spot" = ["t2.small", "t3.small"]

  "subnet_ids" = ["subnet-5c12345a"]

  "product" = "Linux/UNIX"

  "security_groups" = ["sg-12345678"]

  "enable_monitoring" = false

  "ebs_optimized" = false

  "image_id" = "ami-0150b2ec056e3c3c1"

  "key_name" = "default"

  "network_interface" = {
    "device_index" = 0

    "associate_public_ip_address" = true

    "delete_on_termination" = true
  }

  "user_data" = "IyEvYmluL2Jhc2gKCm1rZGlyIC9kZXYvbXF1ZXVlCm1vdW50IC10IG1xdWV1ZSBub25lIC9kZXYvbXF1ZXVlCgpkb2NrZXIgcGx1Z2luIGluc3RhbGwgLS1hbGlhcyBjbG91ZHN0b3I6YXdzIC0tZ3JhbnQtYWxsLXBlcm1pc3Npb25zIGRvY2tlcjR4L2Nsb3Vkc3RvcjoxNy4wNi4wLWNlLWF3czIgQ0xPVURfUExBVEZPUk09QVdTIEFXU19SRUdJT049ZXUtd2VzdC0xIEVGU19TVVBQT1JURUQ9MCBERUJVRz0xCnNlcnZpY2UgZG9ja2VyIHJlc3RhcnQ="

  "tags" = {
    "key" = "Spotinst"

    "value" = "true"
  }

  "health_check_type" = "ECS_CLUSTER_INSTANCE"

  "health_check_grace_period" = 300

  "health_check_unhealthy_duration_before_replacement" = 120

  "integration_ecs" = {
    "cluster_name" = "default"

    "autoscale_is_enabled" = true
  }

  "region" = "eu-west-1"
}

Expected Behavior

The Spotinst Elastigroup should be created and after that creation running terraform plan shouldn't point out any changes needed.

Actual Behavior

The Spotinst Elastigroup is being created successfully but then when I run terraform plan it points out that user_data has been changed.

Steps to Reproduce

  1. terraform apply
  2. terraform plan
  3. The plan presents the required change to elastigroup's user_data because it has changed.

References

Similar problem in the AWS provider: hashicorp/terraform-provider-aws#4954

Similar problem in the Spotinst provider: https://github.com/terraform-providers/terraform-provider-spotinst/issues/23

Pull request probably worth referencing: https://github.com/terraform-providers/terraform-provider-spotinst/pull/39

Panic when reading already created AWS elastigroup with onDemandCount set ("risk": null)

Terraform Version

terraform -v
Terraform v0.13.5
+ provider registry.terraform.io/-/local v2.0.0
+ provider registry.terraform.io/-/spotinst v1.27.0
+ provider registry.terraform.io/hashicorp/local v2.0.0
+ provider registry.terraform.io/spotinst/spotinst v1.29.0

Affected Resource(s)

  • spotinst_elastigroup_aws

Terraform Configuration Files

resource "spotinst_elastigroup_aws" "elastic_search_warm" {
  name        = "ElasticSearch-warm"
  description = "Imported from auto scaling group: ElasticSearch-warm"
  product     = "Linux/UNIX"

  min_size         = 3
  max_size         = 21
  desired_capacity = 19
  capacity_unit    = "instance"

  region = "eu-west-1"
  subnet_ids = [
    "subnet-dae37c81",
    "subnet-64affc03",
    "subnet-4aba9f03",
  ]

  image_id             = "ami-0c050c28ba68b201b"
  iam_instance_profile = "arn:aws:iam::927637044349:instance-profile/ecsInstanceRole"
  key_name             = "my-key"
  security_groups = [
    "sg-62548719",
    "sg-69b86912",
  ]
  user_data         = data.local_file.cloud_config_elastic_search_warm.content_base64
  enable_monitoring = false
  ebs_optimized     = true
  placement_tenancy = "default"

  instance_types_ondemand = "i3.large"
  instance_types_spot = [
    "i3.large",
    "i3.xlarge",
  ]
  instance_types_preferred_spot = [
    "i3.large",
  ]

  orientation                = "balanced"
  fallback_to_ondemand       = true
  ondemand_count             = 4
  utilize_reserved_instances = true
  draining_timeout           = 120


  lifetime_period = "days"

  revert_to_spot {
    perform_at = "always"
  }

  health_check_type         = "EC2"
  health_check_grace_period = 300

  tags {
    key   = "Environment"
    value = "Shared"
  }
  tags {
    key   = "ESCluster"
    value = "empathyops"
  }
  tags {
    key   = "Name"
    value = "ElasticSearch"
  }
  tags {
    key   = "Service"
    value = "ElasticSearch-warm"
  }
  tags {
    key   = "Monitoring"
    value = "prometheus"
  }
  tags {
    key   = "Management"
    value = "Spotinst"
  }
}

Debug Output

Debug gist

Panic Output

Panic gist

Expected Behavior

Terraform executes as intended and produces a plan

Actual Behavior

Panic crash

Steps to Reproduce

  1. The elastigroup was already created through the GUI with ondemand_count: 4
  2. Trying to migrate its definition to Terraform, just execute terraform plan

Important Factoids

The elastigroup was already created through the GUI with ondemand_count: 4, which gives this json as its configuration:

...
    "strategy": {
      "risk": null,
      "onDemandCount": 4,
      "availabilityVsCost": "balanced",
      "drainingTimeout": 120,
      "utilizeReservedInstances": true,
      "fallbackToOd": true,
      "scalingStrategy": null,
      "persistence": {},
      "revertToSpot": {
        "performAt": "always"
      }
...

Changing the elastigroup configuration to e.g. spot_instances: 80 (no ondemand_count) makes "risk": 80 in above JSON, and the terraform plan works perfectly.

Hope this is not misleading, but I think the problem is in these lines in fields_spotinst_elastigroup_aws_strategy.go:

			var value *float64 = nil
			if elastigroup.Strategy != nil && elastigroup.Strategy.Risk != nil {
				value = elastigroup.Strategy.Risk
			}
			if err := resourceData.Set(string(SpotPercentage), spotinst.Int(int(*value))); err != nil {
				return fmt.Errorf(string(commons.FailureFieldReadPattern), string(SpotPercentage), err)
			}

As elastigroup.Strategy.Risk is null, value var remains nil and the cast in spotinst.Int(int(*value)) produces the panic. I think this is why changing the elastigroup configuration with a defined value for risk makes it work.

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to help the community and maintainers prioritize this request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Provider will not take inputs from null resources

Terraform Version

TF Version: 0.11.14
Provider Version: 1.13

Affected Resource(s)

  • spotinst_elastigroup_aws

Terraform Configuration Files

variable "tags_example" {
  type = "map"
  value = {
    tag1 = "value1",
    tag2 = "value2"
  }
}

data "null_data_source" "tags_example" {
  count = "${length(keys(var.tags_example))}"

  inputs = {
    key   = "${element(keys(var.tags_example), count.index)}"
    value = "${element(values(var.tags_example), count.index)}"
  }
}

resource "spotinst_elastigroup_aws" "elastigroup" {
  ... configuration ...
  tags = ["${data.null_data_source.tags_example.*.outputs}"]
}

Debug Output

Relevent parts of the debug output are here. If more (or a full) debug is required, let me know. It will take some effort to properly redact it.
https://gist.github.com/jalavoy/540eb2ac95fb9818ab7cf19b18a12f6e

Panic Output

None

Expected Behavior

The provider should read the null_data_source as valid.

Actual Behavior

The provider reads the null_data_source as an empty set.

Error: module.rancher_agent_dts.module.spotinst_elastigroup.spotinst_elastigroup_aws.elastigroup: "tags.0.key": required field is not set



Error: module.rancher_agent_dts.module.spotinst_elastigroup.spotinst_elastigroup_aws.elastigroup: "tags.0.value": required field is not set

Steps to Reproduce

  1. terraform apply

Important Factoids

We use this code all over the place. It doesn't seem to be happy inside the spotinst provider.

Basically, when we define a new service, we store all of our tags in a map. All of our end resources are modularized, so when we need to make a new service, we pass the map to the module, which (if needed) transforms it into the proper format using null_data_sources. We use this for AWS ASG a ton to transform it into a similar datastructure as the spotinst provider wants. Looks something like this:

data "null_data_source" "asg-tags" {
  count = "${length(var.tags)}"

  inputs = {
    key   = "${element(keys(var.tags), count.index)}"
    value = "${element(values(var.tags), count.index)}"
    propagate_at_launch = "true"
  }
}

The point of doing it this way is if the tag data gets bigger, we don't have to go update the modules to accept this newly sized data. The null_data_source takes care of transforming it, and passing it to the provider in the correct format.

Just to be sure things look like they should, I setup an output to dump data.null_data_source.tags.*.outputs. It looks like this:

[
  {
    "key": "business",
    "value": "operations"
  },
  {
    "key": "component",
    "value": ""
  },
  {
    "key": "defined_in",
    "value": "/terraform/services/rancher_dts/src"
  },
  {
    "key": "product",
    "value": "infrastructure"
  }
]

This is the format the provider wants. So this should pass without an error.

It feels to me like the the provider is evaluating the data structure before it's finished computing. Since other resources (outputs, consul outputs) render and display the datastructure correctly.

References

This was discussed extensively with Tomer Hadassi in the spotinst slack. Feel free to reference that thread.

instance profile seems to accept name OR arn (but this isn't clear)

Terraform Version

Terraform v0.13.5
+ provider registry.terraform.io/hashicorp/aws v3.14.1
+ provider registry.terraform.io/hashicorp/kubernetes v1.13.3
+ provider registry.terraform.io/hashicorp/local v2.0.0
+ provider registry.terraform.io/hashicorp/null v3.0.0
+ provider registry.terraform.io/hashicorp/random v3.0.0
+ provider registry.terraform.io/hashicorp/template v2.2.0
+ provider registry.terraform.io/terraform-providers/spotinst v1.27.0

Description

regarding: https://registry.terraform.io/providers/spotinst/spotinst/latest/docs/resources/ocean_aws

the ocean_aws resource seems iam_instance_profile accepts either an ARN or a Name but this isn't explained in the documentation. I found this out because I was comparing some configuration differences between clusters we have and how they were created via terraform, and I saw in the SpotInst UI -> View Configuration the following:

cluster 1

   "iamInstanceProfile": {
     "name": "<CLUSTER_NAME>20201209214601735300000002"
   },

cluster 2

"iamInstanceProfile": {
"arn": "arn:aws:iam:::instance-profile/<CLUSTER_NAME>20201021021723070600000004"
},


This is a request to improve the documentation AND/OR change the meaning of the parameter and include multiple parameters to make it clear what you expect to see as input.

### Community Note

* Please vote on this issue by adding a ๐Ÿ‘ [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to help the community and maintainers prioritize this request.
* If you are interested in working on this issue or have submitted a pull request, please leave a comment.

<!--- Thank you for keeping this note for the community --->

Add "subnet_ids" field to spotinst_ocean_ecs_launch_spec resource

Description

According to https://registry.terraform.io/providers/spotinst/spotinst/latest/docs/resources/ocean_ecs_launch_spec we cannot pass "subnet_ids" field to "spotinst_ocean_ecs_launch_spec ".

The API seems to support it though: https://docs.spot.io/api/#operation/OceanECSLaunchSpecCreate field subnetIds.

Use Cases

One possible use case is to run both public & private workloads on the same ECS cluster.
Currently I'm forced to run 2 clusters, one for webapps in public subnets and one for workers in private subnets.

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to help the community and maintainers prioritize this request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Tags are not mergeable in any of the ocean resources

Terraform Version

0.12.29

Affected Resource(s)

Please list the resources as a list, for example:

  • all ocean_* resources

If this issue appears to affect multiple resources, it may be an issue with
Terraform's core, so please mention this.

Terraform Configuration Files

We have "tags" defined in locals as a map

trying to merge the tags in any resource Is not working and has to be created seperately for each tag.

tags = {merge(locals.tags)}

Debug Output

Panic Output

Expected Behavior

Terraform should take the tags in the locals and create those tags on the resource as it does in any other provider.

Actual Behavior

it errors with "Unsupported attribute"

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. define tags in locals
  2. try to use "merge" function in any ocean resource
  3. terraform validate/apply/plan

Important Factoids

Are there anything atypical about your accounts that we should know?

References

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to help the community and maintainers prioritize this request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Add subnet default as option for associate_public_ip_address

Terraform Version

Terraform v0.12.18

Provider Versions:

  • provider.spotinst: 1.19.0

Affected Resource(s)

  • spotinst_ocean_aws

Terraform Configuration Files

resource "spotinst_ocean_aws" "spotinst" {
  name          = "${local.cluster_name}"
  controller_id = "${local.cluster_name}"
  region        = local.region

  user_data                   = "${base64encode(module.userdata)}"
  subnet_ids                  = "${module.private_subnet.*.id}"
  image_id                    = "${data.aws_ami.eks-worker.id}"
  security_groups             = ["${module.worker_security_group}"]
  iam_instance_profile        = "${module.instance_profile_name}"
  associate_public_ip_address = false
  root_volume_size            = 400

  // --- STRATEGY --------------------
  min_size                   = 3
  max_size                   = 1000
  fallback_to_ondemand       = true
  spot_percentage            = 100
  draining_timeout           = 120
  utilize_reserved_instances = false
  // ---------------------------------

  // --- AUTOSCALER -----------------
  autoscaler {
    autoscale_is_enabled     = true
    autoscale_is_auto_config = true
    autoscale_cooldown       = 300

    autoscale_down {
      evaluation_periods = 300
    }
  }
  // --------------------------------
  tags {
    key   = "kubernetes.io/cluster/${local.cluster_name}"
    value = "owned"
  }
}

What should have happened?

The provider doesn't allow a user to set a According to subnet default equivalent option when configuring associate_public_ip_address; it's only available via the spotinst UI. The default value is false according to docs. The terraform provider should allow a cluster to configure "subnet default" when determining if a public ip address association.

Actual Behavior

associate_public_ip_address only supports 2 of the 3 options:
true: Associate public IP
false Do not associate public IP

Use Case:
As a user, I would like to configure associate_public_ip_address in spotinst_ocean_aws resources with all eligible options via Terraform to avoid having to do manual configurations in the UI.

Steps to Reproduce

  1. terraform apply while changing the value for associate_public_ip_address

[PROPOSAL] Switch to Go Modules

As part of the preparation for Terraform v0.12, we would like to migrate all providers to use Go Modules. We plan to continue checking dependencies into vendor/ to remain compatible with existing tooling/CI for a period of time, however go modules will be used for management. Go Modules is the official solution for the go programming language, we understand some providers might not want this change yet, however we encourage providers to begin looking towards the switch as this is how we will be managing all Go projects in the future. Would maintainers please react with ๐Ÿ‘ for support, or ๐Ÿ‘Ž if you wish to have this provider omitted from the first wave of pull requests. If your provider is in support, we would ask that you avoid merging any pull requests that mutate the dependencies while the Go Modules PR is open (in fact a total codefreeze would be even more helpful), otherwise we will need to close that PR and re-run go mod init. Once merged, dependencies can be added or updated as follows:

$ GO111MODULE=on go get github.com/some/module@master
$ GO111MODULE=on go mod tidy
$ GO111MODULE=on go mod vendor

GO111MODULE=on might be unnecessary depending on your environment, this example will fetch a module @ master and record it in your project's go.mod and go.sum files. It's a good idea to tidy up afterward and then copy the dependencies into vendor/. To remove dependencies from your project, simply remove all usage from your codebase and run:

$ GO111MODULE=on go mod tidy
$ GO111MODULE=on go mod vendor

Thank you sincerely for all your time, contributions, and cooperation!

Terraform plan returns error if spotinst_ocean_aws_launch_spec is deleted using the spotinst console

The spotinst_ocean_aws_launch_spec resource if is still in the state file, but deleted from spotinst by some other means than terraform (e.g. spotinst console), then all subsequent terraform plan operations will exit with an error message "resource not found" instead of acknowledging that it has disappeared and trying to recreate on the next apply.

The only workaround is to terraform state rm the deleted resource manually.

Terraform Version

v0.11.14

Spotinst Provider Version

v1.13.3

Affected Resource(s)

  • spotinst_ocean_aws_launch_spec

Expected Behavior

When I manage a spotinst_ocean_aws_launch_spec I would expect that if someone deletes that resource on the spotinst console, when I next run terraform plan it would notice and will try to recreate it on apply.

Actual Behavior

terrafrom plan exits with error:

Error: Error refreshing state: 1 error occurred:
	* spotinst_ocean_aws_launch_spec.example: 1 error occurred:
	* spotinst_ocean_aws_launch_spec.example: spotinst_ocean_aws_launch_spec.example: failed to read launchSpec: GET https://api.spotinst.io/ocean/aws/k8s/launchSpec/ols-99b018bd?accountId=<account_id>: 400 (request: "5c91be7f-623a-4b56-ab65-1d2e8eb1e80a") CANT_GET_OCEAN_LAUNCH_SPEC: LaunchSpec: 'ols-99b018bd' does not exist

Steps to Reproduce

  1. have a setup where you have an EKS managed by spotinst ocean
  2. at least one spotinst_ocean_aws_launch_spec managed by terraform
  3. terraform apply
  4. Delete the spotinst_ocean_aws_launch_spec resource using the spotinst console
  5. terraform plan

Error output on AWS roll failure is nil

Terraform Version

0.12.13

Affected Resource(s)

  • spotinst_elastigroup_aws

Expected Behavior

When hitting a roll failure, we should be getting a dump of the specific error coming from awaitReadyRoll().

Actual Behavior

Error information from awaitReadyRoll() is never passed back to the fmt.Errorf() function. So the actual error is never communicated to the user.

Error: [ERROR] Timed out when waiting for minimum roll %: %!s(<nil>)

Steps to Reproduce

Push a roll with this resource that will timeout or otherwise fail in awaitReadyRoll().

References

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.