On my first article we created a nice local development environment for Elixir and Phoenix with Docker and docker-compose. Now it's time to write s...
For further actions, you may consider blocking this person and/or reporting abuse
Hi mate,
thanks for the great and educational article :)
Could you pls help with this issue by any chance? :)
terraform plan
Error: Reference to undeclared resource
on deploy_user.tf line 24, in resource "aws_iam_user_policy" "ci_ecr_access":
24: "Resource": "${aws_ecr_repository.myapp_repo.arn}"
A managed resource "aws_ecr_repository" "myapp_repo" has not been declared in
the root module.
This basically means that the ECR repository you are referring to in the user policy does not exist. Check the naming of the ECR repository resource.
I fixed one typo from the article, there was unnecessary "_url" in the ECR naming, sorry about that!
Thanks for getting back to me, mate :)
Sorry that asking such silly question. Could I fix it easily by adding that ECR repo onto AWS before runnig Terrafrom commands? Unfortunatelly, I haven't touched this ECR service, yet :)
Oh, that's tottaly fine, my typos are beond my understanding lol
Well, you can add it manually through AWS console if you want to. Also, you can just rename the resource and Terraform will destroy the old one and create a new one with the new name. :)
Thanks bro, sorry, I didn't correct that typo earlier, I thought it's gonna be a next iteration of the following article heh :)
Couldn't trace out this error yet when pusshing code to my GitLab repo. Have you seen it before?
$ which elixir
/usr/local/bin/elixir
$ mix --version
Erlang/OTP 22 [erts-10.7.2.4] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1]
Mix 1.10.4 (compiled with Erlang/OTP 22)
$ ln -s /usr/local/bin/mix /usr/bin/mix
$ mix local.rebar --force
Is this output on the CI or on your local machine? If local, what OS are you using?
Yeah, on CI. I've already pushed that code to my repo :)
pastebin.com/vdbDW8Um
gitlab.com/organicnz/myapp-terraform
I see your problem! Please place the
.gitlab-ci.yml
to repository which contains your Elixir + Phoenix application. It should be placed to the root of the repository.Second thing, never push the state files publicly to any platform. They should be ignored with
.gitignore
, crypted with git-crypt (or other encrypting tool) or the best solution would be to use remote state.Would it be appropriate if I use your Elixir application for the CI github.com/hlappa/microservice_exe... or anyone? :)
Jeez, that's right I completely forgot to sanitise that area, already added .gitignore file then will try to figure out how to push it to the remote state on AWS :)
Thanks for the fantastic write up!
1) FYI as of 1 October 2020 the GitLab free tier was reduced to 400 minutes of CI/CD.
2) The initial CI/CD run failed for me with below message in the test stage. I haven't figured out the fix for this yet.
3) Further down in the tutorial (code block for rds.tf) you've got:
but you haven't defined it in your variables.tf
Sorry for a late reply to you comment, good points!
1) Article is now updated. I didn't know GitLab reduced the minutes from 2000 to 400, which is kinda sad :(
2) Make sure you have Postgres as a service for the test job, the DB url is correctly setup and check your
config/test.ex
that is has proper configuration. Seems like when establishing the connection to DB fails.3) Added to
variables.tf
! :)Hi @Aleksi! Thanks for the article.
Please update the ecs task with the DATAABASE_URL envnvar.
This works.
{"name": "DATABASE_URL", "value": "ecto://${var.db_username}:${var.db_password}@${aws_db_instance.default.address}:${aws_db_instance.default.port}/${var.db_name}"}