This is a technical assignment for DevOps engineers.
Our goal of this assignment:
- a way for us to test the knowledge and skillset of the candidates.
- a good use of time for candidates to learn from the assignment.
The following setup is required:
- Docker or equivalent, and dind (aka docker-in-docker) support
- Gitlab Account to push the completed assignment (for task 5 only)
- There are 5 main tasks.
- There is no time limit on this.
- Feel free to complete as many tasks (or as little as one), quality is better than quantity.
- Feel free to modify the setup up till the interview.
- Create a new repository on gitlab.com and clone it to local machine.
- Make changes according to the tasks.
- Push the changes to the repository.
- Open the repo to public or grant private access to us.
The setup will be done in container with all these frameworks/tools installed (no action required from candidates).
- localstack (free edition with limited features)
- terraform v1.5
- awscli v1
- jq, curl, make etc
-
Execute
make up
, which will deploy the necessary pieces for the tasks- localstack
- terraform
-
Execute
make conn
, this will enter the containerterraform
.
Context
- Use Terraform to deploy lambda function
- helloworld nodejs has been provided.
main.tf
andvariables.tf
have been provided for direction and scope.
Tasks
- Execute
make list1
, which should return
{
"Functions": []
}
-
Update lambda.tf
-
Create/Update lambda resources, execute
make apply
for the change. -
List lambda functions,
make list1
should return
# incomplete json is displayed here
{
"Functions": [
{
"FunctionName": "helloworld-localstack",
"FunctionArn": "...",
"Runtime": "nodejs18.x",
"Role": "...",
...
}
}
- Invoke lambda function,
make test1
should return
{
"statusCode": 200,
"headers": {
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json"
},
"body": "{\"payload\":\"Hello, world.\"}"
}
Note:
- Use
make plan
ortflocal plan
to test the change. - Use
make apply
ortflocal apply --auto-approve
to apply the change. - Use
make destroy
ortflocal destroy
to remove the change.
Context
- Use terraform to add an apigateway
- Route the lambda function traffic via apigateway
Tasks
- Execute
make list2
, which should return
{
"items": []
}
-
Update apigateway.tf
-
Add/Update apigateway resources
-
Execute
make apply
for the change. -
List apigateway,
make list2
should now return
# incomplete json is displayed here
{
"items": [
{
"id": "...",
"name": "helloworld-localstack",
"description": "Test",
"types": [
"..."
],
...
}
]
}
- Call apigateway endpoint,
make test2
to return
{
"payload": "Hello, world."
}
Context
- Protect the apigateway by using apikey.
Tasks
-
Update apigateway.tf
-
Create apikey with name
helloworld-localstack-test
and associate that with the apigateway method -
Execute
make apply
for the change. -
Execute
make test3
should return an apikey
# example
MTSNsBnqF6heXYZA32kxZmyzlf8Wwv9HYruIKpd
Note:
- API Key in localstack doesn't have actual functionality.
Context
- Use terraform to create custom domain mapping for the apigateway
- Allow request to be called via custom domain (we don't need to manipulate /etc/hosts)
Tasks
-
Update apigateway.tf with custom domain mapping of domain
helloworld.myapp.earth
. -
Execute
make apply
for the change. -
Execute
make test4
should return
helloworld.myapp.earth
Tasks
-
Look into .gitlab-ci.yml
-
Create pipeline step to perform testing of
app/nodejs
application -
Create pipeline step to simulate the deployment (depends on how many previous tasks have been completed)
-
Feel free to add extra CI/CD stages/steps based on past experience of creating a robust, production ready environment.
Send the link of the GitLab repository to the person who requested for this assignment.