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

shared_image_version not returning "latest" for large image galleries #26343

Open
1 task done
ktower opened this issue Jun 14, 2024 · 3 comments
Open
1 task done

shared_image_version not returning "latest" for large image galleries #26343

ktower opened this issue Jun 14, 2024 · 3 comments
Labels
service/images upstream/go-azure-sdk This issue/PR requires a fix in `hashicorp/go-azure-sdk` v/3.x

Comments

@ktower
Copy link

ktower commented Jun 14, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.5.5

AzureRM Provider Version

3.108.0

Affected Resource(s)/Data Source(s)

azurerm_shared_image_version

Terraform Configuration Files

data "azurerm_shared_image_version" "image_from_gallery" {
  name.               = "latest"
  image_name.         = "my_image_name"
  gallery_name        = "my_gallery"
  resource_group_name = "my_rg"
}

output "image_version" {
  value = data.azurerm_shared_iamge_version.image_from_gallery.name
}

Debug Output/Panic Output

unable to provide at this time in order to prevent disclosure of internal data.

Expected Behaviour

Data source should provide a reference to the "latest" version of the image gallery.

Actual Behaviour

In galleries with large numbers of image versions, the 50th image version is provided.

Example:

$ terraform output image_latest
"2218.0.0"
$ az sig image-version list -g redacted --gallery-name redacted -i redacted -o tsv | wc -l
     154
$ az sig image-version list -g redacted --gallery-name redacted -i redacted -o tsv | head -50 | tail -1 | awk '{print $3}'
2218.0.0
$ az sig image-version list -g redacted --gallery-name redacted -i redacted -o tsv | tail -1 | awk '
{print $3}'
2424.0.0

Steps to Reproduce

Problem appears to manifest in all provider versions >= 3.98. Version 3.97 properly returns the latest image version.

Important Factoids

No response

References

No response

@github-actions github-actions bot added the v/3.x label Jun 14, 2024
@Chambras
Copy link
Contributor

Interesting 3.98.0 is when that part was migrated to use go-azure-sdk

@xuzhang3
Copy link
Contributor

This is a bug of the SDK not handling the paged response correctly, only the first page of the response was handled. The nextLink was ignored.

Response structure:

{
values: [],
nextLink: xxx.
}

but the SDK only handle the value. https://github.com/hashicorp/terraform-provider-azurerm/blob/main/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2022-03-03/galleryimageversions/method_listbygalleryimage.go#L52

@mybayern1974 mybayern1974 added the upstream/go-azure-sdk This issue/PR requires a fix in `hashicorp/go-azure-sdk` label Jun 24, 2024
@xuzhang3
Copy link
Contributor

SDK issue: hashicorp/go-azure-sdk#1026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/images upstream/go-azure-sdk This issue/PR requires a fix in `hashicorp/go-azure-sdk` v/3.x
Projects
None yet
Development

No branches or pull requests

5 participants