asquarezone/TerraformZone

Error while creating Instance using Terraform

Closed this issue · 1 comments

Hi,

I got the below error while creating EC2 instance using Terraform

Error: Error applying plan:

1 error(s) occurred:

  • aws_instance.iOne: 1 error(s) occurred:

  • aws_instance.iOne: Error launching source instance: UnauthorizedOperation: You are not authorized to perform this operation. Encoded authorization failure message: p1EyykaD2fI3csh_sf_WvdHF_s5IYypR-3EcbaGMemY_lrLJhI9yhfwzJxUfir6yM4mJMUmXALL-L3CURvK71l41YQfZxzmEjzm8RDi3b5TN5ejeSQ8o8bUBCccHucYOswgQG-xJNiGcSVpTAY6-L6A6xqQG6vYlk8DwkyHHMaIp7wmkEtUQ4hktsHdo8rcPsSKAUkgS8Iyx8eJxTevYN5xQVVbh0IcuOqHMM-qLttAuKUaEvEwUvmX_1wnj8mbC-HVMkFGwtAWxRjtYPie0RclyJNqtSYZRoqRHKXOvTNbnfnGgZ7NOQTrNPNIsO6ed3JgyvEDqrkNDf4sUI2tLGae5tK_HCyxGFd8KkwH2D1wtWHLDAy0VJ68IehrLQCvej-QtNRLkEU1oHNN-dsgAwQUenlx73JvdoTOhOOi7Cn0zakBBtWjPnMzkc4VlfcNyeZL_-kpa-hcPZ7uYjaObnU6QPY8hv1iWSLR9zb8uOU2j6JlczuKqMO9MMfy9LNM4Bzezpq8ppKVvrhFIh6Y-q_C_rTV_xJAPJZFFGT6jKs0N1wBYwUzIQiZLFgIPVHky9uN9I41XKzTi_UFU44LcvPRsdFTQpT64asMpcFsUuSTqpSmmzRaL_SMjadBiQCzkPRWNwG9r_B1ctndLficr1gXptABqRJo
    status code: 403, request id: d7393c54-8a58-48cf-b3dd-dc05113c62fd

=========================================================
The below values have been provided in the main.tf

provider "aws" {
region = "us-east-2"
access_key = "AKIAQ75ZE6ZR7DMO43FN"
secret_key = "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"
}

resource "aws_instance" "iOne" {
ami = "ami-02bcbb802e03574ba"
instance_type = "t2.micro"
key_name = "QTLearn"

===================================================
Terraform state file output -
cat terraform.tfstate
{
"version": 3,
"terraform_version": "0.11.13",
"serial": 1,
"lineage": "841d4d97-833a-f925-d511-784ac8f682ab",
"modules": [
{
"path": [
"root"
],
"outputs": {},
"resources": {},
"depends_on": []
}
]
}

Issue resolved after providing AdministratorAccess to the user