Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Nomad autoscale_constraints improperly rendered with AWS Elastigroup #81

Open
jfcantu opened this issue Mar 10, 2020 · 0 comments
Open

Comments

@jfcantu
Copy link

jfcantu commented Mar 10, 2020

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.

julian3xl pushed a commit to julian3xl/terraform-provider-spotinst that referenced this issue Jun 29, 2022
## 1.9.0 (Unreleased)

ENHANCEMENTS:
* resource/spotinst_elastigroup_azure: added `additional_ip_configs` to `network`
* resource/spotinst_elastigroup_azure: added kubernetes and Multai to `integrations`
* resource/spotinst_elastigroup_azure: added `scaling policies`

BUG FIXES:
* changed the order that credentials are set. See notes.
* resource/spotinst_elastigroup_azure: `dimensions` changed to properly set `name` and `value` parameters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant