diff --git a/docs/guides/mve_aruba.md b/docs/guides/mve_aruba.md index ddab384..667d382 100644 --- a/docs/guides/mve_aruba.md +++ b/docs/guides/mve_aruba.md @@ -24,6 +24,11 @@ data "megaport_location" "bne_nxt1" { name = "NextDC B1" } +data "megaport_mve_images" "aruba" { + vendor_filter = "Aruba" + id_filter = 23 +} + resource "megaport_mve" "mve" { product_name = "Megaport MVE Example" location_id = data.megaport_location.bne_nxt1.id @@ -44,7 +49,7 @@ resource "megaport_mve" "mve" { vendor_config = { vendor = "aruba" product_size = "MEDIUM" - image_id = 23 + image_id = data.megaport_mve_images.aruba.mve_images.0.id account_name = "Aruba Test Account" account_key = "12345678" system_tag = "Preconfiguration-aruba-test-1" diff --git a/docs/guides/mve_versa.md b/docs/guides/mve_versa.md index 5756d0e..4cff7fb 100644 --- a/docs/guides/mve_versa.md +++ b/docs/guides/mve_versa.md @@ -24,6 +24,11 @@ data "megaport_location" "bne_nxt1" { name = "NextDC B1" } +data "megaport_mve_images" "versa" { + vendor_filter = "Versa" + id_filter = 20 +} + resource "megaport_mve" "mve" { product_name = "Megaport Versa MVE Example" location_id = data.megaport_location.bne_nxt1.id @@ -32,7 +37,7 @@ resource "megaport_mve" "mve" { vendor_config = { vendor = "versa" product_size = "LARGE" - image_id = 20 + image_id = data.megaport_mve_images.versa.mve_images.0.id director_address = "director1.versa.com" controller_address = "controller1.versa.com" local_auth = "SDWAN-Branch@Versa.com" diff --git a/docs/guides/vxc_mve_aws.md b/docs/guides/vxc_mve_aws.md index d4bcbff..c8f5155 100644 --- a/docs/guides/vxc_mve_aws.md +++ b/docs/guides/vxc_mve_aws.md @@ -39,6 +39,11 @@ data "megaport_partner" "aws_port" { location_id = data.megaport_location.syd_gs.id } +data "megaport_mve_images" "aruba" { + vendor_filter = "Aruba" + id_filter = 23 +} + resource "megaport_port" "port" { product_name = "Megaport Example Port" port_speed = 1000 @@ -65,7 +70,7 @@ resource "megaport_mve" "mve" { vendor_config = { vendor = "aruba" product_size = "MEDIUM" - image_id = 23 + image_id = data.megaport_mve_images.aruba.mve_images.0.id account_name = "Megaport Aruba MVE" account_key = "Megaport Aruba MVE" system_tag = "Preconfiguration-aruba-test-1" diff --git a/docs/guides/vxc_transit.md b/docs/guides/vxc_transit.md index 055e6ef..07bf714 100644 --- a/docs/guides/vxc_transit.md +++ b/docs/guides/vxc_transit.md @@ -28,6 +28,11 @@ data "megaport_location" "syd_gs" { name = "Global Switch Sydney West" } +data "megaport_mve_images" "aruba" { + vendor_filter = "Aruba" + id_filter = 23 +} + data "megaport_partner" "internet_port" { connect_type = "TRANSIT" company_name = "Networks" @@ -64,7 +69,7 @@ resource "megaport_mve" "mve" { vendor_config = { vendor = "aruba" product_size = "MEDIUM" - image_id = 23 + image_id = data.megaport_mve_images.aruba.mve_images.0.id account_name = "Megaport Aruba MVE" account_key = "Megaport Aruba MVE" system_tag = "Preconfiguration-aruba-test-1" diff --git a/docs/resources/mve.md b/docs/resources/mve.md index 37d9cc9..790359b 100644 --- a/docs/resources/mve.md +++ b/docs/resources/mve.md @@ -13,6 +13,11 @@ Megaport Virtual Edge (MVE) Resource for Megaport Terraform provider. This resou ## Example Usage ```terraform +data "megaport_mve_images" "aruba" { + vendor_filter = "Aruba" + id_filter = 23 +} + resource "megaport_mve" "mve" { product_name = "Megaport MVE Example" location_id = 6 @@ -33,7 +38,7 @@ resource "megaport_mve" "mve" { vendor_config = { vendor = "aruba" product_size = "MEDIUM" - image_id = 23 + image_id = data.megaport_mve_images.aruba.mve_images.0.id account_name = "Aruba Test Account" account_key = "12345678" system_tag = "Preconfiguration-aruba-test-1" diff --git a/examples/data-sources/megaport_mve_image/data-source.tf b/examples/data-sources/megaport_mve_image/data-source.tf new file mode 100644 index 0000000..803297b --- /dev/null +++ b/examples/data-sources/megaport_mve_image/data-source.tf @@ -0,0 +1,4 @@ +data "megaport_mve_images" "aruba" { + vendor_filter = "Aruba" + id_filter = 23 +} \ No newline at end of file diff --git a/examples/mve_aruba/mve_aruba.tf b/examples/mve_aruba/mve_aruba.tf index cc7f7cb..66c7a3a 100644 --- a/examples/mve_aruba/mve_aruba.tf +++ b/examples/mve_aruba/mve_aruba.tf @@ -9,6 +9,11 @@ data "megaport_location" "bne_nxt1" { name = "NextDC B1" } +data "megaport_mve_images" "aruba" { + vendor_filter = "Aruba" + id_filter = 23 +} + resource "megaport_mve" "mve" { product_name = "Megaport MVE Example" location_id = data.megaport_location.bne_nxt1.id @@ -29,7 +34,7 @@ resource "megaport_mve" "mve" { vendor_config = { vendor = "aruba" product_size = "MEDIUM" - image_id = 23 + image_id = data.megaport_mve_images.aruba.mve_images.0.id account_name = "Aruba Test Account" account_key = "12345678" system_tag = "Preconfiguration-aruba-test-1" diff --git a/examples/mve_versa/mve_versa.tf b/examples/mve_versa/mve_versa.tf index 36facc2..384530a 100644 --- a/examples/mve_versa/mve_versa.tf +++ b/examples/mve_versa/mve_versa.tf @@ -9,6 +9,11 @@ data "megaport_location" "bne_nxt1" { name = "NextDC B1" } +data "megaport_mve_images" "versa" { + vendor_filter = "Versa" + id_filter = 20 +} + resource "megaport_mve" "mve" { product_name = "Megaport Versa MVE Example" location_id = data.megaport_location.bne_nxt1.id @@ -17,7 +22,7 @@ resource "megaport_mve" "mve" { vendor_config = { vendor = "versa" product_size = "LARGE" - image_id = 20 + image_id = data.megaport_mve_images.versa.mve_images.0.id director_address = "director1.versa.com" controller_address = "controller1.versa.com" local_auth = "SDWAN-Branch@Versa.com" diff --git a/examples/resources/megaport_mve/resource.tf b/examples/resources/megaport_mve/resource.tf index 4df3a58..937adc6 100644 --- a/examples/resources/megaport_mve/resource.tf +++ b/examples/resources/megaport_mve/resource.tf @@ -1,3 +1,8 @@ +data "megaport_mve_images" "aruba" { + vendor_filter = "Aruba" + id_filter = 23 +} + resource "megaport_mve" "mve" { product_name = "Megaport MVE Example" location_id = 6 @@ -18,7 +23,7 @@ resource "megaport_mve" "mve" { vendor_config = { vendor = "aruba" product_size = "MEDIUM" - image_id = 23 + image_id = data.megaport_mve_images.aruba.mve_images.0.id account_name = "Aruba Test Account" account_key = "12345678" system_tag = "Preconfiguration-aruba-test-1" diff --git a/examples/vxc_mve_aws/vxc_mve_aws.tf b/examples/vxc_mve_aws/vxc_mve_aws.tf index 1177e04..093fe4e 100644 --- a/examples/vxc_mve_aws/vxc_mve_aws.tf +++ b/examples/vxc_mve_aws/vxc_mve_aws.tf @@ -24,6 +24,11 @@ data "megaport_partner" "aws_port" { location_id = data.megaport_location.syd_gs.id } +data "megaport_mve_images" "aruba" { + vendor_filter = "Aruba" + id_filter = 23 +} + resource "megaport_port" "port" { product_name = "Megaport Example Port" port_speed = 1000 @@ -50,7 +55,7 @@ resource "megaport_mve" "mve" { vendor_config = { vendor = "aruba" product_size = "MEDIUM" - image_id = 23 + image_id = data.megaport_mve_images.aruba.mve_images.0.id account_name = "Megaport Aruba MVE" account_key = "Megaport Aruba MVE" system_tag = "Preconfiguration-aruba-test-1" diff --git a/examples/vxc_mve_transit/vxc_mve_transit.tf b/examples/vxc_mve_transit/vxc_mve_transit.tf index fd996c1..acc5e9d 100644 --- a/examples/vxc_mve_transit/vxc_mve_transit.tf +++ b/examples/vxc_mve_transit/vxc_mve_transit.tf @@ -13,6 +13,11 @@ data "megaport_location" "syd_gs" { name = "Global Switch Sydney West" } +data "megaport_mve_images" "aruba" { + vendor_filter = "Aruba" + id_filter = 23 +} + data "megaport_partner" "internet_port" { connect_type = "TRANSIT" company_name = "Networks" @@ -49,7 +54,7 @@ resource "megaport_mve" "mve" { vendor_config = { vendor = "aruba" product_size = "MEDIUM" - image_id = 23 + image_id = data.megaport_mve_images.aruba.mve_images.0.id account_name = "Megaport Aruba MVE" account_key = "Megaport Aruba MVE" system_tag = "Preconfiguration-aruba-test-1" diff --git a/internal/provider/mve_resource_test.go b/internal/provider/mve_resource_test.go index dc9c711..b3ed70b 100644 --- a/internal/provider/mve_resource_test.go +++ b/internal/provider/mve_resource_test.go @@ -38,6 +38,12 @@ func (suite *MVEArubaProviderTestSuite) TestAccMegaportMVEAruba_Basic() { data "megaport_location" "test_location" { name = "%s" } + + data "megaport_mve_images" "aruba" { + vendor_filter = "Aruba" + id_filter = 23 + } + resource "megaport_mve" "mve" { product_name = "%s" location_id = data.megaport_location.test_location.id @@ -48,7 +54,7 @@ func (suite *MVEArubaProviderTestSuite) TestAccMegaportMVEAruba_Basic() { vendor_config = { vendor = "aruba" product_size = "MEDIUM" - image_id = 23 + image_id = data.megaport_mve_images.aruba.mve_images.0.id account_name = "%s" account_key = "%s" system_tag = "Preconfiguration-aruba-test-1" @@ -113,6 +119,10 @@ func (suite *MVEArubaProviderTestSuite) TestAccMegaportMVEAruba_Basic() { data "megaport_location" "test_location" { name = "%s" } + data "megaport_mve_images" "aruba" { + vendor_filter = "Aruba" + id_filter = 23 + } resource "megaport_mve" "mve" { product_name = "%s" cost_centre = "%s" @@ -123,7 +133,7 @@ func (suite *MVEArubaProviderTestSuite) TestAccMegaportMVEAruba_Basic() { vendor_config = { vendor = "aruba" product_size = "MEDIUM" - image_id = 23 + image_id = data.megaport_mve_images.aruba.mve_images.0.id account_name = "%s" account_key = "%s" system_tag = "Preconfiguration-aruba-test-1" @@ -179,6 +189,12 @@ func (suite *MVEVersaProviderTestSuite) TestAccMegaportMVEVersa_Basic() { data "megaport_location" "test_location" { name = "%s" } + + data "megaport_mve_images" "versa" { + vendor_filter = "Versa" + id_filter = 20 + } + resource "megaport_mve" "mve" { product_name = "%s" location_id = data.megaport_location.test_location.id @@ -189,7 +205,7 @@ func (suite *MVEVersaProviderTestSuite) TestAccMegaportMVEVersa_Basic() { vendor_config = { vendor = "versa" product_size = "LARGE" - image_id = 20 + image_id = data.megaport_mve_images.versa.mve_images.0.id director_address = "director1.versa.com" controller_address = "controller1.versa.com" local_auth = "SDWAN-Branch@Versa.com" @@ -256,6 +272,12 @@ func (suite *MVEVersaProviderTestSuite) TestAccMegaportMVEVersa_Basic() { data "megaport_location" "test_location" { name = "%s" } + + data "megaport_mve_images" "versa" { + vendor_filter = "Versa" + id_filter = 20 + } + resource "megaport_mve" "mve" { product_name = "%s" location_id = data.megaport_location.test_location.id @@ -266,7 +288,7 @@ func (suite *MVEVersaProviderTestSuite) TestAccMegaportMVEVersa_Basic() { vendor_config = { vendor = "versa" product_size = "LARGE" - image_id = 20 + image_id = data.megaport_mve_images.versa.mve_images.0.id director_address = "director1.versa.com" controller_address = "controller1.versa.com" local_auth = "SDWAN-Branch@Versa.com"