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

AWS Transfer Server: Attach VPC security groups at creation #15788

Closed
ewbankkit opened this issue Oct 22, 2020 · 22 comments · Fixed by #17539
Closed

AWS Transfer Server: Attach VPC security groups at creation #15788

ewbankkit opened this issue Oct 22, 2020 · 22 comments · Fixed by #17539
Assignees
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/transfer Issues and PRs that pertain to the transfer service.

Comments

@ewbankkit
Copy link
Contributor

ewbankkit commented Oct 22, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

You can now attach multiple security groups to a server in a VPC.

New or Affected Resource(s)

Potential Terraform Configuration

resource "aws_transfer_server" "example" {
  endpoint_details {
    security_group_ids = [aws_security_group.example_1.id, aws_security_group.example_2.id]
  }
}

References

User Guide.

Requires AWS SDK v1.35.8:

Related:

Note:

You can edit the SecurityGroupIds property in the UpdateServer API only if you are changing the EndpointType from PUBLIC or VPC_ENDPOINT to VPC. To change security groups associated with your server's VPC endpoint after creation, use the Amazon EC2 ModifyVpcEndpoint API.

@ewbankkit ewbankkit added the enhancement Requests to existing resources that expand the functionality or scope. label Oct 22, 2020
@ghost ghost added the service/transfer Issues and PRs that pertain to the transfer service. label Oct 22, 2020
@rodrigdav
Copy link

Any update on when this will be available?

@amadureira
Copy link
Contributor

Hi @rodrigdav,

I have open a PR 17496.

@rodrigdav
Copy link

rodrigdav commented Feb 6, 2021 via email

@amadureira
Copy link
Contributor

Hi @rodrigdav and @Zordrak,

I check my PR and I found some problems. I will fix it. You could use my provider, see this configuration bellow:

source = "amadureira/aws"
version = "3.26.18"

@amadureira
Copy link
Contributor

Hi  @ewbankkit , could you help-me?

I closed PR 17496 because the branch's name is wrong.  As mentioned on this doc, technical debt should start with tb- prefix.  I fixed others mistakes at this new PR 17539 but anyone saw it.  I don't know if I did something wrong.

Thanks for your help. 

@redspeedy83
Copy link

Any news?

@GryshchenkoAndrii
Copy link

Really interested in this functionality. AWS cloudformation supports it, would love support from terraform side as well.

@amadureira
Copy link
Contributor

Hi Guys,

I've applied the @ewbankkit recommendations.

I forgot to mark that is done. I do it now!

@rodrigdav
Copy link

rodrigdav commented Mar 11, 2021 via email

@sandeep3866
Copy link

any update on this, i don't see this feature is yet supported, looking for some response thanks

@ashish30jain
Copy link

ashish30jain commented Apr 12, 2021

Can we have this released sooner? Its tweaky to update security group on endpoint without this.

@pspot2
Copy link

pspot2 commented Apr 13, 2021

How should security groups be assigned in the meanwhile? After server creation (with the default SG), get to the VPC endpoint that was created and update the SGs there?

@MBarendregt
Copy link

Yep, that is how i do it.. i invoke a custom python script in tf to do that for me so it feels somewhat automated still :)

@armanbaghajyan
Copy link

When this will be available.

@jipumarino
Copy link

jipumarino commented Apr 15, 2021

@MBarendregt how do you do that? When I try creating a VPC-hosted Transfer server Terraform just hangs. TF_LOG=debug shows these errors:

Transfer/CreateServer failed, attempt 3/25, error InternalServiceError: Error calling CreateVpcEndpoint: An internal error has occurred

This is the config I'm trying it with:

resource "aws_transfer_server" "test_vpc" {
  endpoint_type = "VPC"
  endpoint_details {
    subnet_ids = [...]
    vpc_id     = ...
  }
}

Edit: actually, never mind. I think I have this figured out, it has to do with our VPC config.

@quentin9696
Copy link

Hi,

I'm also bocked by this feature. With this, impossible to create transfer server using shared VPC

In an aws account without vpc sharing, I create a vpc endpoint, then I use VPC_ENDPOINT and attached my transfer.server endpoint

@rodrigdav
Copy link

So I did this using the null_resource and calling out to the AWS CLI to add the security groups.

resource "null_resource" "update-vpc-endpoint-security-group" {
  provisioner "local-exec" {
    command = "aws ec2 modify-vpc-endpoint --vpc-endpoint-id ${join("",aws_transfer_server.transfer_server_vpc.endpoint_details.*.vpc_endpoint_id)} --add-security-group-ids '${data.terraform_remote_state.VPC.outputs.Baseline_SG_ID}'"
  }
}

Hope that helps somebody.

@redspeedy83
Copy link

Thanks , @rodrigdav

we can use this workaorund but it would be interesting if resource "aws_transfer_server" could include this feature.

Any news about this?

Regards.

@massettim
Copy link

Any news about it?

@ewbankkit
Copy link
Contributor Author

This issue is on the current quarter's roadmap.

@ewbankkit
Copy link
Contributor Author

This has been addressed via #17539 (thanks to @amadureira for getting the solution started) and should be available in v3.49.0 of the Terraform AWS Provider next week.
Note that the solution requires use of the EC2 DescribeVpcEndpoints and ModifyVpcEndpoint APIs for the Transfer Server VPC endpoint type, so IAM permissions should be modified appropriately - this is mentioned in the resource documentation.

@github-actions
Copy link

github-actions bot commented Aug 2, 2021

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/transfer Issues and PRs that pertain to the transfer service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.