Terraform apply is failing with interpolation expression deprecated error

With the first block key is created successfully. However in the second resource block it is failing with below warning when I execute command terraform plan. I gave id reference correctly. please suggest what needs to be fix this issue. Thanks