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

feat: examples and acceptance test coverage for mve image filtering #186

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion docs/guides/mve_aruba.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
7 changes: 6 additions & 1 deletion docs/guides/mve_versa.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 = "[email protected]"
Expand Down
7 changes: 6 additions & 1 deletion docs/guides/vxc_mve_aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
7 changes: 6 additions & 1 deletion docs/guides/vxc_transit.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
7 changes: 6 additions & 1 deletion docs/resources/mve.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions examples/data-sources/megaport_mve_image/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
data "megaport_mve_images" "aruba" {
vendor_filter = "Aruba"
id_filter = 23
}
7 changes: 6 additions & 1 deletion examples/mve_aruba/mve_aruba.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
7 changes: 6 additions & 1 deletion examples/mve_versa/mve_versa.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 = "[email protected]"
Expand Down
7 changes: 6 additions & 1 deletion examples/resources/megaport_mve/resource.tf
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
Expand Down
7 changes: 6 additions & 1 deletion examples/vxc_mve_aws/vxc_mve_aws.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
7 changes: 6 additions & 1 deletion examples/vxc_mve_transit/vxc_mve_transit.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
30 changes: 26 additions & 4 deletions internal/provider/mve_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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 = "[email protected]"
Expand Down Expand Up @@ -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
Expand All @@ -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 = "[email protected]"
Expand Down