Help - Join Node on Docker Swarm

Hey guys, I’m trying join two nodes on Docker Swarm Manager but, not success.
I’m using AWS, Terraform and Docker Swarm.

When I create my Docker Swarm Manager, I’ve this configurations on my user-data:

    #!/bin/bash
    hostnamectl set-hostname node-01
    curl -fsSL https://get.docker.com -o get-docker.sh
    sh get-docker.sh
    chmod 666 /var/run/docker.sock
    echo 'ClientAliveInterval 60' | sudo tee --append /etc/ssh/sshd_config
    sudo service ssh restart
    sudo apt update

    sudo apt install nginx -y
    sudo apt install awscli -y

    SWARM_IP=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)

    docker swarm init --advertise-addr $SWARM_IP

    docker service create \
      --name portainer \
      --publish 9000:9000 \
      --constraint 'node.role == manager' \
      --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
      --mount type=volume,src=portainer_data,dst=/data \
      portainer/portainer-ce:latest

    SWARM_TOKEN=$(docker swarm join-token -q worker)

    aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
    aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
    aws configure set region $AWS_REGION  

    aws ssm put-parameter \
    --name "SwarmToken" \
    --type "String" \
    --value "$SWARM_TOKEN" \
    --overwrite

    aws ssm put-parameter \
    --name "SwarmIp" \
    --type "String" \
    --value "$SWARM_IP" \
    --overwrite

In this moment, My Docker Swarm has been UP with Portainer.

After, my terraform build two Nodes and in this moment, is used this user-data to insert Nodes on Docker Swarm Manager:

  #!/bin/bash
  hostnamectl set-hostname ${each.key}
  curl -fsSL https://get.docker.com -o get-docker.sh
  sh get-docker.sh
  chmod 666 /var/run/docker.sock
  echo 'ClientAliveInterval 60' | sudo tee --append /etc/ssh/sshd_config
  sudo service ssh restart
  sudo apt update
  sudo apt install awscli -y

  aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
  aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
  aws configure set region $AWS_REGION  

  SWARM_TOKEN=$(aws ssm get-parameter --name "SwarmToken" --query "Parameter.Value" --output text)
  SWARM_IP=$(aws ssm get-parameter --name "SwarmIp" --query "Parameter.Value" --output text)

  docker swarm join --token $SWARM_TOKEN  $SWARM_IP:2377

And, it should having three Nodes on My Docker swarm, But, have just one:

I check my Paramter Store and it’s okay.

All machines are Up.

Somebody can help me please ?

News: I try running the Join commands manualy and had success.
The problem is just when running with user Data by terraform