User
Provides a AWS Transfer User resource. Managing SSH keys can be accomplished with the aws.transfer.SshKey
resource.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.transfer.Server;
import com.pulumi.aws.transfer.ServerArgs;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.iam.RolePolicy;
import com.pulumi.aws.iam.RolePolicyArgs;
import com.pulumi.aws.transfer.User;
import com.pulumi.aws.transfer.UserArgs;
import com.pulumi.aws.transfer.inputs.UserHomeDirectoryMappingArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var fooServer = new Server("fooServer", ServerArgs.builder()
.identityProviderType("SERVICE_MANAGED")
.tags(Map.of("NAME", "tf-acc-test-transfer-server"))
.build());
var fooRole = new Role("fooRole", RoleArgs.builder()
.assumeRolePolicy("""
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "transfer.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
""")
.build());
var fooRolePolicy = new RolePolicy("fooRolePolicy", RolePolicyArgs.builder()
.role(fooRole.id())
.policy("""
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowFullAccesstoS3",
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": "*"
}
]
}
""")
.build());
var fooUser = new User("fooUser", UserArgs.builder()
.serverId(fooServer.id())
.userName("tftestuser")
.role(fooRole.arn())
.homeDirectoryType("LOGICAL")
.homeDirectoryMappings(UserHomeDirectoryMappingArgs.builder()
.entry("/test.pdf")
.target("/bucket3/test-path/tftestuser.pdf")
.build())
.build());
}
}
Content copied to clipboard
Import
Transfer Users can be imported using the server_id
and user_name
separated by /
.
$ pulumi import aws:transfer/user:User bar s-12345678/test-username
Content copied to clipboard
Properties
Link copied to clipboard
The landing directory (folder) for a user when they log in to the server using their SFTP client. It should begin with a /
. The first item in the path is the name of the home bucket (accessible as ${Transfer:HomeBucket}
in the policy) and the rest is the home directory (accessible as ${Transfer:HomeDirectory}
in the policy). For example, /example-bucket-1234/username
would set the home bucket to example-bucket-1234
and the home directory to username
.
Link copied to clipboard