-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Fix DescribeClientVpnTargetNetworks #14380
Conversation
This also relates to #9585 |
Hi @nijave Thanks for the PR! Can you update this PR to resolve the conflict and also include the call to |
aa06a04
to
c01c03c
Compare
c01c03c
to
58d0084
Compare
58d0084
to
2596fb5
Compare
Amazon API doesn't return the correct results when using "AssociationIds" but works correctly when using a filter for the same thing
2596fb5
to
a266e25
Compare
I think probably the integration test should be updated here to include two subnets instead of a single one and maybe that would weed out the issue? |
Hmm don't think the test is working right since it still seems to pass without the changes |
@gdavison @anGie44 @bflad this bug effectively makes it not possible to use multiple subnet associations. there are several issues open that are related to this bug, and the fix is straight-forward (as proposed by @nijave ). I have independently compiled and verified that the proposed patch works. Would you be able to review and merge this? Before the patch, TF would report a change on an existing resource which was imported
This is because the provider assumes there will be a single network association returned If there is more than 1 subnet, the first subnet will only ever be "found" and imported into the state. All other subnets will then show in the (subsequent) TF plans as changing this. Filtering constrains the returned list to a single item, and the provisioner imports correctly once again. After removing the instances of broken state and re-importing with the patched version of the provider, the state is now accurate and shows 2 associations instead of 1 broken association
|
Hey, I asked support team bout this issue and they also said to use filters. They also opened an internal ticket for fix this issue in API but has no ETA. |
I kind of expect they'll just ignore it. Afaik we hit the same issue with ruby aws-sdk and it appeared the API wasn't working correctly https://github.com/aws/aws-sdk-go/issues/3713 |
Would those on this thread please check to see if this is still an issue? My recent tests are not seeing this issue in either us-east-1 or sa-east-1, and I don't remember seeing a similar patch merged. Not sure if I might have forgotten my original tests which I used when posting my first comment |
FWIW this does seem to be working for me now. A resource like
Is functioning as I would expect it to this morning. This is in us-west-2 for me. This configuration previously would not work for me as it would constantly want to delete and recreate the associations. |
My AWS reps said that this had been fixed in 2 regions, which is what prompted my follow-up. They said it would be rolling out world-wide by end of last/this week. So if it's not yet fixed in a particular region, suggest folks on thread re-try until around the 15th. |
Do you know what regions?
…On Mon, Jan 11, 2021, 11:43 AM Tim Rupp ***@***.***> wrote:
Is functioning as I would expect it to this morning. This is in us-west-2
for me. This configuration previously would not work for me as it would
constantly want to delete and recreate the associations.
My AWS reps said that this had been fixed in 2 regions, which is what
prompted my follow-up. They said it would be rolling out world-wide by end
of last/this week. So if it's not yet fixed in a particular region, suggest
folks on thread re-try until around the 15th.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#14380 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC53WUSIAXNZ5Y6CVLSAX3SZMTCVANCNFSM4PL2TU6Q>
.
|
sa-east-1 and us-east-1 per an email thread i had with them end of last week |
but @moserke sees it working in us-west-2 so it must have been rolled out even further |
I asked our TAMs if they can provide more info. Afaik they have some sort of internal issue tracker they can check and attach impacted customers to |
I'm still experiencing this issue on |
@dmerrick weird. I wasn't seeing the issue on us-east-1. Can you use the AWS cli to see if you get incorrect data returned? If you have more than 1 association in your VPN, the following command will return all of them if its still broken. A fixed command will only return 1 association (the one you specify)
|
Here's a simple bash script you can use to see if it's returning the same items (set
It outputs like
|
$ aws ec2 describe-client-vpn-target-networks --client-vpn-endpoint-id my-endpoint-id --association-ids my-association-id
{
"ClientVpnTargetNetworks": [
{
"AssociationId": "cvpn-assoc-[redacted]",
"VpcId": "vpc-[redacted]",
"TargetNetworkId": "subnet-[redacted]",
"ClientVpnEndpointId": "cvpn-endpoint-[redacted]",
"Status": {
"Code": "associated"
},
"SecurityGroups": [
"sg-[redacted]"
]
}
]
} Just the one, which is expected (as I have only one association) $ for id in $(aws ec2 describe-client-vpn-target-networks --client-vpn-endpoint-id $endpoint | jq -r ".ClientVpnTargetNetworks[].AssociationId"); do
printf "%s %s\n" $id $(aws ec2 describe-client-vpn-target-networks --client-vpn-endpoint-id $endpoint --association-ids $id | jq -r ".ClientVpnTargetNetworks[0].AssociationId");
done
cvpn-assoc-[redacted] cvpn-assoc-[redacted] The two associations returned are identical, which I think is what is expected as well. But when I run
And indeed, the associationId in that response is not the correct one. Should I |
@dmerrick if you can tolerate doing that then yeah I would try. |
Aight that was scary but it resolved my issue |
@caphrim007 I've never had an issue with this beforehand, until it cropped up today on eu-west-2 which is then stopping my deployment. Just working on how to bypass this at the moment |
@OliverBailey are you saying that it used to work on eu-west-2 and then stopped working? |
Nit entirely sure if it is related to this. I had two associations as such resource "aws_ec2_client_vpn_endpoint" "redacted_VPN" {
description = "VPN-for-redacted"
server_certificate_arn = data.aws_acm_certificate.vpn_server_cert.arn
client_cidr_block = "192.168.24.0/22"
dns_servers = ["10.0.0.2"]
authentication_options {
type = "certificate-authentication"
root_certificate_chain_arn = data.aws_acm_certificate.vpn_root_cert.arn
}
connection_log_options {
enabled = false
}
}
data "aws_acm_certificate" "vpn_server_cert" {
domain = "server"
statuses = ["ISSUED"]
}
data "aws_acm_certificate" "vpn_root_cert" {
domain = "test2.tld"
statuses = ["ISSUED"]
}
resource "aws_ec2_client_vpn_network_association" "redacted_VPN_network_association" {
client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.redacted_VPN.id
subnet_id = aws_subnet.Prod_private[0].id
security_groups = [aws_security_group.vpn-sg.id]
}
resource "aws_ec2_client_vpn_network_association" "redacted_VPN_network_association-1" {
client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.redacted_VPN.id
subnet_id = aws_subnet.Prod_private[1].id
security_groups = [aws_security_group.vpn-sg.id]
}
Yet one of them somehow managed to completely dissapear, and in turn meant that the entire terraform build failed. Appears that it was the first one Looking through logs, for some reason, one of them decided to destroy itself without any reason/cause and no change within the tfstate or .tf file which I found bizzare. I had to |
Since this was fixed on the AWS side, I have created a new PR based off of this one that just includes the acceptance test. The new PR is #18199. Thanks for the work on this! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Amazon API doesn't return the correct results when using
"AssociationIds" but works correctly when using a filter for the same
thing
Community Note
Closes #11586
Release note for CHANGELOG:
Output from acceptance testing:
We submitted an AWS ticket about this back in February and they said "Use filter attribute". I've reopened it and will update if they admit this is a bug