hashicorp / learn-terraform-aft-account-request

https://learn.hashicorp.com/tutorials/terraform/aws-control-tower-aft
Mozilla Public License 2.0
22 stars 817 forks source link

account_customizations_name can't default to null #13

Closed sylwit closed 2 years ago

sylwit commented 2 years ago

Hi,

I tried to create an account without account_customizations_name param and I received a 400 error in codebuild.

ValidationException: Supplied AttributeValue is empty, must contain exactly one of the supported datatypes

The account_customizations_name default value default to null but this is an invalid value for dynamoDB, hence the default can't be applied https://github.com/hashicorp/learn-terraform-aft-account-request/blob/main/terraform/modules/aft-account-request/variables.tf#L42

account_customizations_name = { S = var.account_customizations_name } a string can't be null

I'll be happy to make a fix but I don't know how you want to handle that. Switching the default for empty instead of null ?

ritsok commented 2 years ago

Hi @sylwit, sorry to hear you ran into this issue. Please reach out to the AWS team that maintains the AFT implementation and module this tutorial relies on for more guidance! https://github.com/aws-ia/terraform-aws-control_tower_account_factory

sylwit commented 2 years ago

@ritsok But their module is correct as you can see here

https://github.com/aws-ia/terraform-aws-control_tower_account_factory/blob/1010f5ead7960114a4abf96afffb02c7a6e47e70/sources/aft-customizations-repos/aft-account-request/terraform/modules/aft-account-request/variables.tf#L48

They define the default as an empty string instead of null like done in this example.