diff --git a/docs/resources/fabric_service_token.md b/docs/resources/fabric_service_token.md index d3c7caf46..92c1a36da 100644 --- a/docs/resources/fabric_service_token.md +++ b/docs/resources/fabric_service_token.md @@ -41,6 +41,35 @@ resource "equinix_fabric_service_token" "test" { } ``` +Zside Port Service Token +```terraform +resource "equinix_fabric_service_token" "test"{ + type = "VC_TOKEN" + description = "Zside COLO Service Token" + expiration_date_time = "2025-01-18T06:43:49.981Z" + service_token_connection { + type = "EVPL_VC" + supported_bandwidths = [50, 200, 10000] + z_side { + access_point_selectors{ + type = "COLO" + port { + uuid = "" + } + link_protocol { + type = "DOT1Q" + vlan_tag = "2087" + } + } + } + } + notifications { + type = "ALL" + emails = ["example@equinix.com", "test1@equinix.com"] + } +} +``` + Zside Virtual Device Service Token ```terraform resource "equinix_fabric_service_token" "test" { diff --git a/examples/resources/equinix_fabric_service_token/zside_colo_service_token.tf b/examples/resources/equinix_fabric_service_token/zside_colo_service_token.tf new file mode 100644 index 000000000..f4394340f --- /dev/null +++ b/examples/resources/equinix_fabric_service_token/zside_colo_service_token.tf @@ -0,0 +1,25 @@ +resource "equinix_fabric_service_token" "test"{ + type = "VC_TOKEN" + description = "Zside COLO Service Token" + expiration_date_time = "2025-01-18T06:43:49.981Z" + service_token_connection { + type = "EVPL_VC" + supported_bandwidths = [50, 200, 10000] + z_side { + access_point_selectors{ + type = "COLO" + port { + uuid = "" + } + link_protocol { + type = "DOT1Q" + vlan_tag = "2087" + } + } + } + } + notifications { + type = "ALL" + emails = ["example@equinix.com", "test1@equinix.com"] + } +} diff --git a/internal/resources/fabric/service_token/resource_test.go b/internal/resources/fabric/service_token/resource_test.go index be7aa44e7..09a7f4128 100644 --- a/internal/resources/fabric/service_token/resource_test.go +++ b/internal/resources/fabric/service_token/resource_test.go @@ -110,6 +110,53 @@ func TestAccFabricAsidePortServiceToken_PNFV(t *testing.T) { }) } +func TestAccFabricZsidePortServiceToken_PNFV(t *testing.T) { + ports := testing_helpers.GetFabricEnvPorts(t) + var portUuid string + if len(ports) > 0 { + portUuid = ports["pnfv"]["dot1q"][0].GetUuid() + } + serviceTokenName, serviceTokenUpdatedName := "token_zport_PNFV", "UP_Token_zport_PNFV" + serviceTokenDescription, serviceTokenUpdatedDescription := "zside port token", "Updated zside port token" + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acceptance.TestAccPreCheck(t) }, + Providers: acceptance.TestAccProviders, + CheckDestroy: CheckServiceTokenDelete, + Steps: []resource.TestStep{ + { + Config: testAccFabricZsidePortServiceTokenConfig(serviceTokenName, serviceTokenDescription, portUuid), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("equinix_fabric_service_token.test", "uuid"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "name", serviceTokenName), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "type", "VC_TOKEN"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "description", serviceTokenDescription), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "expiration_date_time", "2025-01-18T06:43:49.981Z"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "service_token_connection.0.supported_bandwidths.#", "3"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "service_token_connection.0.z_side.0.access_point_selectors.0.port.0.uuid", portUuid), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "service_token_connection.0.z_side.0.access_point_selectors.0.link_protocol.0.type", "DOT1Q"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "service_token_connection.0.z_side.0.access_point_selectors.0.link_protocol.0.vlan_tag", "2087"), + ), + ExpectNonEmptyPlan: false, + }, + { + Config: testAccFabricZsidePortServiceTokenConfig(serviceTokenUpdatedName, serviceTokenUpdatedDescription, portUuid), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("equinix_fabric_service_token.test", "uuid"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "name", serviceTokenUpdatedName), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "type", "VC_TOKEN"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "description", serviceTokenUpdatedDescription), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "expiration_date_time", "2025-01-18T06:43:49.981Z"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "service_token_connection.0.supported_bandwidths.#", "3"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "service_token_connection.0.z_side.0.access_point_selectors.0.port.0.uuid", portUuid), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "service_token_connection.0.z_side.0.access_point_selectors.0.link_protocol.0.type", "DOT1Q"), + resource.TestCheckResourceAttr("equinix_fabric_service_token.test", "service_token_connection.0.z_side.0.access_point_selectors.0.link_protocol.0.vlan_tag", "2087"), + ), + ExpectNonEmptyPlan: false, + }, + }, + }) +} + func testAccFabricZsideVirtualDeviceServiceTokenConfig(serviceTokenName string, serviceTokenDescription string, virtualDeviceUuid string) string { return fmt.Sprintf( `resource "equinix_fabric_service_token" "test"{ @@ -174,6 +221,38 @@ func testAccFabricAsidePortServiceTokenConfig(serviceTokenName string, serviceTo `, serviceTokenName, serviceTokenDescription, portUuid) } +func testAccFabricZsidePortServiceTokenConfig(serviceTokenName string, serviceTokenDescription string, portUuid string) string { + return fmt.Sprintf( + `resource "equinix_fabric_service_token" "test"{ + type = "VC_TOKEN" + name = "%s" + description = "%s" + expiration_date_time = "2025-01-18T06:43:49.981Z" + service_token_connection { + type = "EVPL_VC" + supported_bandwidths = [50, 200, 10000] + z_side { + access_point_selectors{ + type = "COLO" + port { + uuid = "%s" + } + link_protocol { + type = "DOT1Q" + vlan_tag = "2087" + } + } + } + } + notifications { + type = "ALL" + emails = ["example@equinix.com", "test1@equinix.com"] + } + + } + `, serviceTokenName, serviceTokenDescription, portUuid) +} + func CheckServiceTokenDelete(s *terraform.State) error { ctx := context.Background() for _, rs := range s.RootModule().Resources { diff --git a/templates/resources/fabric_service_token.md.tmpl b/templates/resources/fabric_service_token.md.tmpl index 937d6ae6f..6df858e27 100644 --- a/templates/resources/fabric_service_token.md.tmpl +++ b/templates/resources/fabric_service_token.md.tmpl @@ -19,6 +19,9 @@ Additional documentation: Aside Port Service Token {{tffile "examples/resources/equinix_fabric_service_token/aside_colo_service_token.tf"}} +Zside Port Service Token +{{tffile "examples/resources/equinix_fabric_service_token/zside_colo_service_token.tf"}} + Zside Virtual Device Service Token {{tffile "examples/resources/equinix_fabric_service_token/zside_vd_service_token.tf"}}