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

An argument named "availability_zones" is not expected here. #199

Closed
muhammadasgharaliqureshi opened this issue May 29, 2023 · 9 comments
Closed
Labels
bug 🐛 An issue with the system

Comments

@muhammadasgharaliqureshi
Copy link

muhammadasgharaliqureshi commented May 29, 2023

Describe the Bug

In module code at line 25 we have

availability_zones         = length(var.availability_zones) == 0 ? null : [for n in range(0, var.cluster_size) : element(var.availability_zones, n)]

for terraform resource aws_elasticache_replication_group but this argument is no more available for terraform resource aws_elasticcache_replication_group here

image

Expected Behavior

Terraform validate and terraform apply should work on module example

Steps to Reproduce

Just try running following module example
https://github.com/cloudposse/terraform-aws-elasticache-redis/tree/main/examples/complete

  • Terraform init

  • Terraform apply

Screenshots

image

Environment

  • OS: Kali GNU/Linux
  • Version 2023.1
  • Module version ~> 0.49
  • Terraform version 1.4.6

Additional Context

No response

@muhammadasgharaliqureshi muhammadasgharaliqureshi added the bug 🐛 An issue with the system label May 29, 2023
@mbilal-xgrid
Copy link

+1

2 similar comments
@AbuBakkarBinAkmal
Copy link

+1

@adeelshahzad125
Copy link

+1

@muhammadasgharaliqureshi
Copy link
Author

Related to #173 and #197

@TheSantacloud
Copy link

TheSantacloud commented May 30, 2023

This is because AWS has released provider version 5.x and it has some breaking changes (major change)
To resolve it, change your AWS provider (probably in providers.tf)

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = "~> 4.67.0"
    }
  }
}

provider "aws" {
  # Configuration options
}

and then run terraform init -upgrade and it should be fine

@rajatrj16
Copy link

Upgrading the provider won't help
I am still getting

╷
│ Error: Unsupported argument
│ 
│   on .terraform/modules/elasticache_redis.elasticache-redis/main.tf line 125, in resource "aws_elasticache_replication_group" "default":
│  125:   availability_zones         = length(var.availability_zones) == 0 ? null : [for n in range(0, var.cluster_size) : element(var.availability_zones, n)]
│ 
│ An argument named "availability_zones" is not expected here.
╵

I have tried to replace availability_zones with preferred_cache_cluster_azs as mentioned in the issue-197 but then getting

╷
│ Error: Unsupported argument
│ 
│   on ../../modules/elastic-cache/main.tf line 22, in module "elasticache-redis":
│   22:   preferred_cache_cluster_azs          = var.availability_zones
│ 
│ An argument named "preferred_cache_cluster_azs" is not expected here.
╵

@ervinb
Copy link

ervinb commented Jul 4, 2023

If you happen to use Terragrunt, you can overwrite this module's version-contraint, so the aws module stays below 5.x (as per the comment above):

terraform {
  source = "git::https://github.com/cloudposse/terraform-aws-elasticache-redis//.?ref=0.51.0"
}

generate "versions" {
  path = "versions.tf"
  if_exists = "overwrite"

  contents = <<-EOF
  terraform {
    required_version = ">= 0.14.0"

    required_providers {
      aws = {
        source  = "hashicorp/aws"
        version = "~> 4.18"
      }
    }
  }
  EOF
}

locals {...}

inputs = {...}

@milldr
Copy link
Member

milldr commented Jul 18, 2023

#198 should have resolved breaking changes from AWS provider v5. Please update to the latest and retry

@muhammadasgharaliqureshi
Copy link
Author

Thanks @milldr yes looks good now, closing this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
Development

No branches or pull requests

8 participants