GoConqr has a new look! Let us know what you think.

Flashcards

7 Terraform AWS

Archimed Nemes Kodekloud Terraform basics Easy English 15 cards

Cards in this deck (15)

  1. 1Create user Lucy with Terrform with admin-user right and tag Description leaderFilq main.tf
    resource "aws_iam_user" "admin-user" {
    name = "lucy"
    tags = {
    Decription = "leader"
    }
    }
  2. 2What will happen if we execute terraform plan after previous flash?2 errors will arise - we need enter region
    and
    we will need to provide credential to connect to aws
  3. 3How can we fix error happened in previous flash card?Add following to main.tf
    provider "aws" {
    region = "some region"
    access_key = "key to aws"
    secret_key = "secret key to aws"
    }
  4. 4What is better way of providing cedentials?using aws cli
  5. 5How provide credentials using environment variables?export AWS_ACCESS_KEY_ID = ""
    export AWS_SECRET_ACCESS_KEY_ID = " "
  6. 6Add IAM policyresource "aws_iam_policy" "adminUser" {
    name = "AdminUsers"
    policy = <
  7. 7Write JSON file indicated in previous answer{
    "Version": "2012-10-17"
    "Statement": [
    {
    "Effect" : "Allow",
    "Action": "*",
    "Resource" : "*"
    }
    ]
    }
  8. 8Attach IAM policy to IAM userresource "aws_iam_user_policy_attachment" "lucy-admin-access" {
    user = aws_iam_user.admin-user.name
    policy_arn = aws_iam_policy.adminUser.arn
    }
  9. 9Add JSON file to resource block using file function.First create somefile.json in the same directory and add json config to this file
    Then modify resource block like this
    resource "aws_iam_policy" "adminUser" {
    name = "AdminUsers"
    policy = file("somefile.json"
    }
  10. 10Create AWS S3 bucket named finance with attribute bucket (finance - 1111) and tags (Description - finance)resource "aws_s3_bucket " "finance" {
    bucket ="finance -1111"
    tags ={
    Description ="Finance"
    }
    }
  11. 11Add /root/finance/finance-2020.doc to bucket finance created earlierresource "aws_s3_bucket_object " "finance-2020" {
    content = "/root/finance/finance-2020.doc"
    key = "finance-2020.doc"
    bucket = aws_s3_bucket.finance.id
    }
  12. 12Add info to main.tf file about finance-analysts group which was not created by terraform and call it finance-datadata "aws_iam_group" "finance-data" {
    group_name = "finance-analysts"
    }
  13. 13Create bucket policyresource "aws_s3_bucket_policy" "finance-policy" {
    bucket = aws_s3_bucket.finance.id
    policy = <
  14. 14Add JSON policy to previous flashcard{
    "Version": "2012-10-17"
    "Statement": [
    {
    "Effect" : "Allow",
    "Action": "*",
    "Resource" : "arn:aws:s3:::$(aws_s3_bucket.finance.id)/*",
    "Principal": {
    "AWS" : [
    "${data.aws_iam_group.finance-data.arn}"
    ]
    }
    }
    ]
    }
  15. 15I will add Dynamo DB later to this section

Information

Description
Easy Kodekloud Terraform basics Flashcards on 7 Terraform AWS, created by Archimed Nemes on 18/12/2022.
Created by
Archimed Nemes
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?