fix: убрать UseStateForUnknown с image_ref, provider v0.1.5
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
// Используется с sless_trigger (постоянный эндпоинт).
|
||||
exports.handle = async (event) => {
|
||||
const name = event.name || 'World';
|
||||
return { message: `Hello, ${name}!` };
|
||||
return { message: `Hello, ${name}! HTTP ` };
|
||||
};
|
||||
|
||||
|
||||
Binary file not shown.
@@ -22,7 +22,9 @@ resource "sless_function" "hello_http" {
|
||||
timeout_sec = 30
|
||||
|
||||
code_path = data.archive_file.handler_http.output_path
|
||||
code_hash = data.archive_file.handler_http.output_md5
|
||||
# filesha256 исходного файла — надёжнее чем output_md5 zip:
|
||||
# MD5 zip зависит от метаданных архива и может совпасть при разном содержимом
|
||||
code_hash = filesha256("${path.module}/code/handler-http.js")
|
||||
}
|
||||
|
||||
resource "sless_trigger" "hello_http" {
|
||||
|
||||
@@ -24,7 +24,8 @@ resource "sless_function" "hello_job" {
|
||||
timeout_sec = 30
|
||||
|
||||
code_path = data.archive_file.handler_job.output_path
|
||||
code_hash = data.archive_file.handler_job.output_md5
|
||||
# filesha256 исходного файла — надёжнее чем output_md5 zip
|
||||
code_hash = filesha256("${path.module}/code/handler-job.js")
|
||||
}
|
||||
|
||||
# Одноразовый запуск. Все поля immutable — изменение любого пересоздаёт джоб.
|
||||
|
||||
@@ -8,7 +8,7 @@ terraform {
|
||||
required_providers {
|
||||
sless = {
|
||||
source = "terra.k8c.ru/naeel/sless"
|
||||
version = "~> 0.1.4"
|
||||
version = "~> 0.1.5"
|
||||
}
|
||||
archive = {
|
||||
source = "hashicorp/archive"
|
||||
|
||||
@@ -131,11 +131,11 @@ func (r *FunctionResource) Schema(_ context.Context, _ resource.SchemaRequest, r
|
||||
stringplanmodifier.UseStateForUnknown(),
|
||||
},
|
||||
},
|
||||
// image_ref — только для чтения, вычисляется оператором после сборки образа.
|
||||
// Намеренно без UseStateForUnknown: при пересборке (смена code_hash) image_ref
|
||||
// может измениться (например смена registry), поэтому всегда (known after apply).
|
||||
"image_ref": schema.StringAttribute{
|
||||
Computed: true,
|
||||
PlanModifiers: []planmodifier.String{
|
||||
stringplanmodifier.UseStateForUnknown(),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user