Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add default values for attributes that are showing up in plans and causing unnecessary diffs #101

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.80.0
rev: v1.81.0
hooks:
- id: terraform_fmt
- id: terraform_wrapper_module_for_each
Expand Down
2 changes: 1 addition & 1 deletion examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Note that this example may create resources which will incur monetary charges on
| Name | Source | Version |
|------|--------|---------|
| <a name="module_alb"></a> [alb](#module\_alb) | terraform-aws-modules/alb/aws | ~> 8.0 |
| <a name="module_alb_sg"></a> [alb\_sg](#module\_alb\_sg) | terraform-aws-modules/security-group/aws | ~> 4.0 |
| <a name="module_alb_sg"></a> [alb\_sg](#module\_alb\_sg) | terraform-aws-modules/security-group/aws | ~> 5.0 |
| <a name="module_ecs"></a> [ecs](#module\_ecs) | ../../ | n/a |
| <a name="module_ecs_cluster_disabled"></a> [ecs\_cluster\_disabled](#module\_ecs\_cluster\_disabled) | ../../modules/cluster | n/a |
| <a name="module_ecs_disabled"></a> [ecs\_disabled](#module\_ecs\_disabled) | ../../ | n/a |
Expand Down
2 changes: 1 addition & 1 deletion examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ resource "aws_service_discovery_http_namespace" "this" {

module "alb_sg" {
source = "terraform-aws-modules/security-group/aws"
version = "~> 4.0"
version = "~> 5.0"

name = "${local.name}-service"
description = "Service security group"
Expand Down
4 changes: 2 additions & 2 deletions examples/ec2-autoscaling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ Note that this example may create resources which will incur monetary charges on
| Name | Source | Version |
|------|--------|---------|
| <a name="module_alb"></a> [alb](#module\_alb) | terraform-aws-modules/alb/aws | ~> 8.0 |
| <a name="module_alb_sg"></a> [alb\_sg](#module\_alb\_sg) | terraform-aws-modules/security-group/aws | ~> 4.0 |
| <a name="module_alb_sg"></a> [alb\_sg](#module\_alb\_sg) | terraform-aws-modules/security-group/aws | ~> 5.0 |
| <a name="module_autoscaling"></a> [autoscaling](#module\_autoscaling) | terraform-aws-modules/autoscaling/aws | ~> 6.5 |
| <a name="module_autoscaling_sg"></a> [autoscaling\_sg](#module\_autoscaling\_sg) | terraform-aws-modules/security-group/aws | ~> 4.0 |
| <a name="module_autoscaling_sg"></a> [autoscaling\_sg](#module\_autoscaling\_sg) | terraform-aws-modules/security-group/aws | ~> 5.0 |
| <a name="module_ecs_cluster"></a> [ecs\_cluster](#module\_ecs\_cluster) | ../../modules/cluster | n/a |
| <a name="module_ecs_service"></a> [ecs\_service](#module\_ecs\_service) | ../../modules/service | n/a |
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.0 |
Expand Down
4 changes: 2 additions & 2 deletions examples/ec2-autoscaling/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ data "aws_ssm_parameter" "ecs_optimized_ami" {

module "alb_sg" {
source = "terraform-aws-modules/security-group/aws"
version = "~> 4.0"
version = "~> 5.0"

name = "${local.name}-service"
description = "Service security group"
Expand Down Expand Up @@ -299,7 +299,7 @@ module "autoscaling" {

module "autoscaling_sg" {
source = "terraform-aws-modules/security-group/aws"
version = "~> 4.0"
version = "~> 5.0"

name = local.name
description = "Autoscaling group security group"
Expand Down
2 changes: 1 addition & 1 deletion examples/fargate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Note that this example may create resources which will incur monetary charges on
| Name | Source | Version |
|------|--------|---------|
| <a name="module_alb"></a> [alb](#module\_alb) | terraform-aws-modules/alb/aws | ~> 8.0 |
| <a name="module_alb_sg"></a> [alb\_sg](#module\_alb\_sg) | terraform-aws-modules/security-group/aws | ~> 4.0 |
| <a name="module_alb_sg"></a> [alb\_sg](#module\_alb\_sg) | terraform-aws-modules/security-group/aws | ~> 5.0 |
| <a name="module_ecs_cluster"></a> [ecs\_cluster](#module\_ecs\_cluster) | ../../modules/cluster | n/a |
| <a name="module_ecs_service"></a> [ecs\_service](#module\_ecs\_service) | ../../modules/service | n/a |
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.0 |
Expand Down
2 changes: 1 addition & 1 deletion examples/fargate/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ resource "aws_service_discovery_http_namespace" "this" {

module "alb_sg" {
source = "terraform-aws-modules/security-group/aws"
version = "~> 4.0"
version = "~> 5.0"

name = "${local.name}-service"
description = "Service security group"
Expand Down
8 changes: 4 additions & 4 deletions modules/container-definition/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ locals {
dockerLabels = length(var.docker_labels) > 0 ? var.docker_labels : null
dockerSecurityOptions = length(var.docker_security_options) > 0 ? var.docker_security_options : null
entrypoint = length(var.entrypoint) > 0 ? var.entrypoint : null
environment = length(var.environment) > 0 ? var.environment : null
environment = var.environment
environmentFiles = length(var.environment_files) > 0 ? var.environment_files : null
essential = var.essential
extraHosts = local.is_not_windows && length(var.extra_hosts) > 0 ? var.extra_hosts : null
Expand All @@ -39,9 +39,9 @@ locals {
logConfiguration = length(local.log_configuration) > 0 ? local.log_configuration : null
memory = var.memory
memoryReservation = var.memory_reservation
mountPoints = length(var.mount_points) > 0 ? var.mount_points : null
mountPoints = var.mount_points
name = var.name
portMappings = length(var.port_mappings) > 0 ? var.port_mappings : null
portMappings = var.port_mappings
privileged = local.is_not_windows ? var.privileged : null
pseudoTerminal = var.pseudo_terminal
readonlyRootFilesystem = local.is_not_windows ? var.readonly_root_filesystem : null
Expand All @@ -53,7 +53,7 @@ locals {
systemControls = length(var.system_controls) > 0 ? var.system_controls : null
ulimits = local.is_not_windows && length(var.ulimits) > 0 ? var.ulimits : null
user = local.is_not_windows ? var.user : null
volumesFrom = length(var.volumes_from) > 0 ? var.volumes_from : null
volumesFrom = var.volumes_from
workingDirectory = var.working_directory
}

Expand Down
2 changes: 1 addition & 1 deletion modules/service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ module "container_definition" {
stop_timeout = try(each.value.stop_timeout, var.container_definition_defaults.stop_timeout, 120)
system_controls = try(each.value.system_controls, var.container_definition_defaults.system_controls, [])
ulimits = try(each.value.ulimits, var.container_definition_defaults.ulimits, [])
user = try(each.value.user, var.container_definition_defaults.user, null)
user = try(each.value.user, var.container_definition_defaults.user, 0)
volumes_from = try(each.value.volumes_from, var.container_definition_defaults.volumes_from, [])
working_directory = try(each.value.working_directory, var.container_definition_defaults.working_directory, null)

Expand Down