What does your first project do?#

Sumit Rawal answered on May 18, 2023 Popularity 3/10 Helpfulness 1/10

Contents


More Related Answers

  • how to start a project
  • Starting a new project
  • Starting the project
  • What are Starter Projects?
  • Setting up Your First Project
  • projectto in framework c#

  • What does your first project do?#

    0

    Let us take a second to explain each part of the code in a bit more detail.

    First block

    In the first 3 lines, we are defining the provider that we want to use. Terraform itself is just an engine that knows how to run a provider that conforms to an interface. The Terraform engine is smart and knows how to create dependency trees and plans, and it uses the provider to interface with the outside world. Since we are going to be using Terraform with AWS in this course, we need to configure the AWS provider.

    To configure the provider, we use the keyword provider then follow it with the name of the provider in quotes (in this case "aws"). We start the provider block by opening a curly brace {. We can now specify any parameters we want to configure the provider.

    To pass a parameter, you simply put the name of the parameter followed by an equals sign and then the value you want to pass the parameter in quotation markers. In our example, we are setting the region this provider will use to be us-east-2. This is the region where the AWS Terraform provider will create all of the infrastructures we define. We then end the provider block with a closing curly brace }.

    Second block

    The next block we have defined is a resource. A resource in Terraform represents a thing in the real world (in this case, an S3 bucket). To define a resource, you start a resource block by using the keyword resource. You then follow it with the resource you want to create in quotes. We want to create an S3 bucket, so we are using the S3 resource "aws_s3_bucket".

    If you are following along in IntelliJ and typing in the code, you might have noticed that IntelliJ gave you a full list of possible resources once you started typing. You can see the full list on the AWS provider page if you are interested. After we have specified the type of resource we want to create, we put another space and then the identifier you want to give that resource in quotes, in our example "first_bucket".

    We then open the block in the same way that we did for the provider block with an opening curly brace {. Next, we can give any parameters the resource takes values. In this case, we are only setting the name of the bucket. We then end the resource block with a closing }. 

    Popularity 3/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on May 18 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.