@@ -418,6 +418,35 @@ func TestAccImage_sourceFileUnifiedImage(t *testing.T) {
418418 })
419419}
420420
421+ func TestAccImage_alias_blocks (t * testing.T ) {
422+ alias1 := petname .Generate (2 , "-" )
423+ alias2 := petname .Generate (2 , "-" )
424+
425+ resource .Test (t , resource.TestCase {
426+ PreCheck : func () { acctest .PreCheck (t ) },
427+ ProtoV6ProviderFactories : acctest .ProtoV6ProviderFactories ,
428+ Steps : []resource.TestStep {
429+ {
430+ Config : testAccImage_aliasBlocks (alias1 , alias2 ),
431+ Check : resource .ComposeTestCheckFunc (
432+ resource .TestCheckResourceAttr ("incus_image.img1" , "source_image.remote" , "images" ),
433+ resource .TestCheckResourceAttr ("incus_image.img1" , "source_image.name" , "alpine/edge" ),
434+ resource .TestCheckResourceAttr ("incus_image.img1" , "alias.#" , "2" ),
435+ resource .TestCheckTypeSetElemNestedAttrs ("incus_image.img1" , "alias.*" , map [string ]string {
436+ "name" : alias1 ,
437+ "description" : "Test alias 1" ,
438+ }),
439+ resource .TestCheckTypeSetElemNestedAttrs ("incus_image.img1" , "alias.*" , map [string ]string {
440+ "name" : alias2 ,
441+ "description" : "Test alias 2" ,
442+ }),
443+ resource .TestCheckResourceAttr ("incus_image.img1" , "copied_aliases.#" , "0" ),
444+ ),
445+ },
446+ },
447+ })
448+ }
449+
421450func testAccImage_basic () string {
422451 return `
423452resource "incus_image" "img1" {
@@ -746,3 +775,24 @@ resource "incus_image" "from_file" {
746775
747776` , targetData , strings .Join (aliases , `","` ))
748777}
778+
779+ func testAccImage_aliasBlocks (alias1 , alias2 string ) string {
780+ return fmt .Sprintf (`
781+ resource "incus_image" "img1" {
782+ source_image = {
783+ remote = "images"
784+ name = "alpine/edge"
785+ }
786+
787+ alias {
788+ name = "%s"
789+ description = "Test alias 1"
790+ }
791+
792+ alias {
793+ name = "%s"
794+ description = "Test alias 2"
795+ }
796+ }
797+ ` , alias1 , alias2 )
798+ }
0 commit comments