💾 Archived View for koyu.space › vydyck › tech › cloud › terraform › index.gmi captured on 2023-11-04 at 12:15:01. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
Terraform
Available as a standalon binary for most osses, download from hashicorp.
Closed source product?
Create a subdir, preferably managed as a git repo.
is no longer required, but expected by many oldtimer terraformers
provider.tf: configure all provider plugins here
vars.tf: all variable definitions
outputs.tf: all output definitions
One or more of:
<resourcename>.tf: group by resource type, eg all s3, iam,...
variable "<variablename>" {
type = "some type, usually string"
default = "a default value"
}
resource "<resource type>" "<terraform resource name>" {
note that the real name of the resource is an attribute itself; the terraform resourcename is only used in the terraform code
see the docs of the <resource type>
usually:
<attributename> = "<attribute value>"
references to attributes of other resource type are via:
<attributename> = <resource type>.<terraform resource name>.<attributename>
you can extrapolate values of variables in the assigment:
<attributename> = " (TBD)
the value can also be function output:
eg source_code_hash = filebase64sha256("Accounts.zip")
}
special variables that can be called via "terraform output <outputname>"
useful for attribute values that are only known after creation, eg because they are randomized.
output "<my output name>" {
value = <some resource type>.<my resource name>.<attribute name>.
}