Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

diff.GetOk return nil for the value of TypeList defined in TypeSet #1197

Open
ms-zhenhua opened this issue May 16, 2023 · 1 comment · May be fixed by #1195
Open

diff.GetOk return nil for the value of TypeList defined in TypeSet #1197

ms-zhenhua opened this issue May 16, 2023 · 1 comment · May be fixed by #1195
Labels
bug Something isn't working

Comments

@ms-zhenhua
Copy link

SDK version

v2.26.1

Relevant provider source code

{
Schema: map[string]*pluginsdk.Schema{
...
    "prop_set": {
	    Type:     pluginsdk.TypeSet,
	    Elem: &pluginsdk.Resource{
		    Schema: map[string]*pluginsdk.Schema{
			    ...
    
			    "prop_list": {
				    Type:     pluginsdk.TypeList,
				    Elem: &pluginsdk.Schema{
					    Type: pluginsdk.TypeString,
				    },
			    },
		    },
	    },
    },
...
},

...

CustomizeDiff: pluginsdk.CustomizeDiffShim(func(ctx context.Context, diff *pluginsdk.ResourceDiff, v interface{}) error {
...
    value, _ := diff.GetOk("prop_set")
...
}

...
}

Terraform Configuration Files

prop_set {
    ...
    prop_list = ["element-1"]
   ...
  }

Debug Output

Expected Behavior

diff.GetOk should return a prop_list with length=1 and the value is element-1

Actual Behavior

diff.GetOk should return a prop_list with length=1 and the value is nil

Steps to Reproduce

1. `terraform init`
2. `terraform apply`

References

@ms-zhenhua ms-zhenhua added the bug Something isn't working label May 16, 2023
@BBBmau
Copy link
Contributor

BBBmau commented Sep 14, 2023

Adding to this since this seems like a similar issue to the one that I'm currently facing when working on the Kubernetes Provider

hashicorp/terraform-provider-kubernetes#2286

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants