Terraform Module is erroring out "Error: module "customer-services": "APIGW_CUSTOMER_DOMAIN_FLAG" is not a valid argument"

I am having a Variable “APIGW_CUSTOMER_DOMAIN_FLAG” in the variable.tf file with the default value as “false”. I am passing the value to a variable in a module called customer-services. In the customer-serivces module, the same variable has been declared in variable file and referenced in a S3 object resource creation. I am getting the error as

Error: module “customer-services”: “APIGW_CUSTOMER_DOMAIN_FLAG” is not a valid argument

But it is working in other location where when pulled from master branch as part of the automation.


The Variable representation



AUTOGEN-variable-provider.tf:variable “APIGW_CUSTOMER_DOMAIN_FLAG” {default = “false”}
customer-services-module.tf: APIGW_CUSTOMER_DOMAIN_FLAG = “${var.APIGW_CUSTOMER_DOMAIN_FLAG}”

$ grep APIGW_CUSTOMER_DOMAIN_FLAG customer-services/*.tf

customer-services/apigw-customer-info-out.tf: cust-domain-flag = “${var.APIGW_CUSTOMER_DOMAIN_FLAG}” # Added as part of SC-8851
customer-services/apigw-customer-services-var.tf:variable “APIGW_CUSTOMER_DOMAIN_FLAG” {} # Added as part of SC-8851

$ terraform init

Initializing modules…

  • module.deploy-instances-01030003063
  • module.deploy-instances-01030003084
  • module.deploy-instances-01040003175
  • module.customer-services

Error: module “customer-services”: “APIGW_CUSTOMER_DOMAIN_FLAG” is not a valid argument

Attaching the files


This is interesting:

Is it possible the location where you are seeing the error has a different version of the module, one which doesn’t include the variable in question? You might need to upgrade the module ( terraform get -upgrade can be used to get the latest versions of modules, though if your configuration has a pinned module version it will not upgrade beyond that version).