ionos-cloud / terraform-provider-ionoscloud

The IonosCloud Terraform provider gives the ability to deploy and configure resources using the IonosCloud APIs.
Mozilla Public License 2.0
35 stars 24 forks source link

Removing s3_buckets in k8s_cluster does not get noticed #326

Closed henninge closed 2 years ago

henninge commented 2 years ago

Description

Removing an s3_buckets block from an ionoscloud_k8s_cluster resource does not trigger a change.

Only an empty s3_buckets block will trigger a change.

Expected behavior

Removing the s3_buckets block should trigger a change, removing the bucket configuration from the cluster.

Environment

Terraform, provider version, os:

$ terraform version
Terraform v1.3.3
on darwin_amd64
+ provider registry.terraform.io/ionos-cloud/ionoscloud v6.3.2

Configuration Files

terraform {
  required_version = "1.3.3"
  required_providers {
    ionoscloud = {
      source  = "ionos-cloud/ionoscloud"
      version = "6.3.2"
    }
  }
}

resource "ionoscloud_k8s_cluster" "this" {
  name        = "testing-the-s3-buckets"
  k8s_version = "1.23.9"

  s3_buckets {
    name = "my-audit-logs-bucket"
  }
}

How to Reproduce

  1. In DCD create a bucket and put its name in the s3_buckets block.
  2. TF-apply the config using the same credentials.
  3. Remove/comment out the s3_buckets block.
  4. TF-plan the config -> NO changes detected.
  5. Remove/comment out just the content of the s3_buckets block.
  6. TF-plan the config -> removal is detected.

Additional Notes

I have no experience writing TF providers but the relevant code might be after this line. https://github.com/ionos-cloud/terraform-provider-ionoscloud/blob/master/ionoscloud/resource_k8s_cluster.go#L341

cristiGuranIonos commented 2 years ago

Thanks, we'll take a look at it.

gabriel-savu commented 2 years ago

Hello, I fixed the issue and it will be available with the new 6.3.3 terraform ionoscloud provider verion release