Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error Error: error configuring Terraform AWS Provider: failed to get shared config profile, xxxx #4

Open
amitkayal opened this issue Apr 5, 2022 · 0 comments

Comments

@amitkayal
Copy link

The build failing with error " Error: error configuring Terraform AWS Provider: failed to get shared config profile" and my terraform file has aws profile defined.

Variables with a default value.

variable "aws_profile" {
type = string
description = "The aws profile to be used"
default = "xxxx"
}

provider "aws" {
region = var.aws_region
profile = var.aws_profile

version = "3.46.0"

}

But the docker container having terraform lacks the same aws pfofile. How to fix this?

[Container] 2022/04/05 09:40:59 Waiting for agent ping

2 | [Container] 2022/04/05 09:41:01 Waiting for DOWNLOAD_SOURCE
3 | [Container] 2022/04/05 09:41:01 Phase is DOWNLOAD_SOURCE
4 | [Container] 2022/04/05 09:41:01 CODEBUILD_SRC_DIR=/codebuild/output/src831623222/src
5 | [Container] 2022/04/05 09:41:01 YAML location is /codebuild/readonly/buildspec.yml
6 | [Container] 2022/04/05 09:41:01 Processing environment variables
7 | [Container] 2022/04/05 09:41:03 Moving to directory /codebuild/output/src831623222/src
8 | [Container] 2022/04/05 09:41:03 Registering with agent
9 | [Container] 2022/04/05 09:41:03 Phases found in YAML: 2
10 | [Container] 2022/04/05 09:41:03 PRE_BUILD: 2 commands
11 | [Container] 2022/04/05 09:41:03 BUILD: 1 commands
12 | [Container] 2022/04/05 09:41:03 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED
13 | [Container] 2022/04/05 09:41:03 Phase context status code: Message:
14 | [Container] 2022/04/05 09:41:03 Entering phase INSTALL
15 | [Container] 2022/04/05 09:41:03 Phase complete: INSTALL State: SUCCEEDED
16 | [Container] 2022/04/05 09:41:03 Phase context status code: Message:
17 | [Container] 2022/04/05 09:41:03 Entering phase PRE_BUILD
18 | [Container] 2022/04/05 09:41:03 Running command terraform init
19 |  
20 | Initializing the backend...
21 |  
22 | Initializing provider plugins...
23 | - Reusing previous version of hashicorp/template from the dependency lock file
24 | - Reusing previous version of hashicorp/aws from the dependency lock file
25 | - Installing hashicorp/template v2.2.0...
26 | - Installed hashicorp/template v2.2.0 (signed by HashiCorp)
27 | - Installing hashicorp/aws v4.8.0...
28 | - Installed hashicorp/aws v4.8.0 (signed by HashiCorp)
29 |  
30 | Terraform has made some changes to the provider dependency selections recorded
31 | in the .terraform.lock.hcl file. Review those changes and commit them to your
32 | version control system if they represent changes you intended to make.
33 |  
34 | Terraform has been successfully initialized!
35 |  
36 | You may now begin working with Terraform. Try running "terraform plan" to see
37 | any changes that are required for your infrastructure. All Terraform commands
38 | should now work.
39 |  
40 | If you ever set or change modules or backend configuration for Terraform,
41 | rerun this command to reinitialize your working directory. If you forget, other
42 | commands will detect it and remind you to do so if necessary.
43 |  
44 | [Container] 2022/04/05 09:41:08 Running command terraform validate
45 | Success! The configuration is valid.
46 |  
47 |  
48 | [Container] 2022/04/05 09:41:10 Phase complete: PRE_BUILD State: SUCCEEDED
49 | [Container] 2022/04/05 09:41:10 Phase context status code: Message:
50 | [Container] 2022/04/05 09:41:10 Entering phase BUILD
51 | [Container] 2022/04/05 09:41:10 Running command terraform plan
52 | ╷
53 | │ Error: error configuring Terraform AWS Provider: failed to get shared config profile, xxx
54 | │
55 | │ with provider["registry.terraform.io/hashicorp/aws"],
56 | │ on main.tf line 13, in provider "aws":
57 | │ 13: provider "aws" {
58 | │

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant