Skip to content
This repository has been archived by the owner on Jan 30, 2021. It is now read-only.

Add a required variable #8

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module "kops_metadata" {
}

resource "aws_s3_bucket" "default" {
count = "${var.required }"
rverma-nikiai marked this conversation as resolved.
Show resolved Hide resolved
bucket = "${module.label.id}"
acl = "private"
force_destroy = false
Expand Down
6 changes: 3 additions & 3 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
output "bucket_domain_name" {
value = "${aws_s3_bucket.default.bucket_domain_name}"
value = "${aws_s3_bucket.default.*.bucket_domain_name}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use splat+join pattern here since this is a list now aws_s3_bucket.default.*.bucket_domain_name.

"${join("", aws_s3_bucket.default.*.bucket_domain_name)}"

although aws_s3_bucket.default.*.bucket_domain_name (without join) will work in many cases, in some more complex configuration it will break.

description = "S3 bucket domain name"
}

output "bucket_id" {
value = "${aws_s3_bucket.default.id}"
value = "${aws_s3_bucket.default.*.id}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use splat+join pattern

description = "S3 bucket ID"
}

output "bucket_arn" {
value = "${aws_s3_bucket.default.arn}"
value = "${aws_s3_bucket.default.*.arn}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use splat+join pattern here

description = "S3 bucket ARN"
}

Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,9 @@ variable "nodes_name" {
default = "nodes"
description = "Kops nodes subdomain name in the cluster DNS zone"
}

variable "required" {
type = "string"
default = "1"
rverma-nikiai marked this conversation as resolved.
Show resolved Hide resolved
description = "Is provisioning required in current account"
}