Skip to content

morethancertified/cm86ex7jo00jemm03gj5qyqev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ticket Type: Task
Title: Terraform Files and Templates with AWS
Project: Cloud Infrastructure Deployment
Assignee: You
Reporter: Derek Morgan
Priority: High
Labels: Terraform, AWS, S3, Templates, Files
Epic Link: AWS Infrastructure Expansion
Sprint: Sprint 01/Files and Templates

Lab Setup This lab uses Localstack to simulate an AWS environment. Localstack is already preinstalled in your environment. You don't need keys or to configure the provider. If you'd like to use your own account, feel free to specify your provider configuration and run unset aws and unset terraform to decouple them from Localstack.

Description:

The team needs to create an S3 bucket for infrastructure documentation and configuration files. They want to use standardized README.md and .gitignore files for their Terraform projects. The team is happy with the current .gitignore provided by GitHub: https://github.com/github/gitignore/blob/main/Terraform.gitignore, but they need to remove any reference to tfvars files. Use that template, remove the tfvars references, and upload it as an S3 object. For the README.md file, you'll need to provide some infrastructure information based on the acceptance criteria below.

resource "aws_s3_bucket" "infra_docs" {
  bucket = "infra-docs-${var.env}"
}

resource "aws_s3_object" "gitignore" {
  bucket  = aws_s3_bucket.infra_docs.id
  key     = ".gitignore"
  content = <use functions to provide content from templates>
}

resource "aws_s3_object" "readme" {
  bucket  = aws_s3_bucket.infra_docs.id
  key     = "README.md"
  content = "Add README content here"
}

Acceptance Criteria:

Note: If the terraform validate command fails, all tasks in the lab will fail!

  1. Create a templates directory for the new templates.
  2. Create the .gitignore.tpl file in the templates directory from an existing Terraform Gitignore file and remove the references to tfvars.
  3. Create the README.md.tpl file in the templates directory with the following information formatted how you wish:
    1. Project name
    2. Environment (dev/prod)
    3. S3 bucket URL
  4. Ensure you use the most efficient function for each file. Hint: if there are no vars, you may want to use a different function than if there are.
  5. For the most efficient deployment and ability to add more files in the future, use for_each and a locals block to create the S3 objects.

Implementation Notes:

Hint If you're using your own AWS account, be sure your bucket name is globally unique.

About

Files and Templates Lab

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages