Difference between revisions of "Terraform function: slice"
Jump to navigation
Jump to search
Tags: Mobile web edit, Mobile edit |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
* https://www.terraform.io/language/functions/slice | * https://www.terraform.io/language/functions/slice | ||
+ | <code>slice</code> extracts some consecutive elements from within a <code>[[list]]</code>. | ||
+ | https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/examples/complete/main.tf | ||
+ | locals { | ||
+ | name = "ex-${[[replace]](basename(path.cwd), "_", "-")}" | ||
+ | region = "eu-west-1" | ||
+ | |||
+ | vpc_cidr = "10.0.0.0/16" | ||
+ | azs = slice(data.[[aws_availability_zones]].available.names, 0, 3) | ||
+ | |||
+ | tags = { | ||
+ | Example = local.name | ||
+ | GithubRepo = "terraform-aws-eks" | ||
+ | GithubOrg = "terraform-aws-modules" | ||
+ | } | ||
+ | } | ||
== See also == | == See also == |
Latest revision as of 07:52, 7 March 2023
slice
extracts some consecutive elements from within a list
.
https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/examples/complete/main.tf
locals { name = "ex-${replace(basename(path.cwd), "_", "-")}" region = "eu-west-1" vpc_cidr = "10.0.0.0/16" azs = slice(data.aws_availability_zones.available.names, 0, 3) tags = { Example = local.name GithubRepo = "terraform-aws-eks" GithubOrg = "terraform-aws-modules" } }
See also[edit]
Advertising: