Terraform plan is failing with missing required argument

I have created provider.tf file with below details

and below are the variables.

Not sure why above error is coming up. Please suggest.

Hi @sk8228402,

The line of code in the error message doesn’t seem to appear in the file you are looking at. I suspect this problem is actually in the top-level provider.tf file rather than in the oci-code/provider.tf file.

An AMI does need to have a name, so I think this is a correct error message. You’ll need to define the name argument inside that resource block in order for the provider to consider it to be a valid configuration for that resource.

The oci-code/provider.tf file does also seem to have a syntax error, but it’s unrelated to the one mentioned in this error message: your provider block is missing its label to specify which provider this is a configuration for. If you’re intending to use the oracle/oci provider then you’ll need to first declare a requirement for that provider and then use the provider’s local name as the label on the configuration block:

terraform {
  required_providers {
    oci = {
      source  = "oracle/oci"
      version = ">= 4.90.0"

provider "oci" {
  tenancy_ocid = var.tenancy_ocid
  # (etc...)
1 Like

Thank you Mart, it worked.