Skip to content

Commit

Permalink
fix: additional_disk space and service_integrations fields import (#1820
Browse files Browse the repository at this point in the history
) (#1846)
  • Loading branch information
rriski authored Oct 8, 2024
1 parent 6961954 commit f7a7a5c
Show file tree
Hide file tree
Showing 24 changed files with 284 additions and 154 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ nav_order: 1
## [MAJOR.MINOR.PATCH] - YYYY-MM-DD

- Remove `aiven_thanos` from beta resources
- Fix `terraform import` for services with additional disk space or read replica service integration

## [4.26.0] - 2024-09-25

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/cassandra.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ resource "aiven_cassandra" "example_cassandra" {
- `disk_space_cap` (String) The maximum disk space of the service, possible values depend on the service type, the cloud provider and the project.
- `disk_space_default` (String) The default disk space of the service, possible values depend on the service type, the cloud provider and the project. Its also the minimum value for `disk_space`
- `disk_space_step` (String) The default disk space step of the service, possible values depend on the service type, the cloud provider and the project. `disk_space` needs to increment from `disk_space_default` by increments of this size.
- `disk_space_used` (String) Disk space that service is currently using
- `disk_space_used` (String, Deprecated) Disk space that service is currently using
- `id` (String) The ID of this resource.
- `service_host` (String) The hostname of the service.
- `service_password` (String, Sensitive) Password used for connecting to the service, if applicable
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/clickhouse.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ resource "aiven_clickhouse" "example_clickhouse" {
- `disk_space_cap` (String) The maximum disk space of the service, possible values depend on the service type, the cloud provider and the project.
- `disk_space_default` (String) The default disk space of the service, possible values depend on the service type, the cloud provider and the project. Its also the minimum value for `disk_space`
- `disk_space_step` (String) The default disk space step of the service, possible values depend on the service type, the cloud provider and the project. `disk_space` needs to increment from `disk_space_default` by increments of this size.
- `disk_space_used` (String) Disk space that service is currently using
- `disk_space_used` (String, Deprecated) Disk space that service is currently using
- `id` (String) The ID of this resource.
- `service_host` (String) The hostname of the service.
- `service_password` (String, Sensitive) Password used for connecting to the service, if applicable
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/dragonfly.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ resource "aiven_dragonfly" "example_dragonfly" {
- `disk_space_cap` (String) The maximum disk space of the service, possible values depend on the service type, the cloud provider and the project.
- `disk_space_default` (String) The default disk space of the service, possible values depend on the service type, the cloud provider and the project. Its also the minimum value for `disk_space`
- `disk_space_step` (String) The default disk space step of the service, possible values depend on the service type, the cloud provider and the project. `disk_space` needs to increment from `disk_space_default` by increments of this size.
- `disk_space_used` (String) Disk space that service is currently using
- `disk_space_used` (String, Deprecated) Disk space that service is currently using
- `id` (String) The ID of this resource.
- `service_host` (String) The hostname of the service.
- `service_password` (String, Sensitive) Password used for connecting to the service, if applicable
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/flink.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ resource "aiven_flink" "example_flink" {
- `disk_space_cap` (String) The maximum disk space of the service, possible values depend on the service type, the cloud provider and the project.
- `disk_space_default` (String) The default disk space of the service, possible values depend on the service type, the cloud provider and the project. Its also the minimum value for `disk_space`
- `disk_space_step` (String) The default disk space step of the service, possible values depend on the service type, the cloud provider and the project. `disk_space` needs to increment from `disk_space_default` by increments of this size.
- `disk_space_used` (String) Disk space that service is currently using
- `disk_space_used` (String, Deprecated) Disk space that service is currently using
- `id` (String) The ID of this resource.
- `service_host` (String) The hostname of the service.
- `service_password` (String, Sensitive) Password used for connecting to the service, if applicable
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/grafana.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ resource "aiven_grafana" "example_grafana" {
- `disk_space_cap` (String) The maximum disk space of the service, possible values depend on the service type, the cloud provider and the project.
- `disk_space_default` (String) The default disk space of the service, possible values depend on the service type, the cloud provider and the project. Its also the minimum value for `disk_space`
- `disk_space_step` (String) The default disk space step of the service, possible values depend on the service type, the cloud provider and the project. `disk_space` needs to increment from `disk_space_default` by increments of this size.
- `disk_space_used` (String) Disk space that service is currently using
- `disk_space_used` (String, Deprecated) Disk space that service is currently using
- `id` (String) The ID of this resource.
- `service_host` (String) The hostname of the service.
- `service_password` (String, Sensitive) Password used for connecting to the service, if applicable
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/kafka.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ resource "aiven_kafka" "example_kafka" {
- `disk_space_cap` (String) The maximum disk space of the service, possible values depend on the service type, the cloud provider and the project.
- `disk_space_default` (String) The default disk space of the service, possible values depend on the service type, the cloud provider and the project. Its also the minimum value for `disk_space`
- `disk_space_step` (String) The default disk space step of the service, possible values depend on the service type, the cloud provider and the project. `disk_space` needs to increment from `disk_space_default` by increments of this size.
- `disk_space_used` (String) Disk space that service is currently using
- `disk_space_used` (String, Deprecated) Disk space that service is currently using
- `id` (String) The ID of this resource.
- `service_host` (String) The hostname of the service.
- `service_password` (String, Sensitive) Password used for connecting to the service, if applicable
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/kafka_connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ resource "aiven_service_integration" "kafka_connect_integration" {
- `disk_space_cap` (String) The maximum disk space of the service, possible values depend on the service type, the cloud provider and the project.
- `disk_space_default` (String) The default disk space of the service, possible values depend on the service type, the cloud provider and the project. Its also the minimum value for `disk_space`
- `disk_space_step` (String) The default disk space step of the service, possible values depend on the service type, the cloud provider and the project. `disk_space` needs to increment from `disk_space_default` by increments of this size.
- `disk_space_used` (String) Disk space that service is currently using
- `disk_space_used` (String, Deprecated) Disk space that service is currently using
- `id` (String) The ID of this resource.
- `service_host` (String) The hostname of the service.
- `service_password` (String, Sensitive) Password used for connecting to the service, if applicable
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/kafka_mirrormaker.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ resource "aiven_kafka_mirrormaker" "mm1" {
- `disk_space_cap` (String) The maximum disk space of the service, possible values depend on the service type, the cloud provider and the project.
- `disk_space_default` (String) The default disk space of the service, possible values depend on the service type, the cloud provider and the project. Its also the minimum value for `disk_space`
- `disk_space_step` (String) The default disk space step of the service, possible values depend on the service type, the cloud provider and the project. `disk_space` needs to increment from `disk_space_default` by increments of this size.
- `disk_space_used` (String) Disk space that service is currently using
- `disk_space_used` (String, Deprecated) Disk space that service is currently using
- `id` (String) The ID of this resource.
- `service_host` (String) The hostname of the service.
- `service_password` (String, Sensitive) Password used for connecting to the service, if applicable
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/m3aggregator.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ resource "aiven_m3aggregator" "m3a" {
- `disk_space_cap` (String) The maximum disk space of the service, possible values depend on the service type, the cloud provider and the project.
- `disk_space_default` (String) The default disk space of the service, possible values depend on the service type, the cloud provider and the project. Its also the minimum value for `disk_space`
- `disk_space_step` (String) The default disk space step of the service, possible values depend on the service type, the cloud provider and the project. `disk_space` needs to increment from `disk_space_default` by increments of this size.
- `disk_space_used` (String) Disk space that service is currently using
- `disk_space_used` (String, Deprecated) Disk space that service is currently using
- `id` (String) The ID of this resource.
- `service_host` (String) The hostname of the service.
- `service_password` (String, Sensitive) Password used for connecting to the service, if applicable
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/m3db.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ resource "aiven_m3db" "example_m3db" {
- `disk_space_cap` (String) The maximum disk space of the service, possible values depend on the service type, the cloud provider and the project.
- `disk_space_default` (String) The default disk space of the service, possible values depend on the service type, the cloud provider and the project. Its also the minimum value for `disk_space`
- `disk_space_step` (String) The default disk space step of the service, possible values depend on the service type, the cloud provider and the project. `disk_space` needs to increment from `disk_space_default` by increments of this size.
- `disk_space_used` (String) Disk space that service is currently using
- `disk_space_used` (String, Deprecated) Disk space that service is currently using
- `id` (String) The ID of this resource.
- `service_host` (String) The hostname of the service.
- `service_password` (String, Sensitive) Password used for connecting to the service, if applicable
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/mysql.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ resource "aiven_mysql" "mysql1" {
- `disk_space_cap` (String) The maximum disk space of the service, possible values depend on the service type, the cloud provider and the project.
- `disk_space_default` (String) The default disk space of the service, possible values depend on the service type, the cloud provider and the project. Its also the minimum value for `disk_space`
- `disk_space_step` (String) The default disk space step of the service, possible values depend on the service type, the cloud provider and the project. `disk_space` needs to increment from `disk_space_default` by increments of this size.
- `disk_space_used` (String) Disk space that service is currently using
- `disk_space_used` (String, Deprecated) Disk space that service is currently using
- `id` (String) The ID of this resource.
- `service_host` (String) The hostname of the service.
- `service_password` (String, Sensitive) Password used for connecting to the service, if applicable
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/opensearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ resource "aiven_opensearch" "os1" {
- `disk_space_cap` (String) The maximum disk space of the service, possible values depend on the service type, the cloud provider and the project.
- `disk_space_default` (String) The default disk space of the service, possible values depend on the service type, the cloud provider and the project. Its also the minimum value for `disk_space`
- `disk_space_step` (String) The default disk space step of the service, possible values depend on the service type, the cloud provider and the project. `disk_space` needs to increment from `disk_space_default` by increments of this size.
- `disk_space_used` (String) Disk space that service is currently using
- `disk_space_used` (String, Deprecated) Disk space that service is currently using
- `id` (String) The ID of this resource.
- `service_host` (String) The hostname of the service.
- `service_password` (String, Sensitive) Password used for connecting to the service, if applicable
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/pg.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ resource "aiven_pg" "example_postgres" {
- `disk_space_cap` (String) The maximum disk space of the service, possible values depend on the service type, the cloud provider and the project.
- `disk_space_default` (String) The default disk space of the service, possible values depend on the service type, the cloud provider and the project. Its also the minimum value for `disk_space`
- `disk_space_step` (String) The default disk space step of the service, possible values depend on the service type, the cloud provider and the project. `disk_space` needs to increment from `disk_space_default` by increments of this size.
- `disk_space_used` (String) Disk space that service is currently using
- `disk_space_used` (String, Deprecated) Disk space that service is currently using
- `id` (String) The ID of this resource.
- `service_host` (String) The hostname of the service.
- `service_password` (String, Sensitive) Password used for connecting to the service, if applicable
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/redis.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ resource "aiven_redis" "redis1" {
- `disk_space_cap` (String) The maximum disk space of the service, possible values depend on the service type, the cloud provider and the project.
- `disk_space_default` (String) The default disk space of the service, possible values depend on the service type, the cloud provider and the project. Its also the minimum value for `disk_space`
- `disk_space_step` (String) The default disk space step of the service, possible values depend on the service type, the cloud provider and the project. `disk_space` needs to increment from `disk_space_default` by increments of this size.
- `disk_space_used` (String) Disk space that service is currently using
- `disk_space_used` (String, Deprecated) Disk space that service is currently using
- `id` (String) The ID of this resource.
- `service_host` (String) The hostname of the service.
- `service_password` (String, Sensitive) Password used for connecting to the service, if applicable
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/static_ip.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "aiven_static_ip Resource - terraform-provider-aiven"
subcategory: ""
description: |-
The aiven_static_ip resource allows the creation and deletion of static ips. Please not that once a static ip is in the 'assigned' state it is bound to the node it is assigned to and cannot be deleted or disassociated until the node is recycled. Plans that would delete static ips that are in the assigned state will be blocked.
The aiven_static_ip resource allows the creation and deletion of static ips. Please note that once a static ip is in the 'assigned' state it is bound to the node it is assigned to and cannot be deleted or disassociated until the node is recycled. Plans that would delete static ips that are in the assigned state will be blocked.
---

# aiven_static_ip (Resource)

The aiven_static_ip resource allows the creation and deletion of static ips. Please not that once a static ip is in the 'assigned' state it is bound to the node it is assigned to and cannot be deleted or disassociated until the node is recycled. Plans that would delete static ips that are in the assigned state will be blocked.
The aiven_static_ip resource allows the creation and deletion of static ips. Please note that once a static ip is in the 'assigned' state it is bound to the node it is assigned to and cannot be deleted or disassociated until the node is recycled. Plans that would delete static ips that are in the assigned state will be blocked.



Expand Down
2 changes: 1 addition & 1 deletion docs/resources/thanos.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Creates and manages an [Aiven for Metrics®](https://aiven.io/docs/products/metr
- `disk_space_cap` (String) The maximum disk space of the service, possible values depend on the service type, the cloud provider and the project.
- `disk_space_default` (String) The default disk space of the service, possible values depend on the service type, the cloud provider and the project. Its also the minimum value for `disk_space`
- `disk_space_step` (String) The default disk space step of the service, possible values depend on the service type, the cloud provider and the project. `disk_space` needs to increment from `disk_space_default` by increments of this size.
- `disk_space_used` (String) Disk space that service is currently using
- `disk_space_used` (String, Deprecated) Disk space that service is currently using
- `id` (String) The ID of this resource.
- `service_host` (String) The hostname of the service.
- `service_password` (String, Sensitive) Password used for connecting to the service, if applicable
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/valkey.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ resource "aiven_valkey" "example_valkey" {
- `disk_space_cap` (String) The maximum disk space of the service, possible values depend on the service type, the cloud provider and the project.
- `disk_space_default` (String) The default disk space of the service, possible values depend on the service type, the cloud provider and the project. Its also the minimum value for `disk_space`
- `disk_space_step` (String) The default disk space step of the service, possible values depend on the service type, the cloud provider and the project. `disk_space` needs to increment from `disk_space_default` by increments of this size.
- `disk_space_used` (String) Disk space that service is currently using
- `disk_space_used` (String, Deprecated) Disk space that service is currently using
- `id` (String) The ID of this resource.
- `service_host` (String) The hostname of the service.
- `service_password` (String, Sensitive) Password used for connecting to the service, if applicable
Expand Down
14 changes: 4 additions & 10 deletions internal/schemautil/custom_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,9 @@ func CustomizeDiffCheckDiskSpace(ctx context.Context, d *schema.ResourceDiff, m
return fmt.Errorf("unable to get service plan parameters: %w", err)
}

var requestedDiskSpaceMB int

if ds, ok := d.GetOk("disk_space"); ok {
requestedDiskSpaceMB = ConvertToDiskSpaceMB(ds.(string))
} else {
if ads, ok := d.GetOk("additional_disk_space"); ok {
requestedDiskSpaceMB = servicePlanParams.DiskSizeMBDefault + ConvertToDiskSpaceMB(ads.(string))
}
requestedDiskSpaceMB, err := getDiskSpaceFromStateOrDiff(ctx, d, client)
if err != nil {
return err
}

if requestedDiskSpaceMB == 0 {
Expand Down Expand Up @@ -103,7 +98,7 @@ func CustomizeDiffCheckDiskSpace(ctx context.Context, d *schema.ResourceDiff, m
}
if servicePlanParams.DiskSizeMBStep != 0 {
if (requestedDiskSpaceMB-servicePlanParams.DiskSizeMBDefault)%servicePlanParams.DiskSizeMBStep != 0 {
return fmt.Errorf("requested disk size has to increase from: '%s' in increments of '%s'", humanReadableDiskSpaceDefault, humanReadableDiskSpaceStep)
return fmt.Errorf("requested disk size has to increase from: '%s' in increments of '%s'. Got: '%s'", humanReadableDiskSpaceDefault, humanReadableDiskSpaceStep, humanReadableRequestedDiskSpace)
}
}
return nil
Expand Down Expand Up @@ -174,7 +169,6 @@ func CustomizeDiffDisallowMultipleManyToOneKeys(_ context.Context, d *schema.Res
return err
}
}

}

return nil
Expand Down
Loading

0 comments on commit f7a7a5c

Please sign in to comment.