最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

go - Terraform provider set variable on provider level - Stack Overflow

programmeradmin0浏览0评论

I have a terraform provider, built with the terraform-sdk v2, the provider.go file looks as follows:

func Provider() *schema.Provider {
return &schema.Provider{
    Schema: map[string]*schema.Schema{
        "aws_region": {
            Type:     schema.TypeString,
            Required: true,
        },
    },
    ResourcesMap: map[string]*schema.Resource{
        "aws_ecr_push_image": ResourcePushImage(),
    },
    ConfigureContextFunc: providerConfigure,
}
 }

func providerConfigure(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) {
    awsRegion := d.Get("aws_region").(string)
    return awsRegion, nil
}

However when running terraform apply, I always get the error:

│ Error: Unsupported argument
│ 
│   on main.tf line 11, in provider "ecrbuildpush":
│   11:     aws_region = "eu-central-1"    
│ 
│ An argument named "aws_region" is not expected here.
发布评论

评论列表(0)

  1. 暂无评论