Skip to content

Commit

Permalink
CXF-100793 Adding Creating FCR with Marketplace Subscription example (#…
Browse files Browse the repository at this point in the history
…127)

* feat: Adding Creating FCR with Marketplace subscription example

* nit: removing extra space

* fix:Changing resource & data source names and updating README.md files.

* nit: Updating data source reference.

* fix: Updating equinix provider version and README.md file
  • Loading branch information
srushti-patl authored Sep 19, 2024
1 parent 4b0a209 commit 6f44346
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 0 deletions.
11 changes: 11 additions & 0 deletions examples/cloud-router-marketplace-susbscription/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 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.

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.

<!-- BEGIN_TF_DOCS -->
<!-- END_TF_DOCS -->
41 changes: 41 additions & 0 deletions examples/cloud-router-marketplace-susbscription/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
provider "equinix" {
client_id = var.equinix_client_id
client_secret = var.equinix_client_secret
}

data "equinix_fabric_market_place_subscription" "subscription" {
uuid = var.marketplace_subscription_uuid
}

locals {
entitlement = flatten([
for entitlement in data.equinix_fabric_market_place_subscription.subscription.entitlements : [
for asset in entitlement.asset : asset.package
]
])
}

resource "equinix_fabric_cloud_router" "create_fcr_marketplace_subscription"{
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.subscription.uuid
}
}
3 changes: 3 additions & 0 deletions examples/cloud-router-marketplace-susbscription/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "cloud_router_id" {
value = equinix_fabric_cloud_router.create_fcr_marketplace_subscription.id
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
equinix_client_id = "<MyEquinixClientId>"
equinix_client_secret = "<MyEquinixSecret>"

fcr_location = "SV"
fcr_name = "terra_fcr_marketplace"
fcr_package = "ADVANCED"
fcr_type = "XF_ROUTER"
notifications_emails = ["[email protected]"]
notifications_type = "ALL"
project_id = "<Project_Id>"
purchase_order_number = "1-323292"

marketplace_subscription_type = "AWS_MARKETPLACE_SUBSCRIPTION",
marketplace_subscription_uuid = "<Marketplace_Subscription_Id>"
52 changes: 52 additions & 0 deletions examples/cloud-router-marketplace-susbscription/varaibles.tf
Original file line number Diff line number Diff line change
@@ -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
}
9 changes: 9 additions & 0 deletions examples/cloud-router-marketplace-susbscription/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_version = ">= 1.5.4"
required_providers {
equinix = {
source = "equinix/equinix"
version = ">= 2.5.0"
}
}
}

0 comments on commit 6f44346

Please sign in to comment.