func()

in internal/provider/telemetry_resource.go [63:116]


func (r *TelemetryResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
	resp.Schema = schema.Schema{
		// This description is used by the documentation generator and the language server.
		MarkdownDescription: "`modtm_telemetry` resource gathers and sends telemetry data to a specified endpoint. The aim is to provide visibility into the lifecycle of your Terraform modules - whether they are being created, updated, or deleted.",

		Attributes: map[string]schema.Attribute{
			"id": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "Resource identifier",
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.UseStateForUnknown(),
				},
			},
			"tags": schema.MapAttribute{
				Required:            true,
				MarkdownDescription: "Tags to be sent to telemetry endpoint. The following tags are reserved and cannot be used: `event`. When specififying `module_path`, the `source` and `version` tags will be automatically added to the tags sent to the telemetry endpoint.",
				ElementType:         basetypes.StringType{},
				Validators: []validator.Map{
					mapValidator{},
				},
			},
			"endpoint": schema.StringAttribute{
				Optional: true,
				MarkdownDescription: "Telemetry endpoint to send data to, will override provider's default `endpoint` setting.\n" +
					"You can set `endpoint` in this resource, when there's no explicit `setting` in the provider block, it will override provider's default `endpoint`.\n\n" +
					"|Explicit `endpoint` in `provider` block | `MODTM_ENDPOINT` environment variable set | Explicit `endpoint` in resource block | Telemetry endpoint |\n" +
					"|--|--|--|--|\n" +
					"| ✓ | ✓ | ✓ | Explicit `endpoint` in `provider` block | \n" +
					"| ✓ | ✓ | × | Explicit `endpoint` in `provider` block | \n" +
					"| ✓ | × | ✓ | Explicit `endpoint` in `provider` block | \n" +
					"| ✓ | × | × | Explicit `endpoint` in `provider` block | \n" +
					"| × | ✓ | ✓ | `MODTM_ENDPOINT` environment variable | \n" +
					"| × | ✓ | × | `MODTM_ENDPOINT` environment variable | \n" +
					"| × | × | ✓ | Explicit `endpoint` in resource block | \n" +
					"| × | × | × | Default Microsoft telemetry service endpoint | \n",
			},
			//TODO: Remove these fields in v1
			"nonce": schema.NumberAttribute{
				Optional:            true,
				Computed:            true,
				DeprecationMessage:  "This field has been deprecated and will be removed in `v1`. Do not use it.",
				Description:         "A nonce that works with tags-generation tools like BridgeCrew Yor",
				MarkdownDescription: "A nonce that works with tags-generation tools like [BridgeCrew Yor](https://yor.io/)",
			},
			"ephemeral_number": schema.NumberAttribute{
				Optional:            true,
				Computed:            true,
				DeprecationMessage:  "This field has been deprecated and will be removed in `v1`. Do not use it.",
				Description:         "An ephemeral number that works with tags-generation tools like BridgeCrew Yor",
				MarkdownDescription: "An ephemeral number that works with tags-generation tools like [BridgeCrew Yor](https://yor.io/)",
			},
		},
	}
}