Skip to content

Commit

Permalink
feat(do/droplet): add support for packages (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
opichon authored Feb 2, 2025
1 parent 226a63c commit f5b3edf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions generators/do-droplet/templates/do-droplet/Pulumi.stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ config:
# <%= projectName %>:blockVolumeStack: <%= prefix %>-do-resources
<%= projectName %>:image: ubuntu-24-10-x64
<%= projectName %>:name: <%= prefix %>-<%= environment %>
# <%= projectName %>:packages:
# - PACKAGE1
# - PACKAGE2
<%= projectName %>:pathToSshKeysFolder: "../../ssh-keys"
# <%= projectName %>:projectId: DO PROJECT ID
# <%= projectName %>:projectStack: <%= prefix %>-do-resources
Expand Down
2 changes: 2 additions & 0 deletions generators/do-droplet/templates/do-droplet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ If none are defined, then root access will be password-based.
| blockVolumeStack | string | | Name of the Pulumi project in which the block volume was provisioned |
| image | string | `ubuntu-24-10-x64` | DO dropletimage |
| name | string | `{stack}` | DO droplet name |
| packages | string[] | | Packages to install on the droplet |
| pathToSshKeysFolder | string | `../../ssh-keys` | Path to folder containing public key files |
| projectId | string | | Id of the DigitalOcean project to which the droplet is associated |
| projectStack | string | | Name of the Pulumi project where the DigitalOcean project was provisioned |
Expand All @@ -170,6 +171,7 @@ If none are defined, then root access will be password-based.
| sshKeyNames | string[] | | Names of DigitalOcean SSH keys associated with the root user |
| swapFile | string | | Path to the swap file |
| swapSize | number | | Size of the swap file |
| userDataTemplate | string | `./cloud-config.njx` | Path to user data template |
| userGroups | comma-separated strings | | Groups to which the user belongs |
| username | string | | Name of the user to create in the droplet |
| vpcId | string | | Id of the DigitalOcean VPC to which the droplet is associated |
Expand Down
3 changes: 3 additions & 0 deletions generators/do-droplet/templates/do-droplet/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export const getConfig = async () => {
const stack = getStack();
const stackConfig = new Config();

const packages = stackConfig.getObject<string[]>("packages") || [];

const pathToSshKeysFolder = stackConfig.get("pathToSshKeysFolder") || "../../ssh-keys";

const publicKeyNames = stackConfig.requireObject("publicKeyNames") as string[];
Expand Down Expand Up @@ -74,6 +76,7 @@ export const getConfig = async () => {
return {
image: stackConfig.require("image"),
name: stackConfig.get("name") || stack,
packages,
pathToSshKeysFolder,
projectId,
protect: stackConfig.getBoolean("protect"),
Expand Down
1 change: 1 addition & 0 deletions generators/do-droplet/templates/do-droplet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export = async () => {
config.name,
{
image: config.image,
packages: config.packages,
projectId: config.projectId,
region: config.region,
reservedIpId: config.reservedIpId,
Expand Down

0 comments on commit f5b3edf

Please sign in to comment.