Open
Description
Describe the bug
When interacting with Resources that have immutable fields, the resource schema as defined in the Terraform provider should mark those as ForceNew: true
to force the provider to create a new resource in the event that the field changes.
Reproduction steps
- Define a resource with an immutable field
- Run
terraform apply
to provision resource - Modify the immutable field, in this instance
is_federated
- Run
terraform apply
to see the error
terraform {
required_providers {
avi = {
source = "vmware/avi"
version = "=30.2.2"
}
}
}
provider "avi" {
avi_username = "USER"
avi_password = "PSSWORD"
avi_controller = "avlbcontroller.contoso.com"
avi_tenant = "admin"
avi_version = "30.2.2"
}
resource "avi_sslprofile" "foo" {
name = "ssl-profile"
is_federated = "false"
type = "SSL_PROFILE_TYPE_APPLICATION"
accepted_versions {
type = "SSL_VERSION_TLS1_2"
}
accepted_versions {
type = "SSL_VERSION_TLS1_3"
}
ssl_rating {
compatibility_rating = "SSL_SCORE_GOOD"
performance_rating = "SSL_SCORE_EXCELLENT"
security_score = "100"
}
}
Expected behavior
The AVI Terraform Provider should detect that this is an immutable field and mark the resource as ForceNew
, forcing the provider to create a new resource when that field changes.
Careful consideration should be noted in documentation that the user will likely want to specify create_before_destroy = false
on the resource as naming is unique on the controller.
Additional context
Environment:
- Terraform v1.8.0
- terraform-provider-avi v30.2.2
- AVI 30.2.2