Creating Your First Infrastructure With Terraform
Learn to create an infrastructure using Terraform and how Terraform creates and destroys the infrastructure.
The first thing you have to do with a new Terraform project is to initialise Terraform for that project. To do this, provide access_key_id
and secret_access_key
, change <your-name>
for the bucket name, and click the RUN button:
📝Note: Before running the project please do make sure that you have set up an AWS account. You can also refer to the lesson, Setting up an AWS Account.
provider "aws" { region = "eu-west-1" } resource "aws_s3_bucket" "first_bucket" { bucket = "<your-name>-first-bucket" }
You will see some output on the screen as Terraform initialises, then you should see the message
Terraform has been successfully initialized!
. Once you have initialised Terraform, you are ready to create the infrastructure by running:
terraform apply
After you run the apply
, you will see quite a lot of output from Terraform. You will ...