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

Exactly one of allocated_from and integer_value must be set when type is set to "integer" for 'apstra_freeform_resource' #828

Open
ihadi581 opened this issue Aug 28, 2024 · 5 comments

Comments

@ihadi581
Copy link

if using apstra 0.68.2-0.68.3, this issue not facing but after upgrade with new version provider issue facing.

this tf file

resource "apstra_freeform_resource" "vni_dc1_2" {
  blueprint_id  = apstra_freeform_blueprint.dc1.id
  name          = "vni"
  type          = "integer"
  group_id      = apstra_freeform_resource_group.Internet_400.id
  allocated_from = apstra_freeform_allocation_group.vni_allocation.id
  integer_value = "400"
}

output :

terraform plan 
╷
│ Error: invalid configuration
│ 
│   with apstra_freeform_resource.vni_dc1_2,
│   on vlans-generate.tf line 65, in resource "apstra_freeform_resource" "vni_dc1_2":
│   65: resource "apstra_freeform_resource" "vni_dc1_2" {
│ 
│ Exactly one of `allocated_from` and `integer_value` must be set when `type` is set to "integer"
╵

which we expect we can add manual integer value of allocated data, because apstra UI can use this method, to adopt flexibility

@bwJuniper
Copy link
Collaborator

We don't exactly copy the GUI in all terraform resources. In this case if you want to specify a value and not use a generated resource, you will need to remove the resource generator from the resource specification.

@ihadi581
Copy link
Author

ihadi581 commented Aug 28, 2024

can make allocated_from optional mode ?

@bwJuniper
Copy link
Collaborator

The code is not written that way. We would have to rewrite the code. There should be no reason to specify allocated from if you want to manually set the resource.

@chrismarget-j
Copy link
Collaborator

@bwJuniper I thought we tested this, and found that when specifying both an "allocated_from" and an "override" value, that the value was not pulled from the "allocated_from" ... thing.

But I've just tested it (with an integer pool), and found that the integer pool had one fewer integers after I created the resource, so long as the "override" value was within range.

We may need to revisit these experiments.

@bwJuniper
Copy link
Collaborator

Certainly can re-visit. We made simple choices to get the functionality out. We can make it more complex. I like to keep things simple but if there is a use case/reason then I am up for it.

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

3 participants