pulumi / pulumi-java

Java support for Pulumi
Apache License 2.0
69 stars 21 forks source link

[api/suggestion] rename `App.java` in templates/examples #409

Open dixler opened 2 years ago

dixler commented 2 years ago

Hello!

Issue details

I'm working on a demo and I want to embed pulumi-java into an existing spring app. The default name in examples App seems to be confusing and it might be good to have a more sensible default.

We can have users put their pulumi programs in a different directory as such and that might be better: com.example.springboot.Application com.example.pulumi.App

I still think it would be good to rename App.java since it's very common. 2022-04-16-213915_1283x931_scrot A standard that doesn't clash with existing classes would reduce the likelihood of renames and help lead to common pulumi-java idioms. i.e. PulumiStack.

Affected area/feature

pawelprazak commented 2 years ago

Good point, I've named them in my example infra for the module and Main for the class.

https://github.com/pulumi/pulumi-jvm/pull/354/files#diff-c47b1e4b3ee935b85e62b75fde3aff532346d2abeee8e2c4cf1d1b8d92527102R30 https://github.com/pulumi/pulumi-jvm/pull/354/files#diff-dc089204c4f471e36f5bb6b44281ce09266c7d20bb7e5ea1ff07543b3ad3e268R35

Using pulumi instead of infra in examples might be better for branding.

In examples that don't have multiple modules, I'd flatten the structure btw., co no app module, just flat (like in providers).

So simple example:

my-simple-example
    Pulumi.yaml
    gradle.build
    settings.gradle
    src

More complex example:

my-complex-example
  app
    ...my app things...
  pulumi
    ...my pulumi things...
  Pulumi.yaml

My real-world-complex example, monorepo:

my-real-world-complex-example
  identity-backend
    ...my identity microservice with Gradle build...
    infra
      ...my deployment for this service with Pulumi in Java
      Pulumi.yaml

  profile-backend
    ...my profile microservice  with Gradle build...
    infra
      ...my deployment for this service with Pulumi in Java
      Pulumi.yaml

  identity-frontend
    ...my identity frontend with NPM...
    infra
      ...my deployment for this service with Pulumi in Typescript
      Pulumi.yaml

  profile-frontend
    ...my profile frontend with NPM...
    infra
      ...my deployment for this service with Pulumi in Typescript
      Pulumi.yaml

  identity-db
    ...my database for identity backend with Pulumi...
    Pulumi.yaml

  profile-db
    ...my database for profile backend with Pulumi...
    Pulumi.yaml

  gke
    ...my k8s for this subsystem with Pulumi in Golang...
    Pulumi.yaml

Note that Pulumi.yaml needs to be moved deeper into the tree the more complex the use case is.