ContainerGroupArgs

data class ContainerGroupArgs(val acrRegistryInfos: Output<List<ContainerGroupAcrRegistryInfoArgs>>? = null, val autoCreateEip: Output<Boolean>? = null, val autoMatchImageCache: Output<Boolean>? = null, val containerGroupName: Output<String>? = null, val containers: Output<List<ContainerGroupContainerArgs>>? = null, val cpu: Output<Double>? = null, val dnsConfig: Output<ContainerGroupDnsConfigArgs>? = null, val eciSecurityContext: Output<ContainerGroupEciSecurityContextArgs>? = null, val eipBandwidth: Output<Int>? = null, val eipInstanceId: Output<String>? = null, val hostAliases: Output<List<ContainerGroupHostAliasArgs>>? = null, val imageRegistryCredentials: Output<List<ContainerGroupImageRegistryCredentialArgs>>? = null, val initContainers: Output<List<ContainerGroupInitContainerArgs>>? = null, val insecureRegistry: Output<String>? = null, val instanceType: Output<String>? = null, val memory: Output<Double>? = null, val plainHttpRegistry: Output<String>? = null, val ramRoleName: Output<String>? = null, val resourceGroupId: Output<String>? = null, val restartPolicy: Output<String>? = null, val securityGroupId: Output<String>? = null, val tags: Output<Map<String, Any>>? = null, val volumes: Output<List<ContainerGroupVolumeArgs>>? = null, val vswitchId: Output<String>? = null, val zoneId: Output<String>? = null) : ConvertibleToJava<ContainerGroupArgs>

Provides ECI Container Group resource. For information about ECI Container Group and how to use it, see What is Container Group.

NOTE: Available since v1.111.0.

Example Usage

Basic Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.eci.EciFunctions;
import com.pulumi.alicloud.eci.inputs.GetZonesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.ecs.SecurityGroup;
import com.pulumi.alicloud.ecs.SecurityGroupArgs;
import com.pulumi.alicloud.eci.ContainerGroup;
import com.pulumi.alicloud.eci.ContainerGroupArgs;
import com.pulumi.alicloud.eci.inputs.ContainerGroupContainerArgs;
import com.pulumi.alicloud.eci.inputs.ContainerGroupInitContainerArgs;
import com.pulumi.alicloud.eci.inputs.ContainerGroupVolumeArgs;
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 config = ctx.config();
final var name = config.get("name").orElse("tf-example");
final var defaultZones = EciFunctions.getZones();
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("10.0.0.0/8")
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vswitchName(name)
.cidrBlock("10.1.0.0/16")
.vpcId(defaultNetwork.id())
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].zoneIds()[0]))
.build());
var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder()
.vpcId(defaultNetwork.id())
.build());
var defaultContainerGroup = new ContainerGroup("defaultContainerGroup", ContainerGroupArgs.builder()
.containerGroupName(name)
.cpu(8)
.memory(16)
.restartPolicy("OnFailure")
.securityGroupId(defaultSecurityGroup.id())
.vswitchId(defaultSwitch.id())
.tags(Map.ofEntries(
Map.entry("Created", "TF"),
Map.entry("For", "example")
))
.containers(
ContainerGroupContainerArgs.builder()
.image("registry-vpc.cn-beijing.aliyuncs.com/eci_open/nginx:alpine")
.name("nginx")
.workingDir("/tmp/nginx")
.imagePullPolicy("IfNotPresent")
.commands(
"/bin/sh",
"-c",
"sleep 9999")
.volumeMounts(ContainerGroupContainerVolumeMountArgs.builder()
.mountPath("/tmp/example")
.readOnly(false)
.name("empty1")
.build())
.ports(ContainerGroupContainerPortArgs.builder()
.port(80)
.protocol("TCP")
.build())
.environmentVars(ContainerGroupContainerEnvironmentVarArgs.builder()
.key("name")
.value("nginx")
.build())
.livenessProbes(ContainerGroupContainerLivenessProbeArgs.builder()
.periodSeconds("5")
.initialDelaySeconds("5")
.successThreshold("1")
.failureThreshold("3")
.timeoutSeconds("1")
.execs(ContainerGroupContainerLivenessProbeExecArgs.builder()
.commands("cat /tmp/healthy")
.build())
.build())
.readinessProbes(ContainerGroupContainerReadinessProbeArgs.builder()
.periodSeconds("5")
.initialDelaySeconds("5")
.successThreshold("1")
.failureThreshold("3")
.timeoutSeconds("1")
.execs(ContainerGroupContainerReadinessProbeExecArgs.builder()
.commands("cat /tmp/healthy")
.build())
.build())
.build(),
ContainerGroupContainerArgs.builder()
.image("registry-vpc.cn-beijing.aliyuncs.com/eci_open/centos:7")
.name("centos")
.commands(
"/bin/sh",
"-c",
"sleep 9999")
.build())
.initContainers(ContainerGroupInitContainerArgs.builder()
.name("init-busybox")
.image("registry-vpc.cn-beijing.aliyuncs.com/eci_open/busybox:1.30")
.imagePullPolicy("IfNotPresent")
.commands("echo")
.args("hello initcontainer")
.build())
.volumes(
ContainerGroupVolumeArgs.builder()
.name("empty1")
.type("EmptyDirVolume")
.build(),
ContainerGroupVolumeArgs.builder()
.name("empty2")
.type("EmptyDirVolume")
.build())
.build());
}
}

Import

ECI Container Group can be imported using the id, e.g.

$ pulumi import alicloud:eci/containerGroup:ContainerGroup example <container_group_id>

Constructors

Link copied to clipboard
fun ContainerGroupArgs(acrRegistryInfos: Output<List<ContainerGroupAcrRegistryInfoArgs>>? = null, autoCreateEip: Output<Boolean>? = null, autoMatchImageCache: Output<Boolean>? = null, containerGroupName: Output<String>? = null, containers: Output<List<ContainerGroupContainerArgs>>? = null, cpu: Output<Double>? = null, dnsConfig: Output<ContainerGroupDnsConfigArgs>? = null, eciSecurityContext: Output<ContainerGroupEciSecurityContextArgs>? = null, eipBandwidth: Output<Int>? = null, eipInstanceId: Output<String>? = null, hostAliases: Output<List<ContainerGroupHostAliasArgs>>? = null, imageRegistryCredentials: Output<List<ContainerGroupImageRegistryCredentialArgs>>? = null, initContainers: Output<List<ContainerGroupInitContainerArgs>>? = null, insecureRegistry: Output<String>? = null, instanceType: Output<String>? = null, memory: Output<Double>? = null, plainHttpRegistry: Output<String>? = null, ramRoleName: Output<String>? = null, resourceGroupId: Output<String>? = null, restartPolicy: Output<String>? = null, securityGroupId: Output<String>? = null, tags: Output<Map<String, Any>>? = null, volumes: Output<List<ContainerGroupVolumeArgs>>? = null, vswitchId: Output<String>? = null, zoneId: Output<String>? = null)

Functions

Link copied to clipboard
open override fun toJava(): ContainerGroupArgs

Properties

Link copied to clipboard

The ACR enterprise edition example properties. See acr_registry_info below.

Link copied to clipboard
val autoCreateEip: Output<Boolean>? = null

Specifies whether to automatically create an EIP and bind the EIP to the elastic container instance.

Link copied to clipboard
val autoMatchImageCache: Output<Boolean>? = null

Specifies whether to automatically match the image cache. Default value: false. Valid values: true and false.

Link copied to clipboard
val containerGroupName: Output<String>? = null

The name of the container group.

Link copied to clipboard

The list of containers. See containers below.

Link copied to clipboard
val cpu: Output<Double>? = null

The amount of CPU resources allocated to the container group.

Link copied to clipboard

The structure of dnsConfig. See dns_config below.

Link copied to clipboard

The security context of the container group. See eci_security_context below.

Link copied to clipboard
val eipBandwidth: Output<Int>? = null

The bandwidth of the EIP. Default value: 5.

Link copied to clipboard
val eipInstanceId: Output<String>? = null

The ID of the elastic IP address (EIP).

Link copied to clipboard

HostAliases. See host_aliases below.

Link copied to clipboard

The image registry credential. See image_registry_credential below.

Link copied to clipboard

The list of initContainers. See init_containers below.

Link copied to clipboard
val insecureRegistry: Output<String>? = null

The address of the self-built mirror warehouse. When creating an image cache using an image in a self-built image repository with a self-signed certificate, you need to configure this parameter to skip certificate authentication to avoid image pull failure due to certificate authentication failure.

Link copied to clipboard
val instanceType: Output<String>? = null

The type of the ECS instance.

Link copied to clipboard
val memory: Output<Double>? = null

The amount of memory resources allocated to the container group.

Link copied to clipboard
val plainHttpRegistry: Output<String>? = null

The address of the self-built mirror warehouse. When creating an image cache from an image in a self-built image repository using the HTTP protocol, you need to configure this parameter so that the ECI uses the HTTP protocol to pull the image to avoid image pull failure due to different protocols.

Link copied to clipboard
val ramRoleName: Output<String>? = null

The RAM role that the container group assumes. ECI and ECS share the same RAM role.

Link copied to clipboard
val resourceGroupId: Output<String>? = null

The ID of the resource group. NOTE: From version 1.208.0, resource_group_id can be modified.

Link copied to clipboard
val restartPolicy: Output<String>? = null

The restart policy of the container group. Valid values: Always, Never, OnFailure.

Link copied to clipboard
val securityGroupId: Output<String>? = null

The ID of the security group to which the container group belongs. Container groups within the same security group can access each other.

Link copied to clipboard
val tags: Output<Map<String, Any>>? = null

A mapping of tags to assign to the resource.

Link copied to clipboard
val volumes: Output<List<ContainerGroupVolumeArgs>>? = null

The list of volumes. See volumes below.

Link copied to clipboard
val vswitchId: Output<String>? = null

The ID of the VSwitch. Currently, container groups can only be deployed in VPC networks. The number of IP addresses in the VSwitch CIDR block determines the maximum number of container groups that can be created in the VSwitch. Before you can create an ECI instance, plan the CIDR block of the VSwitch. NOTE: From version 1.208.0, You can specify up to 10 vswitch_id. Separate multiple vSwitch IDs with commas (,), such as vsw-,vsw-. attribute vswitch_id updating diff will be ignored when you set multiple vSwitchIds, there is only one valid vswitch_id exists in the set vSwitchIds.

Link copied to clipboard
val zoneId: Output<String>? = null

The ID of the zone where you want to deploy the container group. If no value is specified, the system assigns a zone to the container group. By default, no value is specified.