2022/03/17
About the terraform count meta-argument:
- you can pass a
count = nto any resource-block to create n copies of the resource - you can differentiate each of the resources using
${count.index}
About the terraform count meta-argument:
count = n to any resource-block to create n copies of the resource${count.index}to run terraform output $output_name to print a named output
aws policy documents can change the order of items within permissions arrays, but that’s safe to ignore:
aws_iam_policy_documentAlso, that & types take 8 bytes = 64 bits on 64-bit systems
use std::mem;
pub struct Foo {
bar: String, // 24
baz: usize, // 8
}
pub struct Quux<'a> {
foo: &'a Foo,
bar: usize,
}
fn main() {
println!("Foo: {}", mem::size_of::<Foo>()); // 32
println!("&Foo: {}", mem::size_of::<&Foo>()); // 8 -- a pointer?
println!("Quux: {}", mem::size_of::<Quux>()); // 16 -- a pointer + a usize!
println!("&Quux: {}", mem::size_of::<&Quux>()); // 8 -- another pointer
}
That the aws_ec2_tag
resource can be used to add tags to AWS RAM-shared VPCs and subnets:
This resource should only be used in cases where EC2 resources are created outside Terraform (e.g., AMIs), being shared via Resource Access Manager (RAM), or implicitly created by other means (e.g., Transit Gateway VPN Attachments).
Also, that
When the source of a module is a version control repository or archive file (generically, a “package”), the module itself may be in a sub-directory relative to the root of the package. A special double-slash syntax is interpreted by Terraform to indicate that the remaining path after that point is a sub-directory within the package. For example:
git::https://example.com/network.git//modules/vpc?ref=v1.2.0
that you can option+click to change your cursor’s location in iterm2 and mac’s terminal.app! H/t Vlad Grenkov for this one :)
As of Terraform 1.3, you can write
type = optional(real_type, default_value)
Apparently terraform test got stabilized somewhere around 1.7 and I never noticed: https://developer.hashicorp.com/terraform/tutorials/configuration-language/test
Also, opentofu supports it too: https://opentofu.org/docs/cli/commands/test/