Skip to content

Terraform AWS

Links: 113 Terraform Index


AWS

  • For using our programmatic access credentials with AWS we can make use of provider in terraform.
    • attachments/Pasted image 20230109223848.jpg
    • This is not a recommended approach.
  • Instead we can have the credentials in .aws/config/credentials and terraform will automatically make use of those credentials.
    • attachments/Pasted image 20230109224215.jpg
  • Another way of passing these variables is using the environment variables.
    • We can also set the region in environment variables allowing us to remove the provider block completely
    • attachments/Pasted image 20230109224252.jpg

Different ways of creating IAM policies with terraform

  • Using heredoc syntax for the policy json
    • attachments/Pasted image 20230109224552.jpg
  • Attaching an IAM policy to an user
    • attachments/Pasted image 20230109224715.jpg
  • Using file for policy json
    • attachments/Pasted image 20230109224934.jpg
  • We can make use of variable substitution in the heredoc syntax

    - attachments/Pasted image 20230109230939.jpg


Last updated: 2023-01-09