func()

in ec/ecresource/extensionresource/schema.go [46:126]


func (r *Resource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
	resp.Schema = schema.Schema{
		Description: `
  Provides an Elastic Cloud extension resource, which allows extensions to be created, updated, and deleted.

  Extensions allow users of Elastic Cloud to use custom plugins, scripts, or dictionaries to enhance the core functionality of Elasticsearch. Before you install an extension, be sure to check out the supported and official [Elasticsearch plugins](https://www.elastic.co/guide/en/elasticsearch/plugins/current/index.html) already available.

  **Tip :** If you experience timeouts when uploading an extension through a slow network, you might need to increase the [timeout setting](https://registry.terraform.io/providers/elastic/ec/latest/docs#timeout).
`,
		Attributes: map[string]schema.Attribute{
			"name": schema.StringAttribute{
				Description: "Name of the extension",
				Required:    true,
			},
			"description": schema.StringAttribute{
				Description: "Description for the extension",
				Computed:    true,
				Optional:    true,
				PlanModifiers: []planmodifier.String{
					planmodifiers.StringDefaultValue(""),
				},
			},
			"extension_type": schema.StringAttribute{
				Description: "Extension type. Must be `bundle` or `plugin`. A `bundle` will usually contain a dictionary or script, where a `plugin` is compiled from source.",
				Required:    true,
			},
			"version": schema.StringAttribute{
				Description: "Elastic stack version. A full version (e.g 8.7.0) should be set for plugins. A wildcard (e.g 8.*) may be used for bundles.",
				Required:    true,
			},
			"download_url": schema.StringAttribute{
				Description: "The URL to download the extension archive.",
				Computed:    true,
				Optional:    true,
				PlanModifiers: []planmodifier.String{
					planmodifiers.StringDefaultValue(""),
				},
			},
			// Uploading file via API
			"file_path": schema.StringAttribute{
				Description: "Local file path to upload as the extension.",
				Optional:    true,
			},
			"file_hash": schema.StringAttribute{
				Description: "Hash value of the file. Triggers re-uploading the file on change.",
				Optional:    true,
			},
			"url": schema.StringAttribute{
				Description: "The extension URL which will be used in the Elastic Cloud deployment plan.",
				Computed:    true,
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.UseStateForUnknown(),
				},
			},
			"last_modified": schema.StringAttribute{
				Description: "The datatime the extension was last modified.",
				Computed:    true,
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.UseStateForUnknown(),
					useUnknownIfOtherChanges{},
				},
			},
			"size": schema.Int64Attribute{
				Description: "The size of the extension file in bytes.",
				Computed:    true,
				PlanModifiers: []planmodifier.Int64{
					int64planmodifier.UseStateForUnknown(),
					useUnknownIfOtherChanges{},
				},
			},
			// Computed attributes
			"id": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "Unique identifier of this resource.",
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.UseStateForUnknown(),
				},
			},
		},
	}
}