Skip to content

feat: Port to Etree Network connection examples#212

Merged
d-bhola merged 14 commits intomainfrom
CXF-110987-etree-connections
Sep 8, 2025
Merged

feat: Port to Etree Network connection examples#212
d-bhola merged 14 commits intomainfrom
CXF-110987-etree-connections

Conversation

@d-bhola
Copy link
Copy Markdown
Contributor

@d-bhola d-bhola commented Aug 26, 2025

  • Port to E-Tree Network Example
  • Port to E-Tree Network Service Token Example

@d-bhola d-bhola changed the title CXF-110987: Portto Etree Network connection examples feat: Port to Etree Network connection examples Aug 26, 2025
@d-bhola d-bhola marked this pull request as ready for review September 3, 2025 21:56
Copy link
Copy Markdown
Collaborator

@thogarty thogarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested.

client_secret = var.equinix_client_secret
}

module "create_port_2_network_connection" {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to toss an ETree network resource into this example also. As it is there is very little value add here. Please update the README.md to reflect that change as well.

Copy link
Copy Markdown
Contributor Author

@d-bhola d-bhola Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment thread modules/port-connection/main.tf Outdated
network {
uuid = var.zside_network_uuid
}
role = contains(["EVPTREE_VC", "EPTREE_VC"], var.connection_type) && var.role != "" ? var.role : null
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there only 2 role types? Could this be checked at the provider level so that we don't have to update modules if the enum changes?

If we can do this at provider level then remove the enum check and allow whatever value they want to be put in here because the provider or API error will give them enough detail.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I see that you're just checking the connection type here. That's a good double check, but this can still be at the provider level.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In retrospect, I think I could also skip this check, as the API also gives clear error messages in 400 bad request. Will remove this check.

Comment thread modules/port-connection/main.tf Outdated
network {
uuid = var.zside_network_uuid
}
role = var.role
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also don't have any check on the secondary connection so it will put an empty string here if it's not provided. Add the same check on it that makes it null if not provided.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need the attention to detail in our code to be consistent across the edge cases.

required_version = ">= 1.5.4"
required_providers {
equinix = {
source="equinix/equinix"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: formatting is wrong on the source line

aside_vlan_tag = var.aside_vlan_tag

# Z-side
zside_service_token_uuid = equinix_fabric_service_token.service-token.id
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not need the role for a zside service token on etree network?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's not needed.

Copy link
Copy Markdown
Collaborator

@thogarty thogarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More changes requested

variable "network_scope" {
description = "Equinix Network Scope"
type = string
} No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: no newline

term_length = 12
aside_port_name = "ops-user100-CX-SV5-NL-Qinq-STD-1G-SEC-JP-190"
aside_vlan_tag = "1976"
zside_service_token_uuid = "Service_Token_UUID"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I counted 26 defined variables in variables.tf but there are 28 in the example. What are the mismatches? Has this been tested with no variable warnings?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated here. But the numbers in variables.tf and example do not match because there are some hardcoded values in main.tf , such as service token type - "VC_TOKEN" and allow_remote_connection = true

variable "role" {
description = "Role of network"
type = string
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a mismatch between defined variables and example values in this example here. Let's remove all bloat. Keep it minimal without any variable warnings.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notification_type and notification_emails is common field for both etree_network resource and the module create_port_2_network_connection so the numbers don't match in variables.tf and example file.

Comment thread modules/port-connection/variables.tf Outdated
default = []
}
variable "role" {
description = "Role of network"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only the role of the ETree Networks. So we need to be specific.

Copy link
Copy Markdown
Collaborator

@thogarty thogarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More additional comments.

@@ -0,0 +1,13 @@
output "service_token_id" {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could output the network here too.

@@ -0,0 +1,9 @@
output "port_connection" {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once we add the network we want to add it to the output also.

@d-bhola d-bhola requested a review from thogarty September 8, 2025 19:39
Copy link
Copy Markdown
Collaborator

@thogarty thogarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@d-bhola d-bhola merged commit a240fda into main Sep 8, 2025
2 of 4 checks passed
@d-bhola d-bhola deleted the CXF-110987-etree-connections branch September 8, 2025 22:47
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Sep 8, 2025

This PR is included in version 0.25.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants