hashicorp / terraform-cdk

Define infrastructure resources using programming constructs and provision them using HashiCorp Terraform
https://www.terraform.io/cdktf
Mozilla Public License 2.0
4.84k stars 450 forks source link

Count iterators and count meta-argument #2021

Closed DanielMSchmidt closed 1 year ago

DanielMSchmidt commented 2 years ago

Community Note

Description

In some scenarios (like https://github.com/hashicorp/terraform-cdk/issues/1981#issuecomment-1202720769) users need to use count, so we should support this through an API.

import { TerraformIterator } from "cdktf";

const iterator = TerraformIterator.count(5);

new S3Bucket(this, "s3", {
  count: iterator,
  name: `bucket-${iterator.index}`
})

References

ansgarm commented 1 year ago

This was implemented in https://github.com/hashicorp/terraform-cdk/pull/2766

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.