C1 module 4 Assigment 3 Terraform crash

when I excecute in the console "terraform plan || echo “S?” , I get this error code:

Error: reading EC2 Subnet: operation error EC2: DescribeSubnets, https response error StatusCode: 403, RequestID: 851ba89a-2d65-4ae2-8ed0-738223f923ab, api error UnauthorizedOperation: You are not authorized to perform this operation. User: arn:aws:sts::072737996417:assumed-role/voclabs/user4153884=udwpmjvragny is not authorized to perform: ec2:DescribeSubnets with an explicit deny in an identity-based policy

│ with module.etl.data.aws_subnet.public_a,
│ on modules/etl/network.tf line 1, in data “aws_subnet” “public_a”:
│ 1: data “aws_subnet” “public_a” {



│ Error: reading EC2 Security Group: operation error EC2: DescribeSecurityGroups, https response error StatusCode: 403, RequestID: 52766854-9cfe-408e-9fb9-1a89422c26f7, api error UnauthorizedOperation: You are not authorized to perform this operation. User: arn:aws:sts::072737996417:assumed-role/voclabs/user4153884=udwpmjvragny is not authorized to perform: ec2:DescribeSecurityGroups with an explicit deny in an identity-based policy

│ with module.etl.data.aws_security_group.db_sg,
│ on modules/etl/network.tf line 5, in data “aws_security_group” “db_sg”:
│ 5: data “aws_security_group” “db_sg” {

When I continue with terraform apply i get this:

oder@16f3b2a64423:~/project/terraform$ terraform apply || echo “$?”

Changes to Outputs:

  • data_lake_bucket_id = “de-c1w4-072737996417-us-east-1-datalake”
  • scripts_bucket_id = “de-c1w4-072737996417-us-east-1-scripts”

You can apply this plan to save these new output values to the Terraform state,
without changing any real infrastructure.

│ Error: Invalid provider configuration

│ Provider “Terraform Registry” requires explicit configuration.
│ Add a provider block to the root module and configure the provider’s required
│ arguments as described in the provider documentation.



│ Error: Retrieving AWS account details: validating provider credentials: retrieving caller identity from STS: operation error STS: GetCallerIdentity, https response error StatusCode: 403, RequestID: b4e91490-dee7-4b9f-a11f-8c70501ca2a5, api error InvalidClientTokenId: The security token included in the request is invalid.

│ with provider[“Terraform Registry”],
│ on line 0:
│ (source code not available)


1

Hi there,

Please take a moment to review your Terraform configuration files and ensure the provider is correctly set up, as outlined in the lab instructions.

Yes the configuration is just as described in the tutorial videos, I have tried to restart it and redo it many times, I still encounter the same error.

I am also facing same error pls look into it

i am getting error after terraform apply

Hey there! Where are you getting stuck? It seems like my issue is at point 2.4

It appears this even when it had worked on the previous part.

coder@0625dcdde583:~/project/terraform$ terraform init
Initializing the backend…
Initializing modules…
Initializing provider plugins…

  • Reusing previous version of hashicorp/aws from the dependency lock file
  • Finding latest version of hashicorp/random…
  • Using previously-installed hashicorp/aws v6.0.0
  • Installing hashicorp/random v3.7.2…

    │ Error: Failed to install provider

    │ Error while installing hashicorp/random v3.7.2: chmod
    │ .terraform/providers/registry.terraform.io/hashicorp/random/3.7.2/linux_amd64/LICENSE.txt: operation not permitted

Is there a way we can have the main.tf and output.tf files reinitiated or something? It seems like they keep the changes originally done.

Me againa! hey, it seems like it was more like a permission issue, apparently from the first time we use terraform init there is no problem because it is being initialized but when it is “config” it is when the 2nd terraform init crashes because we are not allowed to edit anything.

At least this was my situation and this solved it:
Yes, I asked chatgpt for advice. Thanks!

rm -rf .terraform .terraform.lock.hcl
export TF_PLUGIN_CACHE_DIR=“$HOME/.terraform.d/plugin-cache”
mkdir -p $TF_PLUGIN_CACHE_DIR
terraform init