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

Bug #832: type attribute of apstra_freeform_resource should be both required and immutable #841

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apstra/freeform/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,9 @@ func (o Resource) ResourceAttributes() map[string]resourceSchema.Attribute {
"type": resourceSchema.StringAttribute{
MarkdownDescription: "type of the Resource, must be one of :\n - `" +
strings.Join(utils.AllFFResourceTypes(), "`\n - `") + "`\n",
Optional: true,
Validators: []validator.String{stringvalidator.OneOf(utils.AllFFResourceTypes()...)},
Required: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
Validators: []validator.String{stringvalidator.OneOf(utils.AllFFResourceTypes()...)},
},
"integer_value": resourceSchema.Int64Attribute{
MarkdownDescription: fmt.Sprintf("Value used by integer type resources (`%s`, `%s`, `%s`, `%s`). "+
Expand Down
16 changes: 8 additions & 8 deletions docs/resources/freeform_resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ output "test_resource_out" { value = data.apstra_freeform_resource.test }
- `blueprint_id` (String) Apstra Blueprint ID.
- `group_id` (String) Group the Resource belongs to.
- `name` (String) Freeform Resource name as shown in the Web UI.

### Optional

- `allocated_from` (String) ID of the node to be used as a source for this resource. This could be an ID of resource allocation group or another resource (in case of IP or Host IP allocations). This also can be empty. In that case it is required that value for this resource is provided by the user.
- `assigned_to` (Set of String) Set of node IDs to which the resource is assigned
- `integer_value` (Number) Value used by integer type resources (`asn`, `integer`, `vlan`, `vni`). Also used by IP prefix resources (`ipv4` and `ipv6`) to indicate the required prefix size for automatic allocations from another object or a resource pool.
- `ipv4_value` (String) Value used by resources with type `ipv4` or `host_ipv4`. Must be CIDR notation.
- `ipv6_value` (String) Value used by resources with type `ipv6` or `host_ipv6`. Must be CIDR notation.
- `type` (String) type of the Resource, must be one of :
- `asn`
- `host_ipv4`
Expand All @@ -74,6 +66,14 @@ output "test_resource_out" { value = data.apstra_freeform_resource.test }
- `vlan`
- `vni`

### Optional

- `allocated_from` (String) ID of the node to be used as a source for this resource. This could be an ID of resource allocation group or another resource (in case of IP or Host IP allocations). This also can be empty. In that case it is required that value for this resource is provided by the user.
- `assigned_to` (Set of String) Set of node IDs to which the resource is assigned
- `integer_value` (Number) Value used by integer type resources (`asn`, `integer`, `vlan`, `vni`). Also used by IP prefix resources (`ipv4` and `ipv6`) to indicate the required prefix size for automatic allocations from another object or a resource pool.
- `ipv4_value` (String) Value used by resources with type `ipv4` or `host_ipv4`. Must be CIDR notation.
- `ipv6_value` (String) Value used by resources with type `ipv6` or `host_ipv6`. Must be CIDR notation.

### Read-Only

- `generator_id` (String) ID of the Generator that created Resource Allocation Group. Always `null` because groups created via resource declaration were not generated.
Expand Down
Loading