Skip to content

Commit 5f34d3a

Browse files
committed
add more examples
1 parent 100e37a commit 5f34d3a

File tree

2 files changed

+48
-6
lines changed

2 files changed

+48
-6
lines changed

docs/stackit_beta_server_create.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,32 @@ stackit beta server create [flags]
1313
### Examples
1414

1515
```
16-
Create a server with machine type "t1.1", name "server1" and image with id xxx
16+
Create a server from an image with id xxx
1717
$ stackit beta server create --machine-type t1.1 --name server1 --image-id xxx
1818
19-
Create a server with machine type "t1.1", name "server1", image with id xxx and labels
19+
Create a server with labels from an image with id xxx
2020
$ stackit beta server create --machine-type t1.1 --name server1 --image-id xxx --labels key=value,foo=bar
2121
22-
Create a server with machine type "t1.1", name "server1", boot volume source id "xxx", type "image" and size 64GB
22+
Create a server with a boot volume
2323
$ stackit beta server create --machine-type t1.1 --name server1 --boot-volume-source-id xxx --boot-volume-source-type image --boot-volume-size 64
24+
25+
Create a server with a boot volume from an existing volume
26+
$ stackit beta server create --machine-type t1.1 --name server1 --boot-volume-source-id xxx --boot-volume-source-type volume
27+
28+
Create a server with a keypair
29+
$ stackit beta server create --machine-type t1.1 --name server1 --image-id xxx --keypair-name example
30+
31+
Create a server with a network
32+
$ stackit beta server create --machine-type t1.1 --name server1 --image-id xxx --network-id yyy
33+
34+
Create a server with a network interface
35+
$ stackit beta server create --machine-type t1.1 --name server1 --boot-volume-source-id xxx --boot-volume-source-type image --boot-volume-size 64 --network-interface-ids yyy
36+
37+
Create a server with an attached volume
38+
$ stackit beta server create --machine-type t1.1 --name server1 --boot-volume-source-id xxx --boot-volume-source-type image --boot-volume-size 64 --volumes yyy
39+
40+
Create a server with user data (cloud-init)
41+
$ stackit beta server create --machine-type t1.1 --name server1 --boot-volume-source-id xxx --boot-volume-source-type image --boot-volume-size 64 --user-data file("${path.module}/cloud-init.yaml")
2442
```
2543

2644
### Options

internal/cmd/beta/server/create/create.go

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,41 @@ func NewCmd(p *print.Printer) *cobra.Command {
7373
Args: args.NoArgs,
7474
Example: examples.Build(
7575
examples.NewExample(
76-
`Create a server with machine type "t1.1", name "server1" and image with id xxx`,
76+
`Create a server from an image with id xxx`,
7777
`$ stackit beta server create --machine-type t1.1 --name server1 --image-id xxx`,
7878
),
7979
examples.NewExample(
80-
`Create a server with machine type "t1.1", name "server1", image with id xxx and labels`,
80+
`Create a server with labels from an image with id xxx`,
8181
`$ stackit beta server create --machine-type t1.1 --name server1 --image-id xxx --labels key=value,foo=bar`,
8282
),
8383
examples.NewExample(
84-
`Create a server with machine type "t1.1", name "server1", boot volume source id "xxx", type "image" and size 64GB`,
84+
`Create a server with a boot volume`,
8585
`$ stackit beta server create --machine-type t1.1 --name server1 --boot-volume-source-id xxx --boot-volume-source-type image --boot-volume-size 64`,
8686
),
87+
examples.NewExample(
88+
`Create a server with a boot volume from an existing volume`,
89+
`$ stackit beta server create --machine-type t1.1 --name server1 --boot-volume-source-id xxx --boot-volume-source-type volume`,
90+
),
91+
examples.NewExample(
92+
`Create a server with a keypair`,
93+
`$ stackit beta server create --machine-type t1.1 --name server1 --image-id xxx --keypair-name example`,
94+
),
95+
examples.NewExample(
96+
`Create a server with a network`,
97+
`$ stackit beta server create --machine-type t1.1 --name server1 --image-id xxx --network-id yyy`,
98+
),
99+
examples.NewExample(
100+
`Create a server with a network interface`,
101+
`$ stackit beta server create --machine-type t1.1 --name server1 --boot-volume-source-id xxx --boot-volume-source-type image --boot-volume-size 64 --network-interface-ids yyy`,
102+
),
103+
examples.NewExample(
104+
`Create a server with an attached volume`,
105+
`$ stackit beta server create --machine-type t1.1 --name server1 --boot-volume-source-id xxx --boot-volume-source-type image --boot-volume-size 64 --volumes yyy`,
106+
),
107+
examples.NewExample(
108+
`Create a server with user data (cloud-init)`,
109+
`$ stackit beta server create --machine-type t1.1 --name server1 --boot-volume-source-id xxx --boot-volume-source-type image --boot-volume-size 64 --user-data file("${path.module}/cloud-init.yaml")`,
110+
),
87111
),
88112
PreRun: func(cmd *cobra.Command, _ []string) {
89113
bootVolumeSourceId, _ := cmd.Flags().GetString(bootVolumeSourceIdFlag)

0 commit comments

Comments
 (0)