├── challenges ├── assets │ ├── Liftoff-Badger-400x400.png │ ├── Rocket-Engine-Building-400x400.png │ ├── Space-Badger-no-circle-smaller.jpg │ ├── TerraformOnAzure-Background-Final.jpg │ ├── Rocket-Badger-2nd-stage-circle-400x400.png │ └── Spaceship-inside-circle-crop-400x400.png ├── challenge5 │ ├── assets │ │ └── consul-federation.yaml │ └── README.md ├── challenge3 │ └── Readme.md ├── challenge4 │ └── Readme.md ├── challenge2 │ └── Readme.md └── challenge1 │ └── Readme.md ├── .github └── ISSUE_TEMPLATE │ ├── challenge-solution-submission.md │ ├── feature_request.md │ └── bug_report.md ├── .gitignore ├── LICENSE ├── Contributing.md └── README.md /challenges/assets/Liftoff-Badger-400x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Terraform-On-Azure-Workshop/terraform-azure-hashiconf2020/HEAD/challenges/assets/Liftoff-Badger-400x400.png -------------------------------------------------------------------------------- /challenges/assets/Rocket-Engine-Building-400x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Terraform-On-Azure-Workshop/terraform-azure-hashiconf2020/HEAD/challenges/assets/Rocket-Engine-Building-400x400.png -------------------------------------------------------------------------------- /challenges/assets/Space-Badger-no-circle-smaller.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Terraform-On-Azure-Workshop/terraform-azure-hashiconf2020/HEAD/challenges/assets/Space-Badger-no-circle-smaller.jpg -------------------------------------------------------------------------------- /challenges/assets/TerraformOnAzure-Background-Final.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Terraform-On-Azure-Workshop/terraform-azure-hashiconf2020/HEAD/challenges/assets/TerraformOnAzure-Background-Final.jpg -------------------------------------------------------------------------------- /challenges/assets/Rocket-Badger-2nd-stage-circle-400x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Terraform-On-Azure-Workshop/terraform-azure-hashiconf2020/HEAD/challenges/assets/Rocket-Badger-2nd-stage-circle-400x400.png -------------------------------------------------------------------------------- /challenges/assets/Spaceship-inside-circle-crop-400x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Terraform-On-Azure-Workshop/terraform-azure-hashiconf2020/HEAD/challenges/assets/Spaceship-inside-circle-crop-400x400.png -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/challenge-solution-submission.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Challenge Solution Submission 3 | about: Submit your solution for one of the Terraform on Azure coding challenges 4 | title: "[CHALLENGE SUBMISSION] " 5 | labels: challenge solution 6 | assignees: '' 7 | 8 | --- 9 | 10 | Please provide the following information for your submission: 11 | 12 | ### What is your name? (First, Last) 13 | 14 | ### Where is your GitHub Repo ?(With your challenge solution) 15 | 16 | ### What Challenge is this for? (Challenge number between 1 and 5) 17 | 18 | ### (Optional) Anything else we should know? e.g., language used, location, blog post? 19 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Local .terraform directories 2 | **/.terraform/* 3 | 4 | # .tfstate files 5 | *.tfstate 6 | *.tfstate.* 7 | terraform.tfvars 8 | 9 | # Crash log files 10 | crash.log 11 | 12 | # Ignore any .tfvars files that are generated automatically for each Terraform run. Most 13 | # .tfvars files are managed as part of configuration and so should be included in 14 | # version control. 15 | # 16 | # example.tfvars 17 | 18 | # Ignore override files as they are usually used to override resources locally and so 19 | # are not checked in 20 | override.tf 21 | override.tf.json 22 | *_override.tf 23 | *_override.tf.json 24 | 25 | # Include override files you do wish to add to version control using negated pattern 26 | # 27 | # !example_override.tf 28 | 29 | # Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan 30 | # example: *tfplan* 31 | 32 | # Kubernetes 33 | kube_config.yaml 34 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Terraform-On-Azure-Workshop 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /challenges/challenge5/assets/consul-federation.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | data: 3 | caCert: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM3akNDQXBTZ0F3SUJBZ0lSQU9MWE9YNThIbFcwRmNRdlArakYycHd3Q2dZSUtvWkl6ajBFQXdJd2dia3gKQ3pBSkJnTlZCQVlUQWxWVE1Rc3dDUVlEVlFRSUV3SkRRVEVXTUJRR0ExVUVCeE1OVTJGdUlFWnlZVzVqYVhOagpiekVhTUJnR0ExVUVDUk1STVRBeElGTmxZMjl1WkNCVGRISmxaWFF4RGpBTUJnTlZCQkVUQlRrME1UQTFNUmN3CkZRWURWUVFLRXc1SVlYTm9hVU52Y25BZ1NXNWpMakZBTUQ0R0ExVUVBeE0zUTI5dWMzVnNJRUZuWlc1MElFTkIKSURNd01UVXlNekF6TmprNU1EUTRORFkzTXpnM05EUTRNemM0T1RJeU1EUTBOREl6TWpNME9EQWVGdzB5TURBMgpNalV3T1RJek1EZGFGdzB5TlRBMk1qUXdPVEl6TURkYU1JRzVNUXN3Q1FZRFZRUUdFd0pWVXpFTE1Ba0dBMVVFCkNCTUNRMEV4RmpBVUJnTlZCQWNURFZOaGJpQkdjbUZ1WTJselkyOHhHakFZQmdOVkJBa1RFVEV3TVNCVFpXTnYKYm1RZ1UzUnlaV1YwTVE0d0RBWURWUVFSRXdVNU5ERXdOVEVYTUJVR0ExVUVDaE1PU0dGemFHbERiM0p3SUVsdQpZeTR4UURBK0JnTlZCQU1UTjBOdmJuTjFiQ0JCWjJWdWRDQkRRU0F6TURFMU1qTXdNelk1T1RBME9EUTJOek00Ck56UTBPRE0zT0RreU1qQTBORFF5TXpJek5EZ3dXVEFUQmdjcWhrak9QUUlCQmdncWhrak9QUU1CQndOQ0FBUmoKYkI1QUlERGJKcUljZ2xSZnhWTGxpVDA5b3pHUnkrY3o4Y2RWaFFFaXJBRjBPWUtoUXJmUjJodHZGYjJlcWhvSApZcVBQanBLRi90cWhsNmxteHdMSm8zc3dlVEFPQmdOVkhROEJBZjhFQkFNQ0FZWXdEd1lEVlIwVEFRSC9CQVV3CkF3RUIvekFwQmdOVkhRNEVJZ1FncW1mNkkxbHg1ZVFYV0t5RkZvL2dVRWxFZnYzMmE1SUowN2gvMUZmeHNDSXcKS3dZRFZSMGpCQ1F3SW9BZ3FtZjZJMWx4NWVRWFdLeUZGby9nVUVsRWZ2MzJhNUlKMDdoLzFGZnhzQ0l3Q2dZSQpLb1pJemowRUF3SURTQUF3UlFJZ0tieTdBOVE4elhTaTFTak9mdit5eFFEK3RZbHpHZnhBOFBLVkhneTQ4YUVDCklRRFl2bk45ZmVvZkplRUhES0VaTmdFa1VuRHJpZnMyeGsxNnlFUmF0V0Uwd1E9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg== 4 | caKey: LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IY0NBUUVFSUlkcGQ0WUJqZTFPaXE0YzBYaFU0VWxRcmpOVHF5enFLQ2UxUTVNRGxHZHpvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFWTJ3ZVFDQXcyeWFpSElKVVg4VlM1WWs5UGFNeGtjdm5NL0hIVllVQklxd0JkRG1Db1VLMwowZG9iYnhXOW5xb2FCMktqejQ2U2hmN2FvWmVwWnNjQ3lRPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo= 5 | gossipEncryptionKey: eGNJR0NVVXJvWHNsVUs0dUwrUHI2eUFVYU5uS1ZKekhPdXVyeFUrTkN1TT0= 6 | replicationToken: NzliZmViMjgtNDM1ZS1hMGE1LTEwNWEtY2Q5OWVkYWNkZmVh 7 | serverConfigJSON: eyJwcmltYXJ5X2RhdGFjZW50ZXIiOiJkYzEiLCJwcmltYXJ5X2dhdGV3YXlzIjpbIjUxLjEzNy4yMTQuMjQ2OjQ0MyJdfQ== 8 | kind: Secret 9 | metadata: 10 | creationTimestamp: "2020-06-25T09:25:19Z" 11 | name: consul-federation 12 | namespace: default 13 | resourceVersion: "1192" 14 | selfLink: /api/v1/namespaces/default/secrets/consul-federation 15 | uid: cfd586e7-cc71-480e-950e-93109bbf0817 16 | type: Opaque 17 | -------------------------------------------------------------------------------- /Contributing.md: -------------------------------------------------------------------------------- 1 | # Contribution Guidelines 2 | 3 | > Parts of this section are replicated in the [README](README.md) for convenience 4 | 5 | The #TerraformOnAzure challenge will happen between June 22 and June 26, 2020. Be among the first contributors and solve the challenge within 24 hours of publishing. Then submit your solution to this repo, as described below. 6 | 7 | ## Contributing 🚩 8 | 9 | This project welcomes contributions and suggestions. Most contributions require you to agree to a 10 | Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us 11 | the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. 12 | 13 | When you submit a pull request, a CLA bot will automatically determine whether you need to provide 14 | a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions 15 | provided by the bot. You will only need to do this once across all repos using our CLA. 16 | 17 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 18 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or 19 | contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 20 |
11 |
12 |
13 | Our **Final** Coding Challenge #5 is now available for you to work on!
14 |
15 |
16 | ## How does it work? 🧰
17 |
18 | This week (June 22-26), while HashiConf Digital takes place, we're releasing a **daily #TerraformOnAzure coding challenge**. You have **24 hours** to submit your coding challenge solution, before we will publish ours in this repo.
19 |
20 | Of course, you're free to continue to work longer on your coding challenge and still it! We want to learn from you as well! The goal is for everyone to learn and expore.
21 |
22 | Get your exclusive [space-themed gift](./challenges/assets/TerraformOnAzure-Background-Final.jpg) now 🎁! We have created an exclusive, custom background, for you to use in all your video calls!
23 |
24 | 
25 |
26 |
27 | ## Challenges 💻
28 |
29 | | Date | Challenge | Description | Video |
30 | | ---- | --------- | ----------- | ----- |
31 | | June 22, 2020 | [Challenge 1](./challenges/challenge1/Readme.md) | Deploying an Azure App Service using Terraform CLI and the Azure CLI |[day1](https://aka.ms/tfonazure/vid/day1) |
32 | | June 23, 2020 | [Challenge 2](./challenges/challenge2/Readme.md) | Deploying databases on Azure using Terraform CLI | [day2](https://aka.ms/tfonazure/vid/day2) |
33 | | June 24, 2020 | [Challenge 3](./challenges/challenge3/Readme.md) | Remote state and CI/CD with GitHub Actions | [day3](https://aka.ms/tfonazure/vid/day3) |
34 | | June 25, 2020 | [Challenge 4](./challenges/challenge4/Readme.md) | Deploying on Azure Kubernetes Service | [day4](https://aka.ms/tfonazure/vid/day4) |
35 | | June 26, 2020 | [Challenge 5](./challenges/challenge5/README.md) | Connecting it all with Consul | [day5](https://aka.ms/tfonazure/vid/day5) |
36 |
37 |
38 | ## Submit your solutions? 🔥
39 |
40 | You can find the detailed instructions in our [Contributing.md](Contributing.md) guidelines, but here's the TL;DR.
41 |
42 | * Submit your solution as a new [Challenge Solution Submission ISSUE](https://github.com/Terraform-On-Azure-Workshop/terraform-azure-hashiconf2020/issues/new/choose) for each challenge to this GitHub repository.
43 |
44 | We'd love it if you also **share your experience on social media**! You can use the **#TerraformOnAzure** Twitter hashtag to do so.
45 |
46 |
47 | ## Suggested resources 🚀
48 |
49 | * [Visual Studio Code](https://code.visualstudio.com?ocid=aid3015373_ThankYou_DevComm&eventId=HashiConfTerraformonAzure_JK1-K2-hoArJ)
50 | * Azure Subscription: [Send us a DM on Twitter](https://twitter.com/msdev_nl) or [sign up](https://azure.microsoft.com/en-us/free/?ocid=aid3015373_ThankYou_DevComm&eventId=HashiConfTerraformonAzure_JK1-K2-hoArJ) for a free Azure account
51 | * [Terraform](https://www.terraform.io/)
52 |
53 | ## Contributing 🚩
54 |
55 | This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
56 |
57 | When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
58 |
59 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
60 |
--------------------------------------------------------------------------------
/challenges/challenge3/Readme.md:
--------------------------------------------------------------------------------
1 | # Challenge 3: Remote state and CI/CD with GitHub Actions
2 |
3 | 
4 |
5 | **Watch** our [introduction video](https://aka.ms/tfonazure/vid/day3) to learn all about this #TerraformOnAzure coding challenge!
6 |
7 |
8 | ## Description
9 |
10 | So far, you have been working on your local developer machine to provision and deploy the application. In this third challenge, you will setup a **Continuous Integration/Continuous Deployment (CI/CD) pipeline using [GitHub Actions](https://help.github.com/en/actions)**.
11 |
12 | However, when running Terraform locally it also stores the current state of the infrastructure in a local file. When running a CI/CD pipeline, or when working in a team, you need to share the current state of the infrastructure. Terraform allows you to define remote state in a central location. In this challenge, you will configure the Terraform CLI to **[store the remote state in Azure Storage](https://docs.microsoft.com/en-us/azure/developer/terraform/store-state-in-azure-storage?ocid=aid3015373_ThankYou_DevComm&eventId=HashiConfTerraformonAzure_JK1-K2-hoArJ)**.
13 |
14 | Also, keep in mind that when you run Terraform locally, you typically authenticate interactively as a user to the Azure CLI. In a CI/CD pipeline, there is no interactive user session, so you will need to **[authenticate to Azure using a Service Principal](https://www.terraform.io/docs/providers/azurerm/guides/service_principal_client_secret.html)**.
15 |
16 |
17 | ## Success criteria 🏆
18 |
19 | To successfully complete this challenge, you will need to:
20 |
21 | * Create an Azure Storage account to store the Terraform remote state
22 | * Use the Terraform CLI to configure the remote state to use the remote state on Azure Storage
23 | * Setup a Service Principal in Azure to allow non-interactive authentication
24 | * Setup a CI/CD workflow in GitHub Actions that:
25 | * runs the Terraform CLI to provision the Azure infrastructure resources,
26 | * runs the Azure CLI to deploy the sample application to Azure App Service
27 |
28 |
29 | ## How to submit your solution?
30 |
31 | Within 24 hours of making the coding challenge public, submit your solution as a custom ISSUE to this GitHub repository.
32 |
33 | 1. Create your own Github repo with your solution for that challenge.
34 | 2. Create a new [Challenge Solution Submission issue](https://github.com/Terraform-On-Azure-Workshop/terraform-azure-hashiconf2020/issues/new/choose) in our repo for each challenge and fill all the details.
35 | 3. Submit the issue.
36 |
37 | ## Prerequisites
38 |
39 | - An Azure subscription, where you have permissions to create resource groups. You can get an [Azure free account](https://azure.microsoft.com/en-us/free/?ocid=aid3015373_ThankYou_DevComm&eventId=HashiConfTerraformonAzure_JK1-K2-hoArJ) or send us a DM us [on Twitter](https://twitter.com/msdev_nl) and we'll provide you with an Azure Pass.
40 | - A [GitHub account](https://github.com/), allowing you to create a custom issue to submit your solution.
41 | - Fork the [sample application](https://github.com/Terraform-On-Azure-Workshop/AzureEats-Website) to your GitHub account.
42 |
43 | ## Resources/Tools Used 🚀
44 |
45 | * [Azure Cloud Shell](https://shell.azure.com)
46 | * [Visual Studio Code](https://code.visualstudio.com)
47 | * [Terraform](https://www.terraform.io/)
48 |
49 | ## More Resources
50 |
51 | * ✅ [Terraform GitHub Actions documentation](https://www.terraform.io/docs/github-actions/setup-terraform.html)
52 | * ✅ [Authenticating using a Service Principal](https://www.terraform.io/docs/providers/azurerm/guides/service_principal_client_secret.html)
53 | * ✅ [GitHub Actions documentation](https://help.github.com/en/actions)
54 | * ✅ [Store state in Azure Storage](https://docs.microsoft.com/en-us/azure/developer/terraform/store-state-in-azure-storage?ocid=aid3015373_ThankYou_DevComm&eventId=HashiConfTerraformonAzure_JK1-K2-hoArJ)
55 |
56 | ## Questions? Comments? 🙋♀️
57 |
58 | If you have any questions about the challenges, feel free to open an **[ISSUE HERE](https://github.com/Terraform-On-Azure-Workshop/terraform-azure-hashiconf2020/issues)**.
59 |
60 | Make sure to mention which challenge is problematic. We'll get back to you soon!
61 |
62 | ## I don't have an Azure subscription! 🆘
63 |
64 | If you don't have an Azure subscription yet, you can DM us [on Twitter](https://twitter.com/msdev_nl) and we'll provide you with a 30-day Azure subscription! Alternatively, you can also [sign up](https://azure.microsoft.com/en-us/free/?ocid=aid3015373_ThankYou_DevComm&eventId=HashiConfTerraformonAzure_JK1-K2-hoArJ) for an Azure free account.
65 |
--------------------------------------------------------------------------------
/challenges/challenge4/Readme.md:
--------------------------------------------------------------------------------
1 | # Challenge 4: Deploying to Azure Kubernetes Service
2 |
3 | 
4 |
5 | **Watch** our [introduction video](https://aka.ms/tfonazure/vid/day4) to learn all about this #TerraformOnAzure coding challenge!
6 |
7 | ## Description
8 |
9 | Now that we have our CI/CD pipeline setup for the team, it's time to pimp our web hosting to run on a Kubernetes cluster, specifically [Azure Kubernetes Services](https://docs.microsoft.com/en-us/azure/aks/intro-kubernetes?ocid=aid3015373_ThankYou_DevComm&eventId=HashiConfTerraformonAzure_JK1-K2-hoArJ) (AKS). AKS is a fully managed Kubernetes cluster in Azure, and reduces the complexity of managing Kubernetes by offloading much of the operational responsibility to Azure.
10 |
11 | The first step to deploy an application to a Kubernetes cluster, is to create container image using the Docker CLI. How this container image is created is described in a **Dockerfile**. The sample application already contains a preconfigured Dockerfile.
12 |
13 | The next step is to publish this container image to a container repository, this could be **[Azure Container Registry](https://docs.microsoft.com/en-us/azure/container-registry/container-registry-intro?ocid=aid3015373_ThankYou_DevComm&eventId=HashiConfTerraformonAzure_JK1-K2-hoArJ)** (ACR) or any other registry (e.g. Docker Hub).
14 |
15 | You can find a [tutorial on how to publish a container image in ACR](https://docs.microsoft.com/en-us/azure/container-registry/container-registry-get-started-docker-cli?ocid=aid3015373_ThankYou_DevComm&eventId=HashiConfTerraformonAzure_JK1-K2-hoArJ) in our documentation site.
16 |
17 | Finally, we need to describe how to deploy our application on a Kubernetes cluster. To do this, you can use the open-source [Helm packaging tool](https://helm.sh). You will find a Helm chart in the [sample application](https://github.com/Terraform-On-Azure-Workshop/AzureEats-Website) repo.
18 |
19 | > **Note:** make sure to update the image repository in the ```values.yaml``` file of the Helm chart to match your container repository:
20 |
21 | ```yaml
22 | image:
23 | repository: tailwindtradersacr.azurecr.io/web.api
24 | tag: prod
25 | pullPolicy: Always
26 | ```
27 |
28 |
29 | ## Success criteria 🏆
30 |
31 | To successfully complete this challenge, you will need to:
32 |
33 | 1. Use the Docker CLI to build a Docker image for the sample application and store it in a container registry
34 | 2. Use the Terraform CLI to provision an AKS cluster.
35 | 3. Deploy the [sample application](https://github.com/Terraform-On-Azure-Workshop/AzureEats-Website) on the AKS cluster using Helm
36 |
37 |
38 | ## How to submit your solution?
39 |
40 | Within 24 hours of making the coding challenge public, submit your solution as a custom ISSUE to this GitHub repository.
41 |
42 | 1. Create your own Github repo with your solution for that challenge.
43 | 2. Create a new [Challenge Solution Submission issue](https://github.com/Terraform-On-Azure-Workshop/terraform-azure-hashiconf2020/issues/new/choose) in our repo for each challenge and fill all the details.
44 | 3. Submit the issue.
45 |
46 | ## Prerequisites
47 |
48 | - An Azure subscription, where you have permissions to create resource groups. You can get an [Azure free account](https://azure.microsoft.com/en-us/free/?ocid=aid3015373_ThankYou_DevComm&eventId=HashiConfTerraformonAzure_JK1-K2-hoArJ) or send us a DM us [on Twitter](https://twitter.com/msdev_nl) and we'll provide you with an Azure Pass.
49 | - A [GitHub account](https://github.com/), allowing you to create a custom issue to submit your solution.
50 | - Fork the [sample application](https://github.com/Terraform-On-Azure-Workshop/AzureEats-Website) to your GitHub account.
51 |
52 | ## Resources/Tools Used 🚀
53 |
54 | * [Azure Cloud Shell](https://shell.azure.com)
55 | * [Visual Studio Code](https://code.visualstudio.com)
56 | * [Terraform](https://www.terraform.io/)
57 |
58 | ## More Resources
59 |
60 | * ✅ [Azure Kubernets Service documentation](https://docs.microsoft.com/en-us/azure/aks/intro-kubernetes?ocid=aid3015373_ThankYou_DevComm&eventId=HashiConfTerraformonAzure_JK1-K2-hoArJ)
61 | * ✅ [Tutorial: Create a Kubernetes cluster with AKS and Terraform](https://docs.microsoft.com/en-us/azure/developer/terraform/create-k8s-cluster-with-tf-and-aks?ocid=aid3015373_ThankYou_DevComm&eventId=HashiConfTerraformonAzure_JK1-K2-hoArJ)
62 | * ✅ [Tutorial: deploy an existing application to AKS using Helm](https://docs.microsoft.com/en-us/azure/aks/kubernetes-helm?ocid=aid3015373_ThankYou_DevComm&eventId=HashiConfTerraformonAzure_JK1-K2-hoArJ)
63 |
64 |
65 | ## Questions? Comments? 🙋♀️
66 |
67 | If you have any questions about the challenges, feel free to open an **[ISSUE HERE](https://github.com/Terraform-On-Azure-Workshop/terraform-azure-hashiconf2020/issues)**.
68 |
69 | Make sure to mention which challenge is problematic. We'll get back to you soon!
70 |
71 | ## I don't have an Azure subscription! 🆘
72 |
73 | If you don't have an Azure subscription yet, you can DM us [on Twitter](https://twitter.com/msdev_nl) and we'll provide you with a 30-day Azure subscription! Alternatively, you can also [sign up](https://azure.microsoft.com/en-us/free/) for an Azure free account.
74 |
--------------------------------------------------------------------------------
/challenges/challenge5/README.md:
--------------------------------------------------------------------------------
1 | # Challenge 5: connecting it all with Consul
2 |
3 | 
4 |
5 | **Watch** our [introduction video](https://aka.ms/tfonazure/vid/day5) to learn all about this #TerraformOnAzure coding challenge!
6 |
7 | ## Description
8 |
9 | With our applications now running on Azure Kubernetes Service (AKS), we want make sure that they can communicate with each other, while still staying secure.
10 | In this final challenge, you will set up [Consul](https://www.consul.io) on your previously created AKS cluster using [Terraform](https://www.terraform.io).
11 | This will allow us to have mTLS encryption between all our services, and manage which services can communicate with each other.
12 |
13 | You will then be able to create a Service Mesh that [spans](https://www.consul.io/docs/connect/mesh-gateway) all of the AKS clusters of everyone participating.
14 |
15 | ## Success criteria 🏆
16 |
17 | To successfully complete this challenge, you will need to [deploy](https://www.consul.io/docs/k8s/installation/overview) a **single node Consul cluster** on your AKS cluster using the [Helm provider](https://www.terraform.io/docs/providers/helm/r/release.html) for Terraform.
18 | The datacenter of the Consul cluster configuration must be named after your GitHub username.
19 |
20 | The Consul cluster **must be federated with the primary datacenter**.
21 | To [federate](https://www.consul.io/docs/connect/wan-federation-via-mesh-gateways) the Consul clusters, you need to create a Kubernetes secret, containing all the needed configuration to federate Consul, from the `assets/consul-federation-secret.yaml` file that is provided with the challenge.
22 |
23 | In order for the Mesh Gateways to reach each other, they need to be **exposed on a public IP**.
24 | This can be done by [creating a static IP](https://www.terraform.io/docs/providers/azurerm/r/public_ip.html) and a [Kubernetes service](https://docs.microsoft.com/en-us/azure/aks/static-ip#create-a-service-using-the-static-ip-address) with [Terraform](https://www.terraform.io/docs/providers/kubernetes/r/service.html) that points at the selectors `app=consul` and `component=mesh-gateway`.
25 |
26 | To check if your cluster has successfully joined the other clusters, you can run `consul members -wan` inside the consul-server-0 pod of your AKS cluster.
27 | You should see a similar output as below, including `consul-server-0.