# AWS Infrastructure Automation with Terraform and Github Action.

<figure><img src="/files/G9GMK8TIFl8IcVRbBw9N" alt=""><figcaption><p>Overview of Project</p></figcaption></figure>

## Overview

> Series of steps that we are going to perform  in this project.
>
> 1. Create a new repository in GitHub to store your Terraform code.
>
> 2. Configure the AWS provider in the `provider.tf` file by specifying your access key and secret key as environment variables or using a credential file.
>
> 3. Write Terraform code to create your AWS infrastructure. This can include resources such as EC2 instances, S3 buckets, RDS databases, VPCs, etc.
>
> 4. Set up a GitHub Actions workflow to run Terraform `init`, `plan`, and `apply` commands. Use `hashicorp/setup-terraform` action to set up Terraform, and `actions/checkout` action to clone your repository.
>
> 5. Save the Terraform state file using `actions/upload-artifact` action so that it can be used by the `terraform destroy` workflow.
>
> 6. Add environment variables for your AWS access key and secret key to your GitHub repository secrets to keep them secure.
>
> 7. Run the GitHub Actions workflow to create your infrastructure. You can use the Terraform output to get the URLs or IPs of the resources created.
>
> 8. When you are done with your infrastructure, run the `terraform destroy` command using a separate GitHub Actions workflow. You can use `actions/download-artifact` action to download the Terraform state file from the `terraform apply` workflow. This workflow should only run on manual triggers and prompt the user for confirmation before destroying the infrastructure.

> By automating your infrastructure with Terraform and GitHub Actions, you can easily spin up and tear down your AWS resources, and keep your infrastructure as code in version control. This makes it easy to collaborate with others and maintain a history of changes to your infrastructure over time.

## Quick links

{% content-ref url="/pages/wzjnRtZtkWZJWWXzMLip" %}
[Terraform Code](/devops-project/initial/terraform-code.md)
{% endcontent-ref %}

{% content-ref url="/pages/1R94S4g6PInfcRh8Jsgm" %}
[Push code to Github Repo](/devops-project/initial/push-code-to-github-repo.md)
{% endcontent-ref %}

## Get Started

We've put together some helpful guides for you to get setup with our product quickly and easily.

{% content-ref url="/pages/E0iEoV9IRXdQpsRPAA1Q" %}
[Trigger Workflow](/devops-project/results/trigger-workflow.md)
{% endcontent-ref %}

{% content-ref url="/pages/S0cJUiUCZBPRuE0JXP9m" %}
[Phase 1 - Github Action](/devops-project/setup-ci-cd/phase-1-github-action.md)
{% endcontent-ref %}

{% content-ref url="/pages/PSn45dylPtFUpyp1C09a" %}
[Check Infrastructure](/devops-project/results/check-infrastructure.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rishaws-projects.gitbook.io/devops-project/aws-infrastructure-automation-with-terraform-and-github-action..md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
