-
Notifications
You must be signed in to change notification settings - Fork 45
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
Conversation
Signed-off-by: Marques Johansson <mjohansson@equinix.com>
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). |
resource "aws_dx_connection" "example" { | ||
name = "tf-aws-dot1q" | ||
bandwidth = "50Mbps" | ||
location = var.aws_location_code |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
53bd93c
to
30e6321
Compare
Signed-off-by: Marques Johansson <mjohansson@equinix.com>
Signed-off-by: Marques Johansson <mjohansson@equinix.com>
Signed-off-by: Marques Johansson <mjohansson@equinix.com>
30e6321
to
7a33ca8
Compare
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" { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
add metro to spotmarketprices datasource
add metro to spotmarketprices datasource
Deprecate equinix_ecx_l2_connection_accepter
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 theaws_dx_connection_confirmation
resource.From the updated
equinix_ecx_l2_connection_accepter
documentation:The issue that led to the resource that provides this feature in the AWS provider is hashicorp/terraform-provider-aws#9366.
Fixes #62