sparse-intern-71089
05/31/2023, 3:44 PMearly-oil-32855
06/01/2023, 12:23 PMpackage main
import (
"<http://github.com/pulumi/pulumi-azure-native/sdk/go/azure/containerregistry|github.com/pulumi/pulumi-azure-native/sdk/go/azure/containerregistry>"
"<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi|github.com/pulumi/pulumi/sdk/v3/go/pulumi>"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := containerregistry.NewTask(ctx, "myTask", &containerregistry.TaskArgs{
AgentConfiguration: &containerregistry.AgentPropertiesArgs{
Cpu: <http://pulumi.Int|pulumi.Int>(2),
},
IsSystemTask: pulumi.Bool(false),
Location: pulumi.String("germanywestcentral"),
Platform: &containerregistry.PlatformPropertiesArgs{
Architecture: pulumi.String("amd64"),
Os: pulumi.String("linux"),
},
RegistryName: pulumi.String("myRegistry"),
ResourceGroupName: pulumi.String("myResourceGroup"),
Status: pulumi.String("Enabled"),
Step: pulumi.Map{
"EncodedTaskContent": pulumi.String("dmVyc2lvbjogdjEuMS4wCnN0ZXBzOiAKICAtIGNtZDogYWNyIHB1cmdlIC0tYWdvIDkwZCAtLXVudGFnZ2VkCiAgICBkaXNhYmxlV29ya2luZ0RpcmVjdG9yeU92ZXJyaWRlOiB0cnVlCiAgICB0aW1lb3V0OiAzNjAwCg=="),
"Type": pulumi.String("EncodedTask"),
},
TaskName: pulumi.String("myTask"),
Timeout: <http://pulumi.Int|pulumi.Int>(3600),
Trigger: &containerregistry.TriggerPropertiesArgs{
BaseImageTrigger: &containerregistry.BaseImageTriggerArgs{
BaseImageTriggerType: pulumi.String("Runtime"),
Name: pulumi.String("defaultBaseimageTriggerName"),
Status: pulumi.String("Enabled"),
UpdateTriggerPayloadType: pulumi.String("Default"),
},
TimerTriggers: containerregistry.TimerTriggerArray{
&containerregistry.TimerTriggerArgs{
Name: pulumi.String("t1"),
Schedule: pulumi.String("0 0 * * 0"),
Status: pulumi.String("Enabled"),
},
},
},
}, pulumi.Protect(true))
if err != nil {
return err
}
return nil
})
}
When passing Step:
this way at least the Go compiler is not complaining about the type but when running:
pulumi up --yes --skip-preview -v=9 --debug --logtostderr --logflow
I can observe in that the API call's payload is empty for `step:`:
PUT /subscriptions/[redacted]/resourceGroups/[redacted]/providers/Microsoft.ContainerRegistry/registries/[redacted]/tasks/purge?api-version=2019-06-01-preview HTTP/1.1
Host: <http://management.azure.com|management.azure.com>
User-Agent: Go/go1.19.8 (amd64-linux) go-autorest/v14.2.1 pulumi-azure-native/1.102.0 pid-a90539d8-a7a6-5826-95c4-1fbef22d4b22
Content-Length: 213
Content-Type: application/json; charset=utf-8
{"location":"germanywestcentral","properties":{"isSystemTask":false,"platform":{"architecture":"amd64","os":"Linux"},"step":{},"timeout":3600,"trigger":{"timerTriggers":[{"name":"purge","schedule":"0 0 * * 0"}]}}}
===================================================== HTTP Request End PUT <https://management.azure.com/subscriptions/[redacted]/resourceGroups/[redacted]/providers/Microsoft.ContainerRegistry/registries/[redacted]/tasks/purge?api-version=2019-06-01-preview>
I0601 14:21:21.557388 33178 provider.go:1820] HTTP Response Begin PUT [<https://management.azure.com/subscriptions/[redacted]/resourceGroups/[redacted]/providers/Microsoft.ContainerRegistry/registries/[redacted]/tasks/purge?api-version=2019-06-01-preview> ===================================================
HTTP/2.0 400 Bad Request
Content-Length: 271
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Thu, 01 Jun 2023 12:21:20 GMT
Expires: -1
Pragma: no-cache
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Ms-Correlation-Request-Id: cd0f9096-6d88-48bc-82d6-322f0fbec091
X-Ms-Ratelimit-Remaining-Subscription-Writes: 1199
X-Ms-Request-Id: 852082d4-7e98-4959-af45-e2e5c96c1f44
X-Ms-Routing-Request-Id: GERMANYNORTH:20230601T122121Z:cd0f9096-6d88-48bc-82d6-322f0fbec091
{"error":{"code":"InvalidRequestBody","message":"The request body is required for this request. Check if the body is not empty. If the request expects a polymorphic type, check if it has the discriminator property and is one of the described values.","target":"request"}}
===================================================== HTTP Response End PUT <https://management.azure.com/subscriptions/[redacted]/resourceGroups/[redacted]/providers/Microsoft.ContainerRegistry/registries/[redacted]/tasks/purge?api-version=2019-06-01-preview>
early-oil-32855
06/01/2023, 12:52 PMSteps:
to the following did the trick:
Step: pulumi.Map{
"encodedTaskContent": pulumi.String("dmVyc2lvbjogdjEuMS4wCnN0ZXBzOiAKICAtIGNtZDogYWNyIHB1cmdlIC0tYWdvIDkwZCAtLXVudGFnZ2VkCiAgICBkaXNhYmxlV29ya2luZ0RpcmVjdG9yeU92ZXJyaWRlOiB0cnVlCiAgICB0aW1lb3V0OiAzNjAwCg=="),
"type": pulumi.String("EncodedTask"),
},