hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.82k stars 9.17k forks source link

[Bug]: `aws_datasync_task` - variable not populated or Plan inconsistent #36758

Open remi-f-artelia opened 7 months ago

remi-f-artelia commented 7 months ago

Terraform Core Version

1.7.5

AWS Provider Version

v5.44.0

Affected Resource(s)

aws_datasync_task resource

Expected Behavior

The plan should be performed correctly

Actual Behavior

The plan is inconsistent. It says

The final value for var.datasync_task_list is missing in Terraform's evaluation context. This is a bug in Terraform; please report it!

Relevant Error/Panic Output Snippet

Warning: Due to the problems above, some expressions may produce unexpected results.

Error: Invalid value for input variable

The final value for var.datasync_task_list is missing in Terraform's evaluation context. This is a bug in Terraform; please report it!

Terraform Configuration Files

I tried a lot of different changes in the code and at some point, I thought the issue was coming from the schedule_expression block, so I commented it.

The error

│ Error: Missing required argument
│
│   with aws_datasync_task.this["dc1_archives_mrs"],
│   on main.tf line 1, in resource "aws_datasync_task" "this":
│    1: resource "aws_datasync_task" "this" {
│
│ The argument "schedule.0.schedule_expression" is required, but no definition was found.

But it seems it's not working either as you can see in the following gist

The main concern I have is that most of the time, the var.datasync_task_list is considered as empty if I go t o terraform console. But sometimes, it is recognized (when I comment some parts) and some errors will pop like

The given value is not suitable for var.datasync_task_list declared at variables.tf:2,1-30: element "share_name": attribute "options": element "security_descriptor_copy_flags": object required.

The given value is not suitable for var.datasync_task_list declared at variables.tf:2,1-30: element "share_name": attribute "options": element "transfer_mode": object required.

The given value is not suitable for var.datasync_task_list declared at variables.tf:2,1-30: element "share_name": attribute "options": element "task_queueing": object required.

The given value is not suitable for var.datasync_task_list declared at variables.tf:2,1-30: element "share_name": attribute "task_report_config": element "output_type": object required.

The given value is not suitable for var.datasync_task_list declared at variables.tf:2,1-30: element "share_name": attribute "task_report_config": element "s3_object_versioning": object required. ...

I was using Terraform v1.6.6 and I just upgraded to v1.7.5 but it's the same behaviour.

I used the same model of module I did for datasync_location_smb or datasync_location_s3.

Steps to Reproduce

follow the gist

Debug Output

in the gist

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 7 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

justinretzolk commented 6 months ago

Hey @remi-f-artelia 👋 Thank you for taking the time to raise this! I'm not entirely certain, but I think this might be coming from Terraform Core, rather than the provider. As such, you may want to open an issue in the Core repository as well, so they can have a look. Since I'm not totally certain, I'll leave this one open as well, so that someone from the team can take a look once we're able to prioritize it.