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

Missing required argument #350

Open
naicoram01 opened this issue Apr 25, 2023 · 6 comments
Open

Missing required argument #350

naicoram01 opened this issue Apr 25, 2023 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@naicoram01
Copy link

Hi,

I have the following error :
│ Error: Missing required argument

│ The argument "access_key_id" is required, but was not set.


│ Error: Missing required argument

│ The argument "region" is required, but was not set.


│ Error: Missing required argument

│ The argument "secret_key_id" is required, but was not set.

even having the the following configuration on providers.tf :
provider "outscale" {
access_key_id = "XXXXX"
secret_key_id = "YYYYY"
region = "cloudgouv-eu-west-1"
}

Terraform v1.4.5
on windows_386

  • provider registry.terraform.io/outscale/outscale v0.9.0

Thank you in advance for your help.

Best regardds,
Mohammed SETTAF

@naicoram01 naicoram01 added the bug Something isn't working label Apr 25, 2023
@naicoram01
Copy link
Author

for information, in the debugs I have always in the end of the debug this lines :

2023-04-25T17:11:12.875+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-04-25T17:11:12.892+0200 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/outscale/outscale/0.9.0/windows_386/terraform-provider-outscale_v0.9.0.exe pid=3752
2023-04-25T17:11:12.892+0200 [DEBUG] provider: plugin exited
2023-04-25T17:11:14.196+0200 [INFO] backend/local: refresh calling Refresh
2023-04-25T17:11:14.287+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-04-25T17:11:14.308+0200 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/outscale-dev/outscale/0.7.0/windows_386/terraform-provider-outscale_v0.7.0.exe pid=19272
2023-04-25T17:11:14.308+0200 [DEBUG] provider: plugin exited

@outscale-toa
Copy link
Member

Hello Mohammed SETTAF,

Thanks for reaching us,
There are two options to set access_key_id/secret_key_id:

  • First one :
    in provider.tf
terraform {
  required_providers {
    outscale = {
      source  = "outscale/outscale"
      version = "0.9.0"
    }
  }
}

provider "outscale" {
  access_key_id = var.access_key_id
  secret_key_id = var.secret_key_id
  region              = var.region
}

in variables.tf

variable "access_key_id" {}
variable "secret_key_id" {}
variable "region" {}

in terraform.tfvars

access_key_id    = "MyAccessKey" ## you can put your access_key_id here  Or  export TF_VAR_access_key_id="Myaccesskey"
secret_key_id    = "MySecretKey" ## you can put your secret_key_id here  Or export TF_VAR_secret_key_id="Mysecretkey"
region                = "cloudgouv-eu-west-1" ## you can put your region here  Or export TF_VAR_region="Myregion"
terraform init
terraform plan 
....

===========================

  • Second one
    in provider.tf
terraform {
  required_providers {
    outscale = {
      source  = "outscale/outscale"
      version = "0.9.0"
    }
  }
}

in variables.tf

variable "region" {}

in terraform.tfvars

region                = "cloudgouv-eu-west-1"
export OUTSCALE_ACCESSKEYID="Myaccesskey"
export OUTSCALE_SECRETKEYID="Mysecretkey"
terraform init
terraform plan 
...

There are a few examples here: example

Best regards.

@naicoram01
Copy link
Author

Thank you for your reply.

Even with this configuration I always have the same errors :( ....

For information, everything worked fine last week and from friday I started having this error... I didn't have this kind of spliting in the configuration file but I have all the variable in one file...

Also, when I execute terraform plan a lot of output "outscale_security_group_rule.rule6_sgadmincapsule: Refreshing state... [id=XXXXXX] andd after I have this output error

│ Error: Missing required argument

│ The argument "access_key_id" is required, but was not set.


│ Error: Missing required argument

│ The argument "region" is required, but was not set.


│ Error: Missing required argument

│ The argument "secret_key_id" is required, but was not set.

Thank you for your help

@outscale-toa
Copy link
Member

outscale-toa commented Apr 26, 2023

Hello,
Can you try this:

export TF_VAR_access_key_id="Your_accesskey"
export TF_VAR_secret_key_id="Your_secretkey"
export TF_VAR_region="cloudgouv-eu-west-1"
terraform plan
terraform apply

@naicoram01
Copy link
Author

Hello,

Below the informations you asked :

Provider.tf :
terraform {
required_providers {
outscale = {
source = "outscale/outscale"
version = "0.9.0"
}
}
}

provider "outscale" {
access_key_id = var.access_key_id
secret_key_id = var.secret_key_id
region = var.region
}

variables.tf :
variable "access_key_id" { }
variable "secret_key_id" { }
variable "region" { }

terraform.tfvars :
access_key_id = "YYYYY"
secret_key_id = "XXXXX"
region = "cloudgouv-eu-west-1"

I tried also the solution to export the variables and it doesn't work :( :(

For information, when it was working I used the provider outscale-dev. So the tfsate have the "outscale-dev" as provider.
Also, I use the terraform in windows system.

Thank you for you support.

Best regards,
Mohammed SETTAF

@outscale-toa
Copy link
Member

outscale-toa commented Apr 26, 2023

Hello Mohammed SETTAF,

I tried it under Windows and it works.

Can you create a new folder (testTF ) and put these files in it? :

provider.tf

terraform {
  required_providers {
    outscale = {
      source  = "outscale/outscale"
      version = "0.9.0"
    }
  }
}

provider "outscale" {
  access_key_id = var.access_key_id
  secret_key_id = var.secret_key_id
  region        = var.region
}

in variables.tf

variable "access_key_id" {}
variable "secret_key_id" {}
variable "region" {}

in terraform.tfvars

access_key_id    = "MyAccessKey" 
secret_key_id    = "MySecretKey" 
region                = "cloudgouv-eu-west-1" 

volume.tf

terraform {
  required_providers {
    outscale = {
      source  = "outscale/outscale"
      version = "0.9.0"
    }
  }
}
resource "outscale_volume" "volume_test" {
  subregion_name = "${var.region}a"  ## fix your subregion_name here, if not correct
  volume_type    = "gp2"
  size           ="50" 
}

copy terraform.exe in testTF if terraform is not in your Windows PATH

cd  testTF

terraform init
TF_LOG=TRACE terraform apply

Best regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants