com.pulumi.aws.ssm.kotlin.Activation.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-aws-kotlin Show documentation
Show all versions of pulumi-aws-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.aws.ssm.kotlin
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
/**
* Builder for [Activation].
*/
@PulumiTagMarker
public class ActivationResourceBuilder internal constructor() {
public var name: String? = null
public var args: ActivationArgs = ActivationArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend ActivationArgsBuilder.() -> Unit) {
val builder = ActivationArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): Activation {
val builtJavaResource = com.pulumi.aws.ssm.Activation(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Activation(builtJavaResource)
}
}
/**
* Registers an on-premises server or virtual machine with Amazon EC2 so that it can be managed using Run Command.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const assumeRole = aws.iam.getPolicyDocument({
* statements: [{
* effect: "Allow",
* principals: [{
* type: "Service",
* identifiers: ["ssm.amazonaws.com"],
* }],
* actions: ["sts:AssumeRole"],
* }],
* });
* const testRole = new aws.iam.Role("test_role", {
* name: "test_role",
* assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json),
* });
* const testAttach = new aws.iam.RolePolicyAttachment("test_attach", {
* role: testRole.name,
* policyArn: "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore",
* });
* const foo = new aws.ssm.Activation("foo", {
* name: "test_ssm_activation",
* description: "Test",
* iamRole: testRole.id,
* registrationLimit: 5,
* }, {
* dependsOn: [testAttach],
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* assume_role = aws.iam.get_policy_document(statements=[{
* "effect": "Allow",
* "principals": [{
* "type": "Service",
* "identifiers": ["ssm.amazonaws.com"],
* }],
* "actions": ["sts:AssumeRole"],
* }])
* test_role = aws.iam.Role("test_role",
* name="test_role",
* assume_role_policy=assume_role.json)
* test_attach = aws.iam.RolePolicyAttachment("test_attach",
* role=test_role.name,
* policy_arn="arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore")
* foo = aws.ssm.Activation("foo",
* name="test_ssm_activation",
* description="Test",
* iam_role=test_role.id,
* registration_limit=5,
* opts = pulumi.ResourceOptions(depends_on=[test_attach]))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var assumeRole = Aws.Iam.GetPolicyDocument.Invoke(new()
* {
* Statements = new[]
* {
* new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
* {
* Effect = "Allow",
* Principals = new[]
* {
* new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
* {
* Type = "Service",
* Identifiers = new[]
* {
* "ssm.amazonaws.com",
* },
* },
* },
* Actions = new[]
* {
* "sts:AssumeRole",
* },
* },
* },
* });
* var testRole = new Aws.Iam.Role("test_role", new()
* {
* Name = "test_role",
* AssumeRolePolicy = assumeRole.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
* });
* var testAttach = new Aws.Iam.RolePolicyAttachment("test_attach", new()
* {
* Role = testRole.Name,
* PolicyArn = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore",
* });
* var foo = new Aws.Ssm.Activation("foo", new()
* {
* Name = "test_ssm_activation",
* Description = "Test",
* IamRole = testRole.Id,
* RegistrationLimit = 5,
* }, new CustomResourceOptions
* {
* DependsOn =
* {
* testAttach,
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssm"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
* Statements: []iam.GetPolicyDocumentStatement{
* {
* Effect: pulumi.StringRef("Allow"),
* Principals: []iam.GetPolicyDocumentStatementPrincipal{
* {
* Type: "Service",
* Identifiers: []string{
* "ssm.amazonaws.com",
* },
* },
* },
* Actions: []string{
* "sts:AssumeRole",
* },
* },
* },
* }, nil)
* if err != nil {
* return err
* }
* testRole, err := iam.NewRole(ctx, "test_role", &iam.RoleArgs{
* Name: pulumi.String("test_role"),
* AssumeRolePolicy: pulumi.String(assumeRole.Json),
* })
* if err != nil {
* return err
* }
* testAttach, err := iam.NewRolePolicyAttachment(ctx, "test_attach", &iam.RolePolicyAttachmentArgs{
* Role: testRole.Name,
* PolicyArn: pulumi.String("arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"),
* })
* if err != nil {
* return err
* }
* _, err = ssm.NewActivation(ctx, "foo", &ssm.ActivationArgs{
* Name: pulumi.String("test_ssm_activation"),
* Description: pulumi.String("Test"),
* IamRole: testRole.ID(),
* RegistrationLimit: pulumi.Int(5),
* }, pulumi.DependsOn([]pulumi.Resource{
* testAttach,
* }))
* 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.aws.iam.IamFunctions;
* import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
* import com.pulumi.aws.iam.Role;
* import com.pulumi.aws.iam.RoleArgs;
* import com.pulumi.aws.iam.RolePolicyAttachment;
* import com.pulumi.aws.iam.RolePolicyAttachmentArgs;
* import com.pulumi.aws.ssm.Activation;
* import com.pulumi.aws.ssm.ActivationArgs;
* import com.pulumi.resources.CustomResourceOptions;
* 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) {
* final var assumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
* .statements(GetPolicyDocumentStatementArgs.builder()
* .effect("Allow")
* .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
* .type("Service")
* .identifiers("ssm.amazonaws.com")
* .build())
* .actions("sts:AssumeRole")
* .build())
* .build());
* var testRole = new Role("testRole", RoleArgs.builder()
* .name("test_role")
* .assumeRolePolicy(assumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
* .build());
* var testAttach = new RolePolicyAttachment("testAttach", RolePolicyAttachmentArgs.builder()
* .role(testRole.name())
* .policyArn("arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore")
* .build());
* var foo = new Activation("foo", ActivationArgs.builder()
* .name("test_ssm_activation")
* .description("Test")
* .iamRole(testRole.id())
* .registrationLimit("5")
* .build(), CustomResourceOptions.builder()
* .dependsOn(testAttach)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* testRole:
* type: aws:iam:Role
* name: test_role
* properties:
* name: test_role
* assumeRolePolicy: ${assumeRole.json}
* testAttach:
* type: aws:iam:RolePolicyAttachment
* name: test_attach
* properties:
* role: ${testRole.name}
* policyArn: arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore
* foo:
* type: aws:ssm:Activation
* properties:
* name: test_ssm_activation
* description: Test
* iamRole: ${testRole.id}
* registrationLimit: '5'
* options:
* dependson:
* - ${testAttach}
* variables:
* assumeRole:
* fn::invoke:
* Function: aws:iam:getPolicyDocument
* Arguments:
* statements:
* - effect: Allow
* principals:
* - type: Service
* identifiers:
* - ssm.amazonaws.com
* actions:
* - sts:AssumeRole
* ```
*
* ## Import
* Using `pulumi import`, import AWS SSM Activation using the `id`. For example:
* ```sh
* $ pulumi import aws:ssm/activation:Activation example e488f2f6-e686-4afb-8a04-ef6dfEXAMPLE
* ```
* -> __Note:__ The `activation_code` attribute cannot be imported.
*/
public class Activation internal constructor(
override val javaResource: com.pulumi.aws.ssm.Activation,
) : KotlinCustomResource(javaResource, ActivationMapper) {
/**
* The code the system generates when it processes the activation.
*/
public val activationCode: Output
get() = javaResource.activationCode().applyValue({ args0 -> args0 })
/**
* The description of the resource that you want to register.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* UTC timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
*/
public val expirationDate: Output
get() = javaResource.expirationDate().applyValue({ args0 -> args0 })
/**
* If the current activation has expired.
*/
public val expired: Output
get() = javaResource.expired().applyValue({ args0 -> args0 })
/**
* The IAM Role to attach to the managed instance.
*/
public val iamRole: Output
get() = javaResource.iamRole().applyValue({ args0 -> args0 })
/**
* The default name of the registered managed instance.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The number of managed instances that are currently registered using this activation.
*/
public val registrationCount: Output
get() = javaResource.registrationCount().applyValue({ args0 -> args0 })
/**
* The maximum number of managed instances you want to register. The default value is 1 instance.
*/
public val registrationLimit: Output?
get() = javaResource.registrationLimit().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* A map of tags to assign to the object. .If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
*/
public val tags: Output