Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/scala/org/podval/tools/besom/Bucket.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class Bucket(
val bucket: Output[BucketGCP] = BucketGCP(name, BucketArgs(
project = project.project.projectId,
// Pulumi name and GCS name are this same string. state.$domain has no type prefix.
name = name, // TODO do I need this?
name = name,
storageClass = storageClass,
location = location,
// Independent of isPublic. Public reads are the BucketIam binding.
Expand Down
7 changes: 5 additions & 2 deletions src/main/scala/org/podval/tools/besom/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import besom.{Config, Context, Output, Pulumi, Stack}

abstract class Main(
domain: String,
infraProjectId: String, // TODO gcp.provider.project.map(_.get)
// Stays a String. All three stacks pass the same id as gcp:project. The grok-bot key
// name uses it outside any flatMap so preview shows the key.
infraProjectId: String,
infraProjectName: String,
stateBucketLocation: String,
cloudFlareAccountId: String,
Expand Down Expand Up @@ -124,7 +126,8 @@ abstract class Main(
gcp: Gcp
): Seq[Group]

// Stays Seq[WithResources]. AlterRebbe appends its raw Output inside its own resources.
// Stays Seq[WithResources] because AlterRebbe is a WithResources returning ProjectIam[ServiceAgent].
// A ComponentResource parent would change every child URN.
def resources(infraProject: Project)(using
ctx: Context,
gcp: Gcp
Expand Down
7 changes: 1 addition & 6 deletions src/main/scala/org/podval/tools/besom/Principal.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ sealed trait Principal[A]:
def principalResourceName: Output[String]
def principalMember: Output[String] = principalResourceName

// TODO add all allowed Principal kinds
object Principal:
// A special identifier that represents anyone who is on the internet; with or without a Google account.
object AllUsers
Expand Down Expand Up @@ -50,8 +49,4 @@ object Principal:
extension (agent: Output[ServiceAgent])(using ctx: Context)
override def principalResourceName: Output[String] = agent.map(_.resourceName)

// TODO
//domain:{domain}: A G Suite domain (primary, instead of alias) name that represents all the users of that domain. For example, google.com or example.com.
//projectOwner:projectid: Owners of the given project. For example, "projectOwner:my-example-project"
//projectEditor:projectid: Editors of the given project. For example, "projectEditor:my-example-project"
//projectViewer:projectid: Viewers of the given project. For example, "projectViewer:my-example-project"
// No stack uses domain:, projectOwner:, projectEditor:, or projectViewer:.
2 changes: 1 addition & 1 deletion src/main/scala/org/podval/tools/besom/Project.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final class Project(
services: Seq[String],
labels: Map[String, String] = Map.empty,
// Games and Firebase pass false by name. The default stays true.
autoCreateNetwork: Boolean = true // TODO do I need the default network?
autoCreateNetwork: Boolean = true
)(using ctx: Context, gcp: Gcp) extends WithResources:
// Public. AlterRebbe reads projectId and number.
val project: Output[ProjectGCP] = ProjectGCP(name = Names.projectPulumiName(id), ProjectArgs(
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/org/podval/tools/besom/ServiceAgent.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package org.podval.tools.besom

// Google-managed service agent, service-<projectNumber>@gcp-sa-<service>.iam.gserviceaccount.com.
// Not a user-created Account, and not a compute-system agent (that email is a different shape).
// resourceName and member are the same string, including .iam.gserviceaccount.com, so ProjectIam's
// logical name project:$projectId/$member/role:$role matches AlterRebbe's direct IamMember.
// The .iam.gserviceaccount.com suffix stays in both resourceName and member, matching the URN
// ProjectIam builds for AlterRebbe: project:$projectId/$member/role:$role.
// Pass the role unprefixed (storage.objectViewer). ProjectIam prepends roles/.
final case class ServiceAgent(projectNumber: String, service: String):
def member: String = Names.serviceAgentMember(projectNumber, service)
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/org/podval/tools/besom/User.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import besom.Output

final class User(val name: String, val domain: String):
def email: String = Names.userEmail(name, domain)
def resourceName: String = Names.userResourceName(name, domain) // TODO unfold
def resourceName: String = Names.userResourceName(name, domain)

object User:
// No caller. Stays: a Gmail principal is still a User, just not one any stack builds.
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/org/podval/tools/besom/WithResources.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.podval.tools.besom
import besom.Output

// Stack forces every Output in this Seq, including a resource built inside flatMap.
// The type stays Seq[Output[?]] because AlterRebbe appends a raw Output.
// The type stays Seq[Output[?]] because one component mixes resource types and Output is invariant.
// A ComponentResource parent would change every child URN.
trait WithResources:
def resources: Seq[Output[?]]
Expand Down
Loading