From e858cb6774165149e1a52d533a2a81c192be9451 Mon Sep 17 00:00:00 2001 From: srushti-patl Date: Thu, 12 Sep 2024 14:32:26 -0700 Subject: [PATCH 1/5] feat: Adding Creating FCR with Marketplace subscription example --- .../README.md | 10 ++++ .../main.tf | 41 +++++++++++++++ .../outputs.tf | 3 ++ .../terraform.tfvars.example | 15 ++++++ .../varaibles.tf | 52 +++++++++++++++++++ .../versions.tf | 9 ++++ 6 files changed, 130 insertions(+) create mode 100644 examples/cloud-router-marketplace-susbscription/README.md create mode 100644 examples/cloud-router-marketplace-susbscription/main.tf create mode 100644 examples/cloud-router-marketplace-susbscription/outputs.tf create mode 100644 examples/cloud-router-marketplace-susbscription/terraform.tfvars.example create mode 100644 examples/cloud-router-marketplace-susbscription/varaibles.tf create mode 100644 examples/cloud-router-marketplace-susbscription/versions.tf diff --git a/examples/cloud-router-marketplace-susbscription/README.md b/examples/cloud-router-marketplace-susbscription/README.md new file mode 100644 index 00000000..a4fac9d7 --- /dev/null +++ b/examples/cloud-router-marketplace-susbscription/README.md @@ -0,0 +1,10 @@ +# Fabric Cloud Router Creation with Market Place Susbscription + +This example shows how to create a Fabric Cloud Router using Market Place Subscription. + +It leverages the Equinix Terraform Provider + +See example usage below for details on how to use this example. + + + diff --git a/examples/cloud-router-marketplace-susbscription/main.tf b/examples/cloud-router-marketplace-susbscription/main.tf new file mode 100644 index 00000000..d4d9d779 --- /dev/null +++ b/examples/cloud-router-marketplace-susbscription/main.tf @@ -0,0 +1,41 @@ +provider "equinix" { + client_id = var.equinix_client_id + client_secret = var.equinix_client_secret +} + +data "equinix_fabric_market_place_subscription" "test" { + uuid = var.marketplace_subscription_uuid +} + +locals { + entitlement = flatten([ + for entitlement in data.equinix_fabric_market_place_subscription.test.entitlements : [ + for asset in entitlement.asset : asset.package + ] + ]) +} + +resource "equinix_fabric_cloud_router" "test"{ + name = var.fcr_name + type = var.fcr_type + notifications{ + type = var.notifications_type + emails = var.notifications_emails + } + order { + purchase_order_number = var.purchase_order_number + } + location { + metro_code = var.fcr_location + } + package { + code = local.entitlement[1].code + } + project { + project_id = var.project_id + } + marketplace_subscription{ + type = var.marketplace_subscription_type + uuid = data.equinix_fabric_market_place_subscription.test.uuid + } +} diff --git a/examples/cloud-router-marketplace-susbscription/outputs.tf b/examples/cloud-router-marketplace-susbscription/outputs.tf new file mode 100644 index 00000000..7291f2b6 --- /dev/null +++ b/examples/cloud-router-marketplace-susbscription/outputs.tf @@ -0,0 +1,3 @@ +output "cloud_router_id" { + value = equinix_fabric_cloud_router.test.id +} diff --git a/examples/cloud-router-marketplace-susbscription/terraform.tfvars.example b/examples/cloud-router-marketplace-susbscription/terraform.tfvars.example new file mode 100644 index 00000000..07618867 --- /dev/null +++ b/examples/cloud-router-marketplace-susbscription/terraform.tfvars.example @@ -0,0 +1,15 @@ +equinix_client_id = "" +equinix_client_secret = "" + +fcr_location = "SV" +fcr_name = "terra_fcr_marketplace" +fcr_package = "ADVANCED" +fcr_type = "XF_ROUTER" +notifications_emails = ["diginpanthers@gmail.com"] +notifications_type = "ALL" +project_id = "" +purchase_order_number = "1-323292" + +marketplace_subscription_type = "AWS_MARKETPLACE_SUBSCRIPTION", +marketplace_subscription_uuid = "" + diff --git a/examples/cloud-router-marketplace-susbscription/varaibles.tf b/examples/cloud-router-marketplace-susbscription/varaibles.tf new file mode 100644 index 00000000..dabdbcee --- /dev/null +++ b/examples/cloud-router-marketplace-susbscription/varaibles.tf @@ -0,0 +1,52 @@ +variable "equinix_client_id" { + description = "Equinix client ID (consumer key), obtained after registering app in the developer platform" + type = string + sensitive = true +} +variable "equinix_client_secret" { + description = "Equinix client secret ID (consumer secret), obtained after registering app in the developer platform" + type = string + sensitive = true +} +variable "fcr_name" { + description = "Fabric Cloud Router Name" + type = string +} +variable "fcr_type" { + description = "Fabric Cloud Router Type like XF_ROUTER" + type = string +} +variable "notifications_type" { + description = "Notification Type - ALL is the only type currently supported" + type = string + default = "ALL" +} +variable "notifications_emails" { + description = "Array of contact emails" + type = list(string) +} +variable "purchase_order_number" { + description = "Purchase order number" + type = string +} +variable "fcr_location" { + description = "Fabric Cloud Router Location" + type = string +} +variable "fcr_package" { + description = "Fabric Cloud Router Package like LAB, ADVANCED, STANDARD, PREMIUM" + type = string +} +variable "project_id" { + description = "Subscriber-assigned project ID" + type = string +} +variable "marketplace_subscription_type" { + description = "Marketplace subscription type" + type = string +} +variable "marketplace_subscription_uuid" { + description = "Marketplace subscription UUID" + type = string + sensitive = true +} diff --git a/examples/cloud-router-marketplace-susbscription/versions.tf b/examples/cloud-router-marketplace-susbscription/versions.tf new file mode 100644 index 00000000..65862b70 --- /dev/null +++ b/examples/cloud-router-marketplace-susbscription/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_version = ">= 1.5.4" + required_providers { + equinix = { + source = "equinix/equinix" + version = ">= 1.20.0" + } + } +} \ No newline at end of file From dc7e778c48040da309490538c2886b617e846e79 Mon Sep 17 00:00:00 2001 From: srushti-patl Date: Thu, 12 Sep 2024 14:41:46 -0700 Subject: [PATCH 2/5] nit: removing extra space --- .../terraform.tfvars.example | 1 - examples/cloud-router-marketplace-susbscription/versions.tf | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/cloud-router-marketplace-susbscription/terraform.tfvars.example b/examples/cloud-router-marketplace-susbscription/terraform.tfvars.example index 07618867..e8e6c879 100644 --- a/examples/cloud-router-marketplace-susbscription/terraform.tfvars.example +++ b/examples/cloud-router-marketplace-susbscription/terraform.tfvars.example @@ -12,4 +12,3 @@ purchase_order_number = "1-323292" marketplace_subscription_type = "AWS_MARKETPLACE_SUBSCRIPTION", marketplace_subscription_uuid = "" - diff --git a/examples/cloud-router-marketplace-susbscription/versions.tf b/examples/cloud-router-marketplace-susbscription/versions.tf index 65862b70..8e226867 100644 --- a/examples/cloud-router-marketplace-susbscription/versions.tf +++ b/examples/cloud-router-marketplace-susbscription/versions.tf @@ -6,4 +6,4 @@ terraform { version = ">= 1.20.0" } } -} \ No newline at end of file +} From 879655e2e6a589b1c0af391207014d197810a04d Mon Sep 17 00:00:00 2001 From: srushti-patl Date: Tue, 17 Sep 2024 11:49:57 -0700 Subject: [PATCH 3/5] fix:Changing resource & data source names and updating README.md files. --- examples/cloud-router-marketplace-susbscription/README.md | 6 ++++-- examples/cloud-router-marketplace-susbscription/main.tf | 6 +++--- examples/cloud-router-marketplace-susbscription/outputs.tf | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/examples/cloud-router-marketplace-susbscription/README.md b/examples/cloud-router-marketplace-susbscription/README.md index a4fac9d7..3c437a21 100644 --- a/examples/cloud-router-marketplace-susbscription/README.md +++ b/examples/cloud-router-marketplace-susbscription/README.md @@ -1,8 +1,10 @@ # Fabric Cloud Router Creation with Market Place Susbscription -This example shows how to create a Fabric Cloud Router using Market Place Subscription. +This example shows how to create a Fabric Cloud Router using Market Place Subscription, which can be generated through various CloudRouter Service Providers. +https://staging-docs.equinix.com/en-us/Content/Interconnection/FCR/FCR-order-csp-marketplace.htm?Highlight=fabric%20marketplace -It leverages the Equinix Terraform Provider +It leverages the Equinix Terraform Provider to setup the Fabric Cloud Router based on the parameters you have provided to this example; or based on the pattern +you see used in this example it will allow you to create a more specific use case for your own needs. See example usage below for details on how to use this example. diff --git a/examples/cloud-router-marketplace-susbscription/main.tf b/examples/cloud-router-marketplace-susbscription/main.tf index d4d9d779..8c66b1ab 100644 --- a/examples/cloud-router-marketplace-susbscription/main.tf +++ b/examples/cloud-router-marketplace-susbscription/main.tf @@ -3,19 +3,19 @@ provider "equinix" { client_secret = var.equinix_client_secret } -data "equinix_fabric_market_place_subscription" "test" { +data "equinix_fabric_market_place_subscription" "subscription" { uuid = var.marketplace_subscription_uuid } locals { entitlement = flatten([ - for entitlement in data.equinix_fabric_market_place_subscription.test.entitlements : [ + for entitlement in data.equinix_fabric_market_place_subscription.subscription.entitlements : [ for asset in entitlement.asset : asset.package ] ]) } -resource "equinix_fabric_cloud_router" "test"{ +resource "equinix_fabric_cloud_router" "create_fcr_marketplace_subscription"{ name = var.fcr_name type = var.fcr_type notifications{ diff --git a/examples/cloud-router-marketplace-susbscription/outputs.tf b/examples/cloud-router-marketplace-susbscription/outputs.tf index 7291f2b6..2873f5d9 100644 --- a/examples/cloud-router-marketplace-susbscription/outputs.tf +++ b/examples/cloud-router-marketplace-susbscription/outputs.tf @@ -1,3 +1,3 @@ output "cloud_router_id" { - value = equinix_fabric_cloud_router.test.id + value = equinix_fabric_cloud_router.create_fcr_marketplace_subscription.id } From a814c982fc77f86187c48d5e0b19d3313c42dfa4 Mon Sep 17 00:00:00 2001 From: srushti-patl Date: Tue, 17 Sep 2024 11:52:00 -0700 Subject: [PATCH 4/5] nit: Updating data source reference. --- examples/cloud-router-marketplace-susbscription/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/cloud-router-marketplace-susbscription/main.tf b/examples/cloud-router-marketplace-susbscription/main.tf index 8c66b1ab..dc309870 100644 --- a/examples/cloud-router-marketplace-susbscription/main.tf +++ b/examples/cloud-router-marketplace-susbscription/main.tf @@ -36,6 +36,6 @@ resource "equinix_fabric_cloud_router" "create_fcr_marketplace_subscription"{ } marketplace_subscription{ type = var.marketplace_subscription_type - uuid = data.equinix_fabric_market_place_subscription.test.uuid + uuid = data.equinix_fabric_market_place_subscription.subscription.uuid } } From 182140a9f80707c3cdfaa701f5f6cdcb33b6bb93 Mon Sep 17 00:00:00 2001 From: srushti-patl Date: Thu, 19 Sep 2024 11:23:23 -0700 Subject: [PATCH 5/5] fix: Updating equinix provider version and README.md file --- examples/cloud-router-marketplace-susbscription/README.md | 1 - examples/cloud-router-marketplace-susbscription/versions.tf | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/cloud-router-marketplace-susbscription/README.md b/examples/cloud-router-marketplace-susbscription/README.md index 3c437a21..588a4cb1 100644 --- a/examples/cloud-router-marketplace-susbscription/README.md +++ b/examples/cloud-router-marketplace-susbscription/README.md @@ -1,7 +1,6 @@ # Fabric Cloud Router Creation with Market Place Susbscription This example shows how to create a Fabric Cloud Router using Market Place Subscription, which can be generated through various CloudRouter Service Providers. -https://staging-docs.equinix.com/en-us/Content/Interconnection/FCR/FCR-order-csp-marketplace.htm?Highlight=fabric%20marketplace It leverages the Equinix Terraform Provider to setup the Fabric Cloud Router based on the parameters you have provided to this example; or based on the pattern you see used in this example it will allow you to create a more specific use case for your own needs. diff --git a/examples/cloud-router-marketplace-susbscription/versions.tf b/examples/cloud-router-marketplace-susbscription/versions.tf index 8e226867..03bc5963 100644 --- a/examples/cloud-router-marketplace-susbscription/versions.tf +++ b/examples/cloud-router-marketplace-susbscription/versions.tf @@ -3,7 +3,7 @@ terraform { required_providers { equinix = { source = "equinix/equinix" - version = ">= 1.20.0" + version = ">= 2.5.0" } } }