Description
Terraform Core Version
2.2.1
ONTAP Provider Version
9.15.1P9
Affected Resource(s)
netapp-ontap_volume
Expected Behavior
Using import I should be able to change space > percent_snapshot_space from 5 to 0.
Actual Behavior
I get an error when trying to apply the above terraform.
Error: Provider produced inconsistent result after apply
│
│ When applying changes to netapp-ontap_volume.example, provider
│ "provider["registry.terraform.io/netapp/netapp-ontap"]" produced an unexpected new value:
│ .space.percent_snapshot_space: was cty.NumberIntVal(0), but now cty.NumberIntVal(5).
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
Relevant Error/Panic Output Snippet
Error: Provider produced inconsistent result after apply
│
│ When applying changes to netapp-ontap_volume.example, provider
│ "provider[\"registry.terraform.io/netapp/netapp-ontap\"]" produced an unexpected new value:
│ .space.percent_snapshot_space: was cty.NumberIntVal(0), but now cty.NumberIntVal(5).
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
Terraform Configuration Files
Steps to Reproduce
This is what I did.
In order to use ONTAP Terraform on a volume that was created using AWS Terraform I did the following steps.
Created a volume import in my main.tf
provider "netapp-ontap" {
A connection profile defines how to interface with an ONTAP cluster or svm.
At least one is required.
connection_profiles = [
{
name = var.clus_name
hostname = var.hostname
username = jsondecode(data.aws_secretsmanager_secret_version.ontap_username_pass.secret_string)["username"]
password = jsondecode(data.aws_secretsmanager_secret_version.ontap_username_pass.secret_string)["password"]
validate_certs = "false"
}
]
}
data "netapp-ontap_volume" "storage_volume" {
cx_profile_name = var.clus_name
name = var.vol1_name
svm_name = var.svm_name
}
locals {
concatenated_id = "${var.vol1_name},${var.svm_name},${var.clus_name}"
}
import {
to = netapp-ontap_volume.example
id = local.concatenated_id
}
Then ran: terraform plan -generate-config-out=generated.tf
This created the following generated.tf file.
generated by Terraform
Please review these resources and move them into your main configuration files.
generated by Terraform from "rvwn_int_vol1,fsx,cluster1"
resource "netapp-ontap_volume" "example" {
aggregates = [
{
name = "aggr1"
},
]
analytics = {
state = "off"
}
comment = null
cx_profile_name = "cluster1"
efficiency = {
compression = "none"
policy_name = "auto"
}
encryption = false
language = "c.utf_8"
name = "rvwn_int_vol1"
nas = {
export_policy_name = "default"
group_id = 0
junction_path = "/rvwn_int_vol1"
security_style = "unix"
unix_permissions = 755
user_id = 0
}
qos_policy_group = null
snaplock = {
type = "non_snaplock"
}
snapshot_policy = "default"
space = {
logical_space = {
enforcement = false
reporting = false
}
percent_snapshot_space = 5
size = 200
size_unit = "gb"
}
space_guarantee = "none"
state = "online"
svm_name = "fsx"
tiering = {
minimum_cooling_days = 31
policy_name = "auto"
}
type = "rw"
}
I then changed the values in the generated.tf that I wanted to be different (e.g. percent_snapshot_space = 0)
Next I ran terraform apply (note that the generated.tf is in my directory so it picked it up).
Apply snippet:
~ space = {
logical_space = {
enforcement = false
reporting = false
}
~ percent_snapshot_space = 5 -> 0
size = 200
size_unit = "gb"
}
space_guarantee = "none"
state = "online"
svm_name = "fsx"
tiering = {
minimum_cooling_days = 31
policy_name = "auto"
}
type = "rw"
}
Plan: 1 to import, 0 to add, 1 to change, 0 to destroy.
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
I used the steps for import from the volume documentation page.
This requires Terraform 1.5 or higher, and will auto create the configuration for you
First create the block
import {
to = netapp-ontap_volume.volume_import
id = "svm1_root,svm1,cluster4"
}
terraform plan -generate-config-out=generated.tf
Would you like to implement a fix?
None
Metadata
Metadata
Assignees
Labels
Type
Projects
Status