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

Deprecate equinix_ecx_l2_connection_accepter #64

Merged
merged 10 commits into from
Jan 5, 2022

Conversation

displague
Copy link
Member

@displague displague commented Nov 29, 2021

This PR disabled the equinix_ecx_l2_connection_accepter resource with soft errors. Users are instructed via Terraform deprecation warnings, provision errors, and resource documentation to adopt the aws_dx_connection_confirmation resource.

From the updated equinix_ecx_l2_connection_accepter documentation:

Use the aws_dx_connection_confirmation resource from the AWS provider. The documentation below applies to version v1.3 and below of the Equinix provider. Later versions of the Equinix provider will return an error, requiring usage of the AWS provider v3.62.0+ feature.

The issue that led to the resource that provides this feature in the AWS provider is hashicorp/terraform-provider-aws#9366.

Fixes #62

Signed-off-by: Marques Johansson <mjohansson@equinix.com>
@displague
Copy link
Member Author

An additional motivator for this PR is that the Amazon SDK adds Go dependencies that make this provider cumbersome to import in other providers (Crossplane, Pulumi).

@displague displague changed the title Deprecate ecx l2 connection accepter Deprecate equinix_ecx_l2_connection_accepter Nov 29, 2021
resource "aws_dx_connection" "example" {
name = "tf-aws-dot1q"
bandwidth = "50Mbps"
location = var.aws_location_code
Copy link
Member Author

Choose a reason for hiding this comment

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

It would be nice if there was a way to match the location code with an Equinix location for the purposes of these examples. I could not find one so I took the path of least resistance and suggested that the user define this value in a variable.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm also creating the connection in this example. It seems we have the option to instead use an existing connection via https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/dx_connection. For the purposes of the example, I think either approach is fine. (assuming this code works - I was not able to verify this. I'm hoping @ocobleseqx may be able to.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Since the connection in AWS is configured through the 'equinix_exc_l2_connection' resource the connection id should be referenceable in that resource. This was already discussed here #22 .

AWS dx_connection datasource could be an alternative but there may be an issue, AWS allows creating multiple direct connect connections with the same name but the aws_dx_connection datasource doesn't allow more filters than name

Copy link
Member Author

@displague displague Nov 29, 2021

Choose a reason for hiding this comment

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

Regarding the datasource, there is a convention to use a singular name or a plural name in data sources depending on whether the resource name returns a map or array of results or a single result. When a resource is expected to return a single result, the provider will typically throw an error if more than one results match the selection criteria.

I don't know if this AWS follows that convention, but I think if this approach works at all, it is sufficient for the example. If it helps to avoid an incorrect example, we could simplify further with var.aws_connection_id instead of creating or looking up the AWS DX Connection.

Copy link
Member Author

Choose a reason for hiding this comment

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

From #22

When creating an AWS Virtual Interface within the Direct Connect service, a "Connection ID" attribute must be used. In the absence of AWS Data Source for 'aws_dx_connection' resource, there's no way to fetch this attribute from AWS.

We now have https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/dx_connection available.

Equinix Terraform provider allows creating an "equinix_ecx_l2_connection" resource and relies on ECX API to create the Direct Connect connection. ECX API L2 connection object includes actionDetails list that includes the AWS connection_id:

It seems we may need to revisit #26.

@pfeiffermj proposed connection_id = equinix_ecx_l2_connection_details.details.actionDetails.actionRequiredData.ELEMENT.awsConnectionId.value which @abudilov also suggested in #22.

Issues 22 and 26 discuss an actionDetails element of the ECX API which contains a list of maps with field values to populate AWS credentials and retrieve AWS connection details. While improved access to this attribute (Terraform providers should match the upstream API), this API pattern has been revoked by the successor API, ECX APIv3:

V3 removes the need for a service provider to approve a deleted connection and immediately deletes the connection and stops billing when this action is performed by a user

More details are provided on https://developer.equinix.com/docs/ecx-v3-apis-migration and https://developer.equinix.com/docs/ecx-connect-aws.

As of January 5, 2020, Equinix stopped supporting Equinix Fabric V2 APIs, and after July 5, 2020, all previous versions of Equinix Fabric APIs have been deprecated.

It seems we may require a more comprehensive overhaul.

For now, I believe it would be sufficient to find a way to discover the AWS Connection ID.

…onnection_confirmation

Signed-off-by: Marques Johansson <mjohansson@equinix.com>
@displague displague force-pushed the deprecate-ecx_l2_connection_accepter branch from 53bd93c to 30e6321 Compare November 29, 2021 03:55
Signed-off-by: Marques Johansson <mjohansson@equinix.com>
Signed-off-by: Marques Johansson <mjohansson@equinix.com>
Signed-off-by: Marques Johansson <mjohansson@equinix.com>
connection_id = equinix_ecx_l2_connection.example.id
access_key = var.aws_access_key
secret_key = var.aws_secret_key
resource "aws_dx_connection" "example" {
Copy link
Contributor

Choose a reason for hiding this comment

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

'equinix_ecx_l2_connection' resource creates the connection in the AWS side on your behalf and therefore the 'aws_dx_connection' resource is not required

Copy link
Member Author

@displague displague Nov 29, 2021

Choose a reason for hiding this comment

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

If we don't need an dx_ec2_connection resource, how should we get the connection id that AWS needs in their APIs and Terraform resources?

resource "aws_dx_connection" "example" {
name = "tf-aws-dot1q"
bandwidth = "50Mbps"
location = var.aws_location_code
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the connection in AWS is configured through the 'equinix_exc_l2_connection' resource the connection id should be referenceable in that resource. This was already discussed here #22 .

AWS dx_connection datasource could be an alternative but there may be an issue, AWS allows creating multiple direct connect connections with the same name but the aws_dx_connection datasource doesn't allow more filters than name

ocobles
ocobles previously approved these changes Jan 4, 2022
@ocobles ocobles merged commit bd54e5d into master Jan 5, 2022
@ocobles ocobles linked an issue Jan 5, 2022 that may be closed by this pull request
@ocobles ocobles deleted the deprecate-ecx_l2_connection_accepter branch January 5, 2022 11:28
displague added a commit that referenced this pull request Jan 28, 2022
add metro to spotmarketprices datasource
displague added a commit to displague/terraform-provider-equinix that referenced this pull request Jan 31, 2022
add metro to spotmarketprices datasource
thogarty pushed a commit that referenced this pull request Sep 5, 2023
Deprecate equinix_ecx_l2_connection_accepter
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.

remove aws_dx_connection_confirmation resource Support Tags for aws l2 connection accepter
2 participants