-
Notifications
You must be signed in to change notification settings - Fork 240
Open
Labels
bugSomething isn't workingSomething isn't working
Description
SDK version
v2.37.0
Relevant provider source code
func resourceNsxtTest() *schema.Resource {
return &schema.Resource{
Create: resourceNsxtDummyCreate,
Read: resourceNsxtDummy,
Update: resourceNsxtDummy,
Delete: resourceNsxtDummy,
Schema: map[string]*schema.Schema{
"test_computed": {
Type: schema.TypeString,
Computed: true,
},
"test_string": {
Type: schema.TypeString,
Optional: true,
},
"test_list": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"test_struct_list": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"test_string": {
Type: schema.TypeString,
Optional: true,
},
"test_list": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
},
},
},
}
}
Terraform Configuration Files
starting config
resource "nsxt_test" "test" {
test_string = "some string"
test_struct_list {
test_string = "some nested string"
}
}
update config
resource "nsxt_test" "parent" {
test_string = "parent"
}
resource "nsxt_test" "test" {
test_string = "some string"
test_struct_list {
test_list = [nsxt_test.parent.test_computed]
test_string = "some nested string"
}
}
Debug Output
https://gist.github.com/annakhm/1d20ea8d36124c5e0b95a9389331884d
Expected Behavior
plan should detect 1 new resource (nsxt_test.parent) and change in 1 resource (nsxt_test.test)
Actual Behavior
plan only detects 1 new resource (nsxt_test.parent)
Steps to Reproduce
- compile terraform provider nsxt from branch https://github.com/vmware/terraform-provider-nsxt/tree/sdk-bug-demo
- configure one resource
resource "nsxt_test" "test" {
test_string = "some string"
test_struct_list {
test_string = "some nested string"
}
}
terraform apply
- resource gets created- change config to
resource "nsxt_test" "parent" {
test_string = "parent"
}
resource "nsxt_test" "test" {
test_string = "some string"
test_struct_list {
test_list = [nsxt_test.parent.test_computed]
test_string = "some nested string"
}
}
- terraform plan
Notes
- The issue does not happen with terraform plugin framework. I've coded a similar resource and it works as expected (code available upon request). This leads me to believe the issue is in the SDK and not terraform core.
- The issue only happens with schema where list attribute is defined under nested block. It works as expected for top-level list attribute, and also for nested string attribute.
- I've created a simple demo resource for the issue based on an actual use case for the issue (more complex resource) in nsxt provider
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working