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

Type error on split tags #114

Closed
bulju opened this issue Nov 2, 2022 · 2 comments
Closed

Type error on split tags #114

bulju opened this issue Nov 2, 2022 · 2 comments
Assignees

Comments

@bulju
Copy link
Contributor

bulju commented Nov 2, 2022

Hi there,

I'm facing issues when importing split_split, when the split has tags.

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.

HerokuX Provider Version

Terraform v1.3.2
on darwin_arm64
+ provider registry.terraform.io/davidji99/split v0.6.2
+ provider registry.terraform.io/hashicorp/aws v4.8.0

Note: I've tested with split v0.7.0, and I'm getting another error, and I will also put a solution in place for that.

Affected Resource(s)

  • split_split

Terraform Configuration Files

resource "split_split" "this" {
  for_each        = var.splits
  workspace_id    = each.value.workspace
  traffic_type_id = each.value.traffic_type
  name            = each.value.name
  description     = each.value.description
}

splits = {
  1 = {
    name          = "name"
    description   = "description"
    workspace     = "workspace_id"
    traffic_type  = "traffic_type_id"
  },

  2 = {
    name          = "name"
    description   = "description"
    workspace     = "workspace_id"
    traffic_type  = "traffic_type_id"
  },
}

Expected Behavior

What should have happened?
The split should be imported

Actual Behavior

What actually happened?
Terraform crashed because of a type error.

Steps to Reproduce

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

  1. Create a split containing tags
  2. Create the terraform code to import it
  3. terraform import <resource_name> <workspace_id>:<split_id>

Important mentions

Tags is being defined as a list of strings, but the response from the API is returning a list of key/value, as I detail:

> curl -X GET \
  -H 'Content-Type:application/json' \
  -H 'Authorization: Bearer <redacted>' \
  https://api.split.io/internal/api/v2/splits/ws/<redacted>/<redacted>
{"id":"<redacted>","name":<redacted>","description":"<redacted>","trafficType":{"id":"<redacted>","name":"<redacted>"},"creationTime":1604662508084,"tags":[{"name":"<redacted>"}],"owners":[{"id":"<redacted>","type":"<redacted>"},{"id":"<redacted>","type":"<redacted>"}]}%  
@bulju
Copy link
Contributor Author

bulju commented Nov 2, 2022

Hi @davidji99 , I'll work on a solution for this, and also add a missing check in checkRateLimit, which should check if response.statusCode is not empty (I got invalid memory address or nil pointer dereference)
Probably tomorrow I'll raise a PR about this 😄

@bulju bulju changed the title Type error on Type error on split tags Nov 2, 2022
@davidji99
Copy link
Owner

Thanks!

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

2 participants