Terraform Code in VSCode for AWS Resource Creation

Hi
I have created terraform config files in VSCode to create AWS Airflow resource in AWS.
when I run this code in AWS Cloud shell . It works like a magic (Exactly same code) . But when I run it in VSCode Terminal window ,I am getting the following error when I run "TERRAFORM APPLY ". any ideas. why it is erroring out in VSCODE but not in AWS shell


Error: error creating MWAA Environment: ValidationException: Provided subnet IDs could not be verified. Please check if the subnet IDs are correct and you have the required permissions to read their details.

on main.tf line 143, in resource “aws_mwaa_environment” “mwaa_environment”:
143: resource “aws_mwaa_environment” “mwaa_environment” {

1 Like

Hi @muralijv, we’ve been seeing the error you mention when trying to use a lambda to trigger update_environment in mwaa (triggered whenever a new requirements.txt file is uploaded, so that we automatically point mwaa to the newest version).

We solved it by giving the role the ec2:DescribeSubnets permission on resources = ["*"]