I have a problem with github action and terraform.
I have fives repository on my github account. I'm able to clone/push/pull them from my computer thanks to my ssh key.
On my main.tf file, I've created some module when the source are my other repository :
module "1" {
source = "git@github.com:my_user/XXX.git"
}
module "2" {
source = "git@github.com:my_user/XXX.git"
}
module "3" {
source = "git@github.com:my_user/XXX.git"
}
module "4" {
source = "git@github.com:my_user/XXX.git"
}
If I execute these commands from my computer :
terraform init
terraform plan
terraform apply -auto-approve
Everything works well.
If I try make a github action, I've this error at the terraform init step :
│ git@github.com: Permission denied (publickey).
│ fatal: Could not read from remote repository.
│
│ Please make sure you have the correct access rights
│ and the repository exists.
Why I've this error while each repo are on the same github account ?
I've tried to create a github token with the full rights and I've putted it in the secrets section of my git and in the env section of my .yaml :
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
But I've the same error.
There is someone to help me ?
Thanks a lot !