DevOps(Day-81): Terraform and Docker - Part1
TABLE OF CONTENTS
Blocks and Resources in Terraform
Terraform block
Task-01: Creating Provider block and resource.
Provider Block
Terraform needs to be told which provider to be used in the automation, hence we need to give the provider name with source and version. For Docker, we can use this block of code in our main.tf
Blocks and Resources in Terraform
Terraform block
Task-01: Creating Provider block and resource.
- Create a Terraform script with Blocks and Resources
Terraform needs to be told which provider to be used in the automation, hence we need to give the provider name with source and version. Here we gave the source as kreuzwerker/docker which tells the repository from which the code is to be pulled and its version.
Note: kreuzwerker/docker, is shorthand for registry.terraform.io/kreuzwerker/docker.
Provider Block
The provider block configures the specified provider, in this case, docker. A provider is a plugin that Terraform uses to create and manage your resources.
Resource
Use resource blocks to define components of your infrastructure. A resource might be a physical or virtual component such as a Docker container, or it can be a logical resource such as a Heroku application.
Resource blocks have two strings before the block: the resource type and the resource name. In this example, the first resource type is docker_image and the name is Nginx.
Thanks for reading my article. Have a nice day.
Comments
Post a Comment