Skip to content

Commit

Permalink
Merge pull request #841 from Juniper/bug/832-ff-resource-type-attribute
Browse files Browse the repository at this point in the history
Bug #832: `type` attribute of `apstra_freeform_resource` should be both required and immutable
  • Loading branch information
chrismarget-j authored Aug 30, 2024
2 parents 5682a78 + 2f84455 commit f15daa3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
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

0 comments on commit f15daa3

Please sign in to comment.