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

Return Transfer ID #23

Open
Spritekin opened this issue Jun 24, 2022 · 1 comment
Open

Return Transfer ID #23

Spritekin opened this issue Jun 24, 2022 · 1 comment

Comments

@Spritekin
Copy link

Spritekin commented Jun 24, 2022

Describe the Feature

The transfer server ID is not being returned and there is no clear direct way to identify the server. Return the server ID.

Expected Behavior

I understand the ID returned in outputs is not the transfer server ID, so a new output variable is required:

output "transfer_server_id" {
  description = "The Transfer Server ID"
  value       = module.this.enabled ? join("", aws_transfer_server.default.*.id) : null
}

or alternatively return the whole object

output "transfer_server" {
  description = "The Transfer Server"
  value       = module.this.enabled ? aws_transfer_server.default : null
}

Use Case

I would like to reference the transfer server downstream so I can add some features not managed by this module (i.e. an unrestricted user or multiple users on the same folder).

Describe Ideal Solution

data "aws_transfer_server" "sftp" {
  server_id = module.sftp.transfer_server_id
}

Or if solution 2 is used, then I can just get it as

data "aws_transfer_server" "example" {
  server_id = module.sftp.transfer_server.id
}

Alternatives Considered

I was looking to tag the transfer server so I can lookup the server by tags but this functionality is not available in the transfer_server data object.

Additional Context

Add any other context or screenshots about the feature request here.

@Spritekin
Copy link
Author

Spritekin commented Jun 24, 2022

Update, I have noticed the endpoint contains the server id as the first item in the URL. I'm changing to fetch the first word in the endpoint for now.

module "sftp" {
  source          = "cloudposse/transfer-sftp/aws"
  version         = "0.6.0"
  ... all other config
}

data "aws_transfer_server" "sftp" {  
  server_id = split(".", module.sftp.transfer_endpoint)[0]
  depends_on = [module.sftp]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant