env "ec2_instance_profile" is not respected
Crismon96 opened this issue · 5 comments
Before all: Thanks for the github action. I was able to quickly deploy sandbox environments and your software is greatly appreciated by me.
Now to the issue: From the documentation:
The AWS IAM instance profile to use for the EC2 instance. Default is ${GITHUB_ORG_NAME}-${GITHUB_REPO_NAME}-${GITHUB_BRANCH_NAME} I take that setting this variable will take a IAM role that can be used by the EC2 instance. WHen I set the environment variable in my action the default role is still created and attached. The logs show the expected default outcome:
+ name = "p5m-p5m-pre-127-e7l-e10s-for-e2h-pr-9"
+ name_prefix = (known after apply)
+ path = "/"
+ role_last_used = (known after apply)
+ tags_all = {
+ "AWSResourceIdentifier" = "p5m-p5m-pre-127-e7l-e10s-for-e2h-pr-9"
+ "GitHubAction" = "bitovi/github-actions-deploy-docker-to-ec2"
+ "GitHubBranchName" = "pre-1287-ephemeral-environments-for-each-pr-9"
+ "GitHubOrgName" = "predium"
+ "GitHubRepoName" = "predium"
+ "OperationsRepo" = "bitovi/github-actions-deploy-docker-to-ec2/operations/deployment"
+ "OperationsRepoEnvironment" = "deployment"
+ "created_with" = "terraform"
}
+ unique_id = (known after apply)
}
I have filed this issue in the Discord channel already. The response was the following:
Looks like you are correct, for some reason, the variable to set that is there but not being used. Instead, the aws_resource_identifier is being used.
Expected result: The AWS IAM role with the name of specified variable is taken.
This is my Github action:
steps:
- id: EC2-sandbox-deploy
uses: bitovi/github-actions-deploy-docker-to-ec2@v0.5.8
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_default_region: ${{ secrets.AWS_REGION }}
domain_name: <my-domain>
sub_domain: ${{ github.GITHUB_REF_NAME }}
create_sub_cert: true
ec2_instance_type: t3.large
ec2_volume_size: 32
app_port: 3000
docker_full_cleanup: true
ansible_start_docker_timeout: 1800
ec2_instance_profile: sandbox-role
@Crismon96 could you test using the current branch and confirm it's working for you?
Just change the uses: to
uses: bitovi/github-actions-deploy-docker-to-ec2@140-env-ec2_instance_profile-is-not-respected
Thanks!
@Crismon96 This is solved in the latest version.
Would like to delete that branch, but as it wasn't merged before v1 release, if you are using it, it will stop to work.
Will do so in a week. Let me know if possible before.
Closing due to inactivity. Will be deleting the branch.
Feel free to open another issue if needed.