<p>Thanks @Martin Atkins, a big upgrade of terraform and the aws provider appears to have solved the problem.</p>
<p>After upgrading to terraform to <code>1.3.6</code> I got a bit more information about the nature of the error. It appears it was related to the object expiry property of s3 bucket object lifecycle policy configuration.</p>
<p>This was also manifesting itself by the object lifecycle property resource &quot;flapping&quot; between, needs creating and needs deleting every terraform run which was the motivation for embarking on this upgrade in the first place.</p>
<p>Upgrading AWS terraform provider to <code>4.0.8</code> resolved warnings and state flapping issues.</p>

CC BY-SA 4.0
2023-09-26T13:02:45.773Z
The plugin version you refer to seems to be `4.8.0`, as version `4.0.8` doesn't exist.
Marcus
CC BY-SA 4.0
2022-12-30T10:10:42.447Z
2022-12-30T10:10:42.447Z
Simon Merrick
<p>I'm in the process of upgrading our version of the Terraform AWS Provider and after fixing/updating every resource and data source which has been deprecated/changed between versions (<code>3.75.2</code> -&gt; <code>4.0.0</code>) I'm left with one final error message (<code>Error: a number is required</code>) I can't get to the  bottom of because it doesn't give any indication of module/file/resource/line number or anything really to go by.</p>
<p>I get the error on a <code>terraform plan</code> as follows</p>
<pre class="lang-bash prettyprint-override"><code>$ terraform plan
aws_s3_bucket.static_nlb: Refreshing state... [id=&lt;redacted&gt;]
#
#...more resources refreshing state...
#
aws_ssm_parameter.processor_sqs: Refreshing state... [id=/config/scripts/sqs/iam_access_policy]

Error: a number is required

ERRO[0052] Hit multiple errors:
Hit multiple errors:
exit status 1 
$ 
</code></pre>
<p>Environment Details:</p>
<ul>
<li>Terraform version: <code>0.14.11</code></li>
<li>Terraform AWS Provider: <code>4.0.0</code> (upgraded from <code>3.75.2</code>)</li>
</ul>
<p>Troubleshooting/Things I've Tried</p>
<ul>
<li>Commenting out two of the modules I thought might be responsible and there was no change. I've tried running</li>
<li>Running with <code>TF_LOG=DEBUG</code> or <code>TF_LOG=TRACE</code></li>
</ul>
<p>I didn't see anything in the output though it was looking for a needle in a haystack. I did try grepping for obvious key words: <code>type</code>, <code>error</code>, <code>number</code> etc.</p>
<p>Its a very large terraform project and I am at a bit of a loss how to proceed with debugging this error</p>
<p>Has anyone seen this before and can suggest what it is/how I might be able to dig further?</p>

CC BY-SA 4.0
2022-12-10T00:19:45.767Z
I notice you're using a very old version of Terraform. Trying `terraform plan` with the very latest version of Terraform might give you a better error message, since I think various bugs that were causing contextless errors have been fixed in the intermediate versions. Even if you're not really to upgrade permanently to a newer Terraform version, just running `terraform plan` with the latest version shoudn't do any harm as long as you don't apply the plan or run any of the other commands that can modify the Terraform state.
Martin Atkins
CC BY-SA 4.0
2022-12-11T10:06:49.247Z
Thanks @MartinAtkins. Yep upgrading this project is overdue. I will try run terraform plan with a newer version of terraform and see where that gets me.
Simon Merrick
<amazon-web-services><terraform>
Error: a number is required
Simon Merrick
# Error: a number is required

(Asked by: username_0 on 2022-12-09)

I'm in the process of upgrading our version of the Terraform AWS Provider and after fixing/updating every resource and data source which has been deprecated/changed between versions (3.75.2 -> 4.0.0) I'm left with one final error message (Error: a number is required) I can't get to the  bottom of because it doesn't give any indication of module/file/resource/line number or anything really to go by.
I get the error on a terraform plan as follows
$ terraform plan
aws_s3_bucket.static_nlb: Refreshing state... [id=]
#
#...more resources refreshing state...
#
aws_ssm_parameter.processor_sqs: Refreshing state... [id=/config/scripts/sqs/iam_access_policy]

Error: a number is required

ERRO[0052] Hit multiple errors:
Hit multiple errors:
exit status 1 
$ 

Environment Details:

Terraform version: 0.14.11
Terraform AWS Provider: 4.0.0 (upgraded from 3.75.2)

Troubleshooting/Things I've Tried

Commenting out two of the modules I thought might be responsible and there was no change. I've tried running
Running with TF_LOG=DEBUG or TF_LOG=TRACE

I didn't see anything in the output though it was looking for a needle in a haystack. I did try grepping for obvious key words: type, error, number etc.
Its a very large terraform project and I am at a bit of a loss how to proceed with debugging this error
Has anyone seen this before and can suggest what it is/how I might be able to dig further?

**Tags:** amazon-web-services, terraform

> **Comments:**
> **username_1**: I notice you're using a very old version of Terraform. Trying `terraform plan` with the very latest version of Terraform might give you a better error message, since I think various bugs that were causing contextless errors have been fixed in the intermediate versions. Even if you're not really to upgrade permanently to a newer Terraform version, just running `terraform plan` with the latest version shoudn't do any harm as long as you don't apply the plan or run any of the other commands that can modify the Terraform state.  
> **username_0**: Thanks @MartinAtkins. Yep upgrading this project is overdue. I will try run terraform plan with a newer version of terraform and see where that gets me.  

---

## 1 answers

### Answer by username_0 on 2022-12-30. Score: 2 | Accepted answer

Thanks @username_1, a big upgrade of terraform and the aws provider appears to have solved the problem.

After upgrading to terraform to `1.3.6` I got a bit more information about the nature of the error. It appears it was related to the object expiry property of s3 bucket object lifecycle policy configuration.

This was also manifesting itself by the object lifecycle property resource "flapping" between, needs creating and needs deleting every terraform run which was the motivation for embarking on this upgrade in the first place.

Upgrading AWS terraform provider to `4.0.8` resolved warnings and state flapping issues.

> **Comments:**
> **username_2**: The plugin version you refer to seems to be `4.8.0`, as version `4.0.8` doesn't exist.  

---

