com.pulumi.gcp.projects.kotlin.DefaultServiceAccountsArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.projects.kotlin
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.projects.DefaultServiceAccountsArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName
/**
* Allows management of Google Cloud Platform project default service accounts.
* When certain service APIs are enabled, Google Cloud Platform automatically creates service accounts to help get started, but
* this is not recommended for production environments as per [Google's documentation](https://cloud.google.com/iam/docs/service-accounts#default).
* See the [Organization documentation](https://cloud.google.com/resource-manager/docs/quickstarts) for more details.
* > **WARNING** Some Google Cloud products do not work if the default service accounts are deleted so it is better to `DEPRIVILEGE` as
* Google **CAN NOT** recover service accounts that have been deleted for more than 30 days.
* Also Google recommends using the `constraints/iam.automaticIamGrantsForDefaultServiceAccounts` [constraint](https://www.terraform.io/docs/providers/google/r/google_organization_policy.html)
* to disable automatic IAM Grants to default service accounts.
* > This resource works on a best-effort basis, as no API formally describes the default service accounts
* and it is for users who are unable to use constraints. If the default service accounts change their name
* or additional service accounts are added, this resource will need to be updated.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const myProject = new gcp.projects.DefaultServiceAccounts("my_project", {
* project: "my-project-id",
* action: "DELETE",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* my_project = gcp.projects.DefaultServiceAccounts("my_project",
* project="my-project-id",
* action="DELETE")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var myProject = new Gcp.Projects.DefaultServiceAccounts("my_project", new()
* {
* Project = "my-project-id",
* Action = "DELETE",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := projects.NewDefaultServiceAccounts(ctx, "my_project", &projects.DefaultServiceAccountsArgs{
* Project: pulumi.String("my-project-id"),
* Action: pulumi.String("DELETE"),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.projects.DefaultServiceAccounts;
* import com.pulumi.gcp.projects.DefaultServiceAccountsArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var myProject = new DefaultServiceAccounts("myProject", DefaultServiceAccountsArgs.builder()
* .project("my-project-id")
* .action("DELETE")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* myProject:
* type: gcp:projects:DefaultServiceAccounts
* name: my_project
* properties:
* project: my-project-id
* action: DELETE
* ```
*
* To enable the default service accounts on the resource destroy:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const myProject = new gcp.projects.DefaultServiceAccounts("my_project", {
* project: "my-project-id",
* action: "DISABLE",
* restorePolicy: "REVERT",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* my_project = gcp.projects.DefaultServiceAccounts("my_project",
* project="my-project-id",
* action="DISABLE",
* restore_policy="REVERT")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var myProject = new Gcp.Projects.DefaultServiceAccounts("my_project", new()
* {
* Project = "my-project-id",
* Action = "DISABLE",
* RestorePolicy = "REVERT",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := projects.NewDefaultServiceAccounts(ctx, "my_project", &projects.DefaultServiceAccountsArgs{
* Project: pulumi.String("my-project-id"),
* Action: pulumi.String("DISABLE"),
* RestorePolicy: pulumi.String("REVERT"),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.projects.DefaultServiceAccounts;
* import com.pulumi.gcp.projects.DefaultServiceAccountsArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var myProject = new DefaultServiceAccounts("myProject", DefaultServiceAccountsArgs.builder()
* .project("my-project-id")
* .action("DISABLE")
* .restorePolicy("REVERT")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* myProject:
* type: gcp:projects:DefaultServiceAccounts
* name: my_project
* properties:
* project: my-project-id
* action: DISABLE
* restorePolicy: REVERT
* ```
*
* ## Import
* This resource does not support import
* @property action The action to be performed in the default service accounts. Valid values are: `DEPRIVILEGE`, `DELETE`, `DISABLE`. Note that `DEPRIVILEGE` action will ignore the REVERT configuration in the restore_policy
* @property project The project ID where service accounts are created.
* @property restorePolicy The action to be performed in the default service accounts on the resource destroy.
* Valid values are NONE, REVERT and REVERT_AND_IGNORE_FAILURE. It is applied for any action but in the DEPRIVILEGE.
* If set to REVERT it attempts to restore all default SAs but the DEPRIVILEGE action.
* If set to REVERT_AND_IGNORE_FAILURE it is the same behavior as REVERT but ignores errors returned by the API.
*/
public data class DefaultServiceAccountsArgs(
public val action: Output? = null,
public val project: Output? = null,
public val restorePolicy: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.gcp.projects.DefaultServiceAccountsArgs =
com.pulumi.gcp.projects.DefaultServiceAccountsArgs.builder()
.action(action?.applyValue({ args0 -> args0 }))
.project(project?.applyValue({ args0 -> args0 }))
.restorePolicy(restorePolicy?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [DefaultServiceAccountsArgs].
*/
@PulumiTagMarker
public class DefaultServiceAccountsArgsBuilder internal constructor() {
private var action: Output? = null
private var project: Output? = null
private var restorePolicy: Output? = null
/**
* @param value The action to be performed in the default service accounts. Valid values are: `DEPRIVILEGE`, `DELETE`, `DISABLE`. Note that `DEPRIVILEGE` action will ignore the REVERT configuration in the restore_policy
*/
@JvmName("lfgcwpelguxhiwby")
public suspend fun action(`value`: Output) {
this.action = value
}
/**
* @param value The project ID where service accounts are created.
*/
@JvmName("agtmhcpyqedduvjt")
public suspend fun project(`value`: Output) {
this.project = value
}
/**
* @param value The action to be performed in the default service accounts on the resource destroy.
* Valid values are NONE, REVERT and REVERT_AND_IGNORE_FAILURE. It is applied for any action but in the DEPRIVILEGE.
* If set to REVERT it attempts to restore all default SAs but the DEPRIVILEGE action.
* If set to REVERT_AND_IGNORE_FAILURE it is the same behavior as REVERT but ignores errors returned by the API.
*/
@JvmName("vhttdltiuebtvxip")
public suspend fun restorePolicy(`value`: Output) {
this.restorePolicy = value
}
/**
* @param value The action to be performed in the default service accounts. Valid values are: `DEPRIVILEGE`, `DELETE`, `DISABLE`. Note that `DEPRIVILEGE` action will ignore the REVERT configuration in the restore_policy
*/
@JvmName("uixuhcapxrksdqhp")
public suspend fun action(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.action = mapped
}
/**
* @param value The project ID where service accounts are created.
*/
@JvmName("dfylyhdugelyussr")
public suspend fun project(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.project = mapped
}
/**
* @param value The action to be performed in the default service accounts on the resource destroy.
* Valid values are NONE, REVERT and REVERT_AND_IGNORE_FAILURE. It is applied for any action but in the DEPRIVILEGE.
* If set to REVERT it attempts to restore all default SAs but the DEPRIVILEGE action.
* If set to REVERT_AND_IGNORE_FAILURE it is the same behavior as REVERT but ignores errors returned by the API.
*/
@JvmName("nnavplpwnsqkdljq")
public suspend fun restorePolicy(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.restorePolicy = mapped
}
internal fun build(): DefaultServiceAccountsArgs = DefaultServiceAccountsArgs(
action = action,
project = project,
restorePolicy = restorePolicy,
)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy