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

Facilitate providing a list of tags in data_source_openstack_images_image_v2 #1462

Conversation

RickyGrassmuck
Copy link
Contributor

The current implementation of data_source_openstack_images_image_v20 only allows for setting a single tag attribute while the API is able to accept a list of tags to filter on.

This change allows users to directly set the tags attribute to a list of tags in their data source block while maintaining backwards compatibility with the existing tag attribute. If both are provided, the singular tag is simply added to the tags attribute before being added to the ListOpts.

Examples

Original Syntax

data "openstack_images_image_v2" "image_1" {
  tag   = "cirros-tf_1"
}

New Syntax with tags attribute

data "openstack_images_image_v2" "ubuntu" {
  tags = ["cirros-tf_1"]
}

New Syntax using both tag and tags attribute

data "openstack_images_image_v2" "ubuntu" {
  tag   = "cirros-tf_1"
  tags = ["cirros-tf_1"]
}

I've added an additional acceptance test as well to account for being able to specify the tags attribute in the data source.

Allow for users to directly set the `tags` list attribute without breaking the
existing use of the single string only `tag` attribute
Add description for the `tags` argument
Copy link
Member

@nikParasyr nikParasyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RickyGrassmuck Thanks for the PR. It looks good to me, just the minor linting error to fix

Copy link
Contributor Author

@RickyGrassmuck RickyGrassmuck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested changes added

@nikParasyr nikParasyr merged commit 160ae31 into terraform-provider-openstack:main Dec 15, 2022
rossengeorgiev added a commit to rossengeorgiev/terraform-provider-openstack that referenced this pull request Dec 22, 2022
nikParasyr pushed a commit that referenced this pull request Dec 22, 2022
rossengeorgiev added a commit to rossengeorgiev/terraform-provider-openstack that referenced this pull request Dec 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants