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

schema ResourceData Set does not work for nested types like TypeList #670

Closed
DavidGOrtega opened this issue Dec 22, 2020 · 3 comments
Closed
Labels
bug Something isn't working subsystem/types Issues and feature requests related to the type system of Terraform and our shims around it.

Comments

@DavidGOrtega
Copy link

SDK version

github.com/hashicorp/terraform-plugin-sdk/v2 v2.4.0

Relevant provider source code

d.Set("machine.0.custom_data", customData)

Terraform Configuration Files

resource "runner" "runner-az" {
    token = "arszDpb3xtNdKaXmQ6vN"
    repo = "https://gitlab.com/DavidGOrtega/3_tensorboard"
    driver = "gitlab"
    labels = "tf"
    machine {
      cloud = "azure"
      region = "us-west"
      instance_type = "m"
    }
} 

Debug Output

Expected Behavior

Data should contain the given customData

Actual Behavior

Totally ignored

References

@DavidGOrtega DavidGOrtega added the bug Something isn't working label Dec 22, 2020
@DavidGOrtega DavidGOrtega changed the title schema ResourceData does not work for nested types like TypeList schema ResourceData Set does not work for nested types like TypeList Dec 22, 2020
@paddycarver paddycarver added the subsystem/types Issues and feature requests related to the type system of Terraform and our shims around it. label Jan 6, 2021
@paddycarver
Copy link
Contributor

@DavidGOrtega have you checked the error return from d.Set? Are you sure it's not returning an error?

@bflad
Copy link
Contributor

bflad commented Mar 21, 2022

Hi @DavidGOrtega 👋 As mentioned above, catching the returned error from the (*ResourceData).Set() call, e.g.

if err := d.Set("machine.0.custom_data", customData); err != nil {
  // return fmt.Errorf("unable to set machine custom_data: %w", err) // if using non-context-aware CRUD functions
  return diag.Errorf("unable to set machine custom_data: %w", err)
}

Should yield more information about any issues while writing state data. If you have any questions or further information to provide, such as the error output, please create a new issue and we can take a fresh look. 👍

@bflad bflad closed this as completed Mar 21, 2022
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working subsystem/types Issues and feature requests related to the type system of Terraform and our shims around it.
Projects
None yet
Development

No branches or pull requests

3 participants