Skip to content

Commit aa9ee8a

Browse files
committed
fix: Avoid calling random resource when create = false
1 parent 4940d6f commit aa9ee8a

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.83.2
3+
rev: v1.88.2
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_validate
@@ -23,7 +23,7 @@ repos:
2323
- '--args=--only=terraform_standard_module_structure'
2424
- '--args=--only=terraform_workspace_remote'
2525
- repo: https://github.com/pre-commit/pre-commit-hooks
26-
rev: v4.4.0
26+
rev: v4.5.0
2727
hooks:
2828
- id: check-merge-conflict
2929
- id: end-of-file-fixer

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,14 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module
129129
|------|---------|
130130
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
131131
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.12 |
132-
| <a name="requirement_random"></a> [random](#requirement\_random) | 3.6.0 |
132+
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.6 |
133133

134134
## Providers
135135

136136
| Name | Version |
137137
|------|---------|
138138
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.12 |
139-
| <a name="provider_random"></a> [random](#provider\_random) | 3.6.0 |
139+
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.6 |
140140

141141
## Modules
142142

@@ -157,7 +157,7 @@ No modules.
157157
| [aws_msk_vpc_connection.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/msk_vpc_connection) | resource |
158158
| [aws_mskconnect_custom_plugin.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/mskconnect_custom_plugin) | resource |
159159
| [aws_mskconnect_worker_configuration.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/mskconnect_worker_configuration) | resource |
160-
| [random_id.this](https://registry.terraform.io/providers/hashicorp/random/3.6.0/docs/resources/id) | resource |
160+
| [random_id.this](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) | resource |
161161

162162
## Inputs
163163

main.tf

+3-1
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,15 @@ resource "aws_msk_vpc_connection" "this" {
189189
################################################################################
190190

191191
resource "random_id" "this" {
192+
count = var.create && var.create_configuration ? 1 : 0
193+
192194
byte_length = 8
193195
}
194196

195197
resource "aws_msk_configuration" "this" {
196198
count = var.create && var.create_configuration ? 1 : 0
197199

198-
name = format("%s-%s", coalesce(var.configuration_name, var.name), random_id.this.dec)
200+
name = format("%s-%s", coalesce(var.configuration_name, var.name), random_id.this[0].dec)
199201
description = var.configuration_description
200202
kafka_versions = [var.kafka_version]
201203
server_properties = join("\n", [for k, v in var.configuration_server_properties : format("%s = %s", k, v)])

versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ terraform {
88
}
99
random = {
1010
source = "hashicorp/random"
11-
version = "3.6.0"
11+
version = ">= 3.6"
1212
}
1313
}
1414
}

0 commit comments

Comments
 (0)