Infrastructure
Infrastructure blocks are responsible for defining and provisioning the underlying infrastructure resources required by your services. This includes networks, compute instances, storage, and other foundational components.
Syntax
Resource Types
network: Defines networking components like VPCs, subnets, internet gateways, etc.
compute: Specifies compute resources such as virtual machines, clusters, node pools, etc.
iam: Manages Identity and Access Management resources.
storage: Configures storage accounts and related resources.
cluster: To define Kubernetes clusters.
(Note: the above resource types are generally recommended, but changing the resource type has no effect on conversion of functionality and it is only to make code more intuitive/cleaner. So if a database is assigned the resource type "compute", it won't change anything. In fact users can name their own resource types like "database" or "kubernetes" without any issues.)
Defining Resources
Each resource within the Infrastructure block is defined by specifying its type, name, and relevant attributes. Attributes vary based on the resource type.
Common Attributes:
name: The identifier for the resource.
resource_type: The specific type of resource to be provisioned.
tags: Key-value pairs for resource tagging.
dependencies: Specifies dependencies on other resources.
Dependencies
Dependencies ensure that resources are provisioned in the correct order. Use the depends_on
attribute to declare dependencies explicitly.
Example
Last updated