Infrastructure as Code How .tf to do - 2018.purplecon.nz .tf … · Infrastructure as Code. Hello!...

of 37/37
How .tf to do Infrastructure as Code
  • date post

    25-Jul-2020
  • Category

    Documents

  • view

    5
  • download

    0

Embed Size (px)

Transcript of Infrastructure as Code How .tf to do - 2018.purplecon.nz .tf … · Infrastructure as Code. Hello!...

  • How .tf to do Infrastructure as Code

  • Hello!Alix Klingenberg Duck Lawn

    2

  • Hello!

    3

    Alix Klingenberg Duck Lawn

  • Infrastructure asCode

    ReusableRepeatable

    4

    AuditableShared

  • 5

  • 6

    How tho?

  • 7

    All the things! ?

    ??!

    Ω µ+ℳ=℀

    ?!

    1+2=$

  • 8

  • 9

  • 10

  • 11

    Identity and Access Management (IAM)

    aka all your users and stuff

  • 12

    statement {

    effect = "Allow",

    actions = [

    "s3:PutObject",

    "s3:GetObject",

    ],

    resources = "arn:aws:s3:::my-bucket/*",

    }

    IAM policy

  • 13

    IAM Role

  • 14

    IAM Role - trust policy statement {

    effect = "Allow",

    actions = "sts:AssumeRole",

    principals {

    type = “AWS”,

    identifier = [“lambda.amazonaws.com”],

    }

    }

  • 15

    Admin Test

    IAM Group

  • 16

    Admin Test

  • 17

  • 18

    ALL USERS GROUP

  • LIVE DEMO

    19

  • 20

  • 21

    You said there would be code...

  • 22

  • 23

  • 24

  • What is a tf state file

    25

  • .tf files + .tfstate file

    = plan diff

    26

    [local] [remote]

  • Now we terraform plan -out=plan.out

    27

  • 28

  • Now we terraform apply plan.out

    29

  • Now you can start building!

    30

  • Modules and code and layouts oh my!

    31

  • The benefitsReusabilityRepeatabilityAuditabilityShared responsibility

    32

  • How it worksStatefilesPlanning and applying changesHow to create modules

    33

  • Reusable code!You can find all terraform code used to build these environments at https://github.com/duckalini/my_first_terraform

    34

    https://github.com/duckalini/my_first_terraform

  • Thanks!Alix Klingenberg Duck Lawn

    @[email protected]

    35

  • 36

  • 37