Extend network resource fields (#576)

* deprecate nameservers filed

* onboard routed field

* onboard new ipv4 fields

* onboard new ipv6 fields

* update examples

* update examples

* update examples

* remove nameserver(deprecated) mapping

* make fields computed

* Revert "remove nameserver(deprecated) mapping"

This reverts commit e4bf1dc184289f3bddc10c5d3b2320966b529649.

* remove routed from update payload (not yet supported)

* Update docs/resources/network.md

Co-authored-by: João Palet <joao.palet@outlook.com>

* Update stackit/internal/services/iaas/network/resource.go

Co-authored-by: João Palet <joao.palet@outlook.com>

* fix the field descriptions

* remove ipv6 from examples

* use nameservers as rollback value to support deprecated field

* extend acceptance tests

* add condition that nameserver and ipv4_nameserver cannot be provided at the same time

* extend acc test

* improve conditions in create payload

* adapt modify plan to support update and delete operations

* fix acceptance test

* deprecate prefixes and create ipv4_prefixes field

* fix unit tests

* fix update issues

* fix linter issues

* extend modifyPlan condition

* add validateConfig function

* Update stackit/internal/services/iaas/network/resource.go

Co-authored-by: João Palet <joao.palet@outlook.com>

* Update stackit/internal/services/iaas/network/resource.go

Co-authored-by: João Palet <joao.palet@outlook.com>

* update descriptions

* Update stackit/internal/services/iaas/network/resource.go

Co-authored-by: João Palet <joao.palet@outlook.com>

* Update stackit/internal/services/iaas/network/resource.go

Co-authored-by: João Palet <joao.palet@outlook.com>

* implement no_gateway field and condition check

* implement no_ipv6_gateway field and condition check

* update examples

* update examples and descriptions

* fix linter issues

* Update stackit/internal/services/iaas/network/resource.go

Co-authored-by: João Palet <joao.palet@outlook.com>

* adapt descriptions

* apply acceptance comments

* adapt conditions in create and update

* add plan modifiers

* add requiresReplace

---------

Co-authored-by: João Palet <joao.palet@outlook.com>
This commit is contained in:
GokceGK 2024-11-19 15:25:56 +01:00 committed by GitHub
parent 3ac1d50253
commit b1fb9ab9b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 857 additions and 60 deletions

View file

@ -107,16 +107,58 @@ func (d *networkDataSource) Schema(_ context.Context, _ datasource.SchemaRequest
},
},
"nameservers": schema.ListAttribute{
Description: "The nameservers of the network.",
Description: "The nameservers of the network. This field is deprecated and will be removed soon, use `ipv4_nameservers` to configure the nameservers for IPv4.",
DeprecationMessage: "Use `ipv4_nameservers` to configure the nameservers for IPv4.",
Computed: true,
ElementType: types.StringType,
},
"ipv4_gateway": schema.StringAttribute{
Description: "The IPv4 gateway of a network. If not specified, the first IP of the network will be assigned as the gateway.",
Computed: true,
},
"ipv4_nameservers": schema.ListAttribute{
Description: "The IPv4 nameservers of the network.",
Computed: true,
ElementType: types.StringType,
},
"ipv4_prefix": schema.StringAttribute{
Description: "The IPv4 prefix of the network (CIDR).",
Computed: true,
},
"ipv4_prefix_length": schema.Int64Attribute{
Description: "The IPv4 prefix length of the network.",
Computed: true,
},
"prefixes": schema.ListAttribute{
Description: "The prefixes of the network.",
Description: "The prefixes of the network. This field is deprecated and will be removed soon, use `ipv4_prefixes` to read the prefixes of the IPv4 networks.",
DeprecationMessage: "Use `ipv4_prefixes` to read the prefixes of the IPv4 networks.",
Computed: true,
ElementType: types.StringType,
},
"ipv4_prefixes": schema.ListAttribute{
Description: "The IPv4 prefixes of the network.",
Computed: true,
ElementType: types.StringType,
},
"ipv6_gateway": schema.StringAttribute{
Description: "The IPv6 gateway of a network. If not specified, the first IP of the network will be assigned as the gateway.",
Computed: true,
},
"ipv6_nameservers": schema.ListAttribute{
Description: "The IPv6 nameservers of the network.",
Computed: true,
ElementType: types.StringType,
},
"ipv6_prefix": schema.StringAttribute{
Description: "The IPv6 prefix of the network (CIDR).",
Computed: true,
},
"ipv6_prefix_length": schema.Int64Attribute{
Description: "The IPv6 prefix length of the network.",
Computed: true,
},
"ipv6_prefixes": schema.ListAttribute{
Description: "The IPv6 prefixes of the network.",
Computed: true,
ElementType: types.StringType,
},
@ -129,6 +171,10 @@ func (d *networkDataSource) Schema(_ context.Context, _ datasource.SchemaRequest
ElementType: types.StringType,
Computed: true,
},
"routed": schema.BoolAttribute{
Description: "Shows if the network is routed and therefore accessible from other networks.",
Computed: true,
},
},
}
}