Unsupported argument post changing syntax for terraform upgradation

Facing an issue as below when i changed the syntax as part of terraform upgradation to 1.0 while doing plan.

Error: Unsupported argument

  on ../../../../modules/webstack-terraform-module-waf/waf.tf line 3, in resource "aws_wafregional_ipset" "webstack_ipset":
   3: ip_set_descriptor = var.webstack_ipset

An argument named "ip_set_descriptor" is not expected here. Did you mean to  define a block of type "ip_set_descriptor"?

Earlier the code is as below and no issue reported and working fine

resource "aws_wafregional_ipset" "webstack_ipset" {

  name              = "${var.waf_ipset_name}"
 
 ip_set_descriptor = "${var.webstack_ipset}"
}

For terraform 1.0 i have done corrections as below

resource "aws_wafregional_ipset" "webstack_ipset" {
  name              = var.waf_ipset_name
  ip_set_descriptor = var.webstack_ipset
}

Help me with any corrections. Thanks in Advance.

Hi @hemub441,

You didn’t mention what version you were upgrading from but based on the syntax used in your old example it seems like you are upgrading from Terraform v0.11 or earlier, in which case a direct upgrade to Terraform v1.0 or later isn’t supported and not recommended because you will miss the opportunity to use the Terraform v0.12 automatic upgrade tools to help with problems like this.

If you are upgrading from Terraform v0.11 for the first time, I suggest first upgrading only to Terraform v0.12 using the guidance in the Terraform v0.12 Upgrade Guide.

In there you will learn about both a tool you can use before you upgrade to Terraform v0.12 (terraform 0.12checklist), to report a small number of potential problems that will be easier to resolve before you upgrade, and then another tool included as part of Terraform v0.12 (terraform 0.12upgrade) which knows how to update syntax of older configurations to match the new syntax requirements.

In particular, that tool should be able to automatically upgrade your ip_set_descriptor argument to be declared using dynamic block syntax, which is what this provider seems to require when using Terraform v0.12 or later, based on the error message you shared.

The upgrade tool can’t fully automatically fix all problems, but it will typically update a large part of your module fully automatically and, for anything it can’t automatically fix, will produce some helpful follow-up instructions to guide any remaining manual updates that might be needed.

If you try this automatic upgrade process and run into anything you’re not sure how to resolve, feel free to reply here with any new error messages or other details, and I’ll do my best to help.

(Note that because you’ve already done some manual work to upgrade, the automatic upgrade tool probably won’t be able to parse your configuration in its current form; it expects to parse Terraform v0.11 syntax, not modern Terraform syntax. I suggest reverting to the configuration exactly as it was working in Terraform v0.11 before starting the upgrade process, because then the automatic upgrade tool can recreate something equivalent to your manual updates as part of its work.)

As described on the Terraform v1.0 Upgrade Guide, after completing your Terraform v0.12 upgrade you’ll also typically need to upgrade to v0.13 and then to v0.14 before finally upgrading to Terraform v1.0, for similar reasons: each of those releases has some automated or partially-automated upgrade steps, described in its upgrade guide, which are no longer available in Terraform v1.0 and later.

Hi @apparentlymart,

Thank you for quick respone and making me understand in a clear view. But in our case we don’t have much time to do upgradation in linear approach so we opt to upgrading to v1.0 directly .Currently the issue has been resolved.

2 posts were split to a new topic: Problem upgrading directly from v0.11 to v1.0