Skip to content

Commit

Permalink
Merge pull request #7 from kawsark/main
Browse files Browse the repository at this point in the history
added tags variable and locals readability
  • Loading branch information
prabirsekhri authored Feb 14, 2023
2 parents d63b94c + 181b9fc commit 311cc97
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
15 changes: 14 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,20 @@
################################################################################

locals {
create_smb_active_directory_settings = (var.join_smb_domain == true && length(var.domain_controllers) > 0 && length(var.domain_name) > 0 && length(var.domain_password) > 0 && length(var.domain_username) > 0)

# Check whether all SMB Active Directory Settings are present
join_smb_domain_true = var.join_smb_domain == true
domain_controllers_exist = length(var.domain_controllers) > 0
domain_name_exists = length(var.domain_name) > 0
domain_password_exists = length(var.domain_password) > 0
domain_username_exists = length(var.domain_username) > 0

create_smb_active_directory_settings = (local.join_smb_domain_true &&
local.domain_controllers_exist &&
local.domain_name_exists &&
local.domain_password_exists &&
local.domain_username_exists)

}

resource "aws_storagegateway_gateway" "mysgw" {
Expand Down
6 changes: 2 additions & 4 deletions modules/s3-nfs-share/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ resource "aws_storagegateway_nfs_file_share" "nfsshare" {
cache_stale_timeout_in_seconds = var.cache_timout
}

tags = {
Environment = "dev"
Application = "serviceA"
}
tags = var.tags

}
11 changes: 11 additions & 0 deletions modules/s3-nfs-share/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ variable "cache_timout" {
type = number
description = "Cache stale timeout for automated cache refresh in seconds. Default is set to 1 hour (3600 seconds) can be changed to as low as 5 minutes (300 seconds)"
default = "3600"

validation {
condition = var.cache_timout == 0 || (var.cache_timout >= 300 && var.cache_timout <= 2592000)
error_message = "Valid Values for Cache Stale Timeout: 0, 300 to 2,592,000 seconds (5 minutes to 30 days)"
}
}

variable "directory_mode" {
Expand Down Expand Up @@ -83,3 +88,9 @@ variable "owner_id" {
}
}

variable "tags" {
type = map(any)
description = "(Optional) Key-value map of resource tags."
default = {}
}

0 comments on commit 311cc97

Please sign in to comment.