func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := sakuracloud.NewServer(ctx, "from-pulumi-with-go", &sakuracloud.ServerArgs{
Name: "from-pulumi-with-go",
Memory: 1,
})
if err != nil {
return err
}
return nil
})
}
$ pulumi up -y
Previewing update (dev):
Type Name Plan
+ pulumi:pulumi:Stack minimum-go-dev create
+ └─ sakuracloud:index:Server from-pulumi-with-go create
Resources:
+ 2 to create
Updating (dev):
Type Name Status
+ pulumi:pulumi:Stack minimum-go-dev created
+ └─ sakuracloud:index:Server from-pulumi-with-go created
Resources:
+ 2 created
Duration: 25s
$ pulumi stack export
{
"version": 3,
"deployment": {
"manifest": {
"time": "2020-01-09T16:02:43.506274+09:00",
"magic": "xxxxxx",
"version": "v1.8.1"
},
"secrets_providers": {
"type": "passphrase",
"state": {
"salt": "xxx"
}
},
"resources": [
{
"urn": "urn:pulumi:dev::minimum-go::pulumi:pulumi:Stack::minimum-go-dev",
"custom": false,
"type": "pulumi:pulumi:Stack"
},
{
"urn": "urn:pulumi:dev::minimum-go::pulumi:providers:sakuracloud::default",
"custom": true,
"id": "a20fb9d7-9bef-4047-8b8b-45a932a23472",
"type": "pulumi:providers:sakuracloud"
},
{
"urn": "urn:pulumi:dev::minimum-go::sakuracloud:index/server:Server::from-pulumi-with-go",
"custom": true,
"id": "1",
"type": "sakuracloud:index/server:Server",
"inputs": {
"memory": 1,
"name": "from-pulumi-with-go"
},
"outputs": {
"__meta": "{\"schema_version\":\"1\"}",
"id": "1",
"memory": 1,
"name": "from-pulumi-with-go"
},
"parent": "urn:pulumi:dev::minimum-go::pulumi:pulumi:Stack::minimum-go-dev",
"provider": "urn:pulumi:dev::minimum-go::pulumi:providers:sakuracloud::default::a20fb9d7-9bef-4047-8b8b-45a932a23472",
"propertyDependencies": {
"memory": null,
"name": null
}
}
]
}
}
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := sakuracloud.NewServer(ctx, "from-pulumi-with-go", &sakuracloud.ServerArgs{
Name: "from-pulumi-with-go",
Memory: 2, // If this field is updated, the resource ID will be changed.
})
if err != nil {
return err
}
return nil
})
}
pulumi up -y
Previewing update (dev):
Type Name Plan Info
pulumi:pulumi:Stack minimum-go-dev
~ └─ sakuracloud:index:Server from-pulumi-with-go update [diff: ~memory]
Resources:
~ 1 to update
1 unchanged
Updating (dev):
Type Name Status Info
pulumi:pulumi:Stack minimum-go-dev 3 messages
~ └─ sakuracloud:index:Server from-pulumi-with-go updated [diff: ~memory]
Resources:
~ 1 updated
1 unchanged
Duration: 4s
Permalink: file:///Users/kaz/.pulumi/stacks/dev.json
$ pulumi stack export
{
"version": 3,
"deployment": {
"manifest": {
"time": "2020-01-09T16:24:04.225325+09:00",
"magic": "xxx",
"version": "v1.8.1"
},
"secrets_providers": {
"type": "passphrase",
"state": {
"salt": "xxx"
}
},
"resources": [
{
"urn": "urn:pulumi:dev::minimum-go::pulumi:pulumi:Stack::minimum-go-dev",
"custom": false,
"type": "pulumi:pulumi:Stack"
},
{
"urn": "urn:pulumi:dev::minimum-go::pulumi:providers:sakuracloud::default",
"custom": true,
"id": "a20fb9d7-9bef-4047-8b8b-45a932a23472",
"type": "pulumi:providers:sakuracloud"
},
{
"urn": "urn:pulumi:dev::minimum-go::sakuracloud:index/server:Server::from-pulumi-with-go",
"custom": true,
"id": "1",
"type": "sakuracloud:index/server:Server",
"inputs": {
"memory": 2,
"name": "from-pulumi-with-go"
},
"outputs": {
"__meta": "{\"schema_version\":\"1\"}",
"id": "2",
"memory": 2,
"name": "from-pulumi-with-go"
},
"parent": "urn:pulumi:dev::minimum-go::pulumi:pulumi:Stack::minimum-go-dev",
"provider": "urn:pulumi:dev::minimum-go::pulumi:providers:sakuracloud::default::a20fb9d7-9bef-4047-8b8b-45a932a23472",
"propertyDependencies": {
"memory": null,
"name": null
}
}
]
}
}
Note: The resource has "id":"1"
, but the Terraform provider returns "id":"2"
.
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := sakuracloud.NewServer(ctx, "from-pulumi-with-go", &sakuracloud.ServerArgs{
Name: "from-pulumi-with-go",
Memory: 4,
})
if err != nil {
return err
}
return nil
})
}
$ pulumi up -y
Previewing update (dev):
Type Name Plan Info
pulumi:pulumi:Stack minimum-go-dev
~ └─ sakuracloud:index:Server from-pulumi-with-go update [diff: ~memory]
Resources:
~ 1 to update
1 unchanged
Updating (dev):
Type Name Status Info
pulumi:pulumi:Stack minimum-go-dev **failed** 1 error; 3 messages
~ └─ sakuracloud:index:Server from-pulumi-with-go **updating failed** [diff: ~memory]; 1 error
Diagnostics:
pulumi:pulumi:Stack (minimum-go-dev):
error: update failed
sakuracloud:index:Server (from-pulumi-with-go):
error: 1 error occurred:
* updating urn:pulumi:dev::minimum-go::sakuracloud:index/server:Server::from-pulumi-with-go: Couldn't find SakuraCloud Server resource: Error in response: &sacloud.ResultErrorValue{IsFatal:true, Serial:"xxx", Status:"404 Not Found", ErrorCode:"not_found", ErrorMessage:"xxx"}
Resources:
1 unchanged
Duration: 1s