English 中文(简体)
Terra Custom Read
原标题:Terraform Custom Provider Read Values

我在做的是按习俗分类的提供者,对标签有选择性的投入,但我发现的挑战是,扼杀使用ValueString()从主要价值中取回。 tf, 无法确定哪类用途。 MapType。

该守则是:

type ResourceModel struct {
    InstanceName   types.String  `tfsdk:"instance_name"`
    Id             types.String  `tfsdk:"id"`
    Labels         types.MapType `tfsdk:"labels"`
}

func (r *vmResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
    resp.Schema = schema.Schema{
        Attributes: map[string]schema.Attribute{
            "instance_name": schema.StringAttribute{
                Required: true,
            },
            "id": schema.StringAttribute{
                Required: true,
            },
            "labels":schema.MapAttribute{
                Optional: true,
            },
        },
    }
}

    var plan ResourceModel
    diags := req.Plan.Get(ctx, &plan)

    if resp.Diagnostics.HasError() {
        return
    }

    request := VmCreate{
        InstanceName:   plan.InstanceName.ValueString(),
        Id:             plan.Id.ValueString(),
        Labels:         plan.Labels.????
    }

寻找解决办法,但所有我都试图失败。

问题回答

暂无回答




相关问题
Terra Custom Read

我在做的是按习俗分类的提供者,对标签有选择性的投入,但我发现的挑战是,扼杀使用ValueString()从主要价值中取回。 f,不确定......

Retrieve IDs in Terraform before script execution

I m a freshman and I don t know if I have a general thinking error but how do I get around the issue that when I want to roll out a script that there are some IDs missing that I would only get with ...

The plugin.(*GRPCProvider)

I am trying to deploy a Terraform stack from a Linux EC2 and getting the following error: The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled. and │ The plugin.(*GRPCProvider)....

热门标签