Difference between revisions of "Terraform function: slice"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
Line 2: Line 2:
 
<code>slice</code> extracts some consecutive elements from within a <code>[[list]]</code>.
 
<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 ==

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

Advertising: