Skip to content

Commit

Permalink
Implement 'aws_ssm' connection type #26
Browse files Browse the repository at this point in the history
  • Loading branch information
dominik-przybyl-wttech committed Jan 24, 2024
1 parent b4d8d3b commit 84a7b50
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 8 deletions.
4 changes: 1 addition & 3 deletions examples/aws_ssm/aem.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ resource "aem_instance" "single" {
client {
type = "aws-ssm"
settings = {
user = local.ssm_user
instance_id = aws_instance.aem_single.id
region = "eu-central-1" // TODO infer from AWS provider config
}
Expand All @@ -18,9 +17,8 @@ resource "aem_instance" "single" {
"sudo mkfs -t ext4 ${local.aem_single_data_device}",
"sudo mkdir -p ${local.aem_single_data_dir}",
"sudo mount ${local.aem_single_data_device} ${local.aem_single_data_dir}",
"sudo chown -R ${local.ssm_user} ${local.aem_single_data_dir}",
"echo '${local.aem_single_data_device} ${local.aem_single_data_dir} ext4 defaults 0 0' | sudo tee -a /etc/fstab",
// installing AWS CLI
// installing AWS CLI: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
"sudo yum install -y unzip",
"curl 'https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip' -o 'awscliv2.zip'",
"unzip -q awscliv2.zip",
Expand Down
2 changes: 0 additions & 2 deletions examples/aws_ssm/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ locals {
env_type = "aem-single"
host = "aem_single"

ssm_user = "root"

tags = {
Workspace = "aemc"
Env = "tf-minimal"
Expand Down
1 change: 0 additions & 1 deletion internal/client/client_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func (c ClientManager) connection(typeName string, settings map[string]string) (
}, nil
case "aws-ssm":
return &AWSSSMConnection{
user: settings["user"],
instanceId: settings["instance_id"],
region: settings["region"],
}, nil
Expand Down
3 changes: 1 addition & 2 deletions internal/client/connection_aws_ssm.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
)

type AWSSSMConnection struct {
user string
instanceId string
region string
ssmClient *ssm.Client
Expand All @@ -25,7 +24,7 @@ func (a *AWSSSMConnection) Info() string {
}

func (a *AWSSSMConnection) User() string {
return a.user
return "root"
}

func (a *AWSSSMConnection) Connect() error {
Expand Down

0 comments on commit 84a7b50

Please sign in to comment.