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

openstack_orchestration_stack_v1 errors on non-string outputs #1612

Open
aurynn opened this issue Sep 28, 2023 · 0 comments
Open

openstack_orchestration_stack_v1 errors on non-string outputs #1612

aurynn opened this issue Sep 28, 2023 · 0 comments

Comments

@aurynn
Copy link
Contributor

aurynn commented Sep 28, 2023

Terraform Version

Terraform v1.5.7
on darwin_arm64
+ provider registry.terraform.io/terraform-provider-openstack/openstack v1.52.1

Affected Resource(s)

  • openstack_orchestration_stack_v1

Terraform Configuration Files

terraform {
required_version = "~> 1.5"
  required_providers {
    openstack = {
      source  = "terraform-provider-openstack/openstack"
      version = ">= 1.52"
    }
  }
}

resource "openstack_orchestration_stack_v1" "stack" {
  name = "condition_test"
  timeout = 15 # minutes
  parameters = {
    input_vars = jsonencode({
      one = 1
      two = 2
    })
  }
  template_opts = {
    Bin = file("${path.module}/heat/conditions.yaml")
  }
  environment_opts = {
    Bin = ""
  }
}

locals {
  orchestration_outputs = { for s in openstack_orchestration_stack_v1.stack.outputs : s["output_key"] => s["output_value"] }
}

output "orchestration" {
  value = local.orchestration_outputs
}
---
heat_template_version: 2018-08-31

description: |
  Testing the conditions system in HEAT

parameters:
  input_vars:
    type: json

resources:
  output_value_true:
    type: OS::Heat::Value
    properties:
      value: "success"
      type: string
    condition: passed
conditions:
    passed:
      yaql:
        expression: $.data.input[one] <= $.data.input[two]
        data:
          input:
            get_param: input_vars
outputs:
  passed:
    value: { get_attr: [ output_value_true, value ] }
    condition: passed
    description: passed
  value_one:
    description: first
    value:
      yaql:
        expression: $.data.input[one]
        data: 
          input: { get_param: input_vars }
  value_two:
    description: second
    value:
      yaql:
        expression: $.data.input[two]
        data: 
          input: { get_param: input_vars }

Debug Output

Relevant error logs

Expected Behavior

terraform refresh fetching the numeric values and outputting them as expected

Actual Behavior

Outputs which returned number values were not rendered in the output.

terraform refresh
openstack_orchestration_stack_v1.stack: Refreshing state... [id=820e029f-aea7-4009-80f7-1b83dcfaf938]

Outputs:

orchestration = {
  "passed" = "success"
}

Steps to Reproduce

The above example demonstrates the issue. Create the stack resource, refresh it, and only the "passed" output will get created.

As you can see in the error log, it's failing with expecting only strings as outputs from OpenStack, whereas this example returns a float.

For now, the workaround is probably enforcing casting to a string on the OpenStack side of things.

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