alicloud.governance.Baseline
Explore with Pulumi AI
Provides a Governance Baseline resource.
Account Factory Baseline.
For information about Governance Baseline and how to use it, see What is Baseline.
NOTE: Available since v1.228.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const _default = new random.index.Integer("default", {
min: 10000,
max: 99999,
});
const itemPasswordPolicy = config.get("itemPasswordPolicy") || "ACS-BP_ACCOUNT_FACTORY_RAM_USER_PASSWORD_POLICY";
const baselineNameUpdate = config.get("baselineNameUpdate") || "tf-auto-example-baseline-update";
const itemServices = config.get("itemServices") || "ACS-BP_ACCOUNT_FACTORY_SUBSCRIBE_SERVICES";
const baselineName = config.get("baselineName") || "tf-auto-example-baseline";
const itemRamSecurity = config.get("itemRamSecurity") || "ACS-BP_ACCOUNT_FACTORY_RAM_SECURITY_PREFERENCE";
const defaultBaseline = new alicloud.governance.Baseline("default", {
baselineItems: [{
version: "1.0",
name: itemPasswordPolicy,
config: JSON.stringify({
MinimumPasswordLength: 8,
RequireLowercaseCharacters: true,
RequireUppercaseCharacters: true,
RequireNumbers: true,
RequireSymbols: true,
MaxPasswordAge: 0,
HardExpiry: false,
PasswordReusePrevention: 0,
MaxLoginAttempts: 0,
}),
}],
description: name,
baselineName: `${name}-${_default.result}`,
});
import pulumi
import json
import pulumi_alicloud as alicloud
import pulumi_random as random
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default = random.index.Integer("default",
min=10000,
max=99999)
item_password_policy = config.get("itemPasswordPolicy")
if item_password_policy is None:
item_password_policy = "ACS-BP_ACCOUNT_FACTORY_RAM_USER_PASSWORD_POLICY"
baseline_name_update = config.get("baselineNameUpdate")
if baseline_name_update is None:
baseline_name_update = "tf-auto-example-baseline-update"
item_services = config.get("itemServices")
if item_services is None:
item_services = "ACS-BP_ACCOUNT_FACTORY_SUBSCRIBE_SERVICES"
baseline_name = config.get("baselineName")
if baseline_name is None:
baseline_name = "tf-auto-example-baseline"
item_ram_security = config.get("itemRamSecurity")
if item_ram_security is None:
item_ram_security = "ACS-BP_ACCOUNT_FACTORY_RAM_SECURITY_PREFERENCE"
default_baseline = alicloud.governance.Baseline("default",
baseline_items=[{
"version": "1.0",
"name": item_password_policy,
"config": json.dumps({
"MinimumPasswordLength": 8,
"RequireLowercaseCharacters": True,
"RequireUppercaseCharacters": True,
"RequireNumbers": True,
"RequireSymbols": True,
"MaxPasswordAge": 0,
"HardExpiry": False,
"PasswordReusePrevention": 0,
"MaxLoginAttempts": 0,
}),
}],
description=name,
baseline_name=f"{name}-{default['result']}")
package main
import (
"encoding/json"
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/governance"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
Min: 10000,
Max: 99999,
})
if err != nil {
return err
}
itemPasswordPolicy := "ACS-BP_ACCOUNT_FACTORY_RAM_USER_PASSWORD_POLICY"
if param := cfg.Get("itemPasswordPolicy"); param != "" {
itemPasswordPolicy = param
}
baselineNameUpdate := "tf-auto-example-baseline-update"
if param := cfg.Get("baselineNameUpdate"); param != "" {
baselineNameUpdate = param
}
itemServices := "ACS-BP_ACCOUNT_FACTORY_SUBSCRIBE_SERVICES"
if param := cfg.Get("itemServices"); param != "" {
itemServices = param
}
baselineName := "tf-auto-example-baseline"
if param := cfg.Get("baselineName"); param != "" {
baselineName = param
}
itemRamSecurity := "ACS-BP_ACCOUNT_FACTORY_RAM_SECURITY_PREFERENCE"
if param := cfg.Get("itemRamSecurity"); param != "" {
itemRamSecurity = param
}
tmpJSON0, err := json.Marshal(map[string]interface{}{
"MinimumPasswordLength": 8,
"RequireLowercaseCharacters": true,
"RequireUppercaseCharacters": true,
"RequireNumbers": true,
"RequireSymbols": true,
"MaxPasswordAge": 0,
"HardExpiry": false,
"PasswordReusePrevention": 0,
"MaxLoginAttempts": 0,
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = governance.NewBaseline(ctx, "default", &governance.BaselineArgs{
BaselineItems: governance.BaselineBaselineItemArray{
&governance.BaselineBaselineItemArgs{
Version: pulumi.String("1.0"),
Name: pulumi.String(itemPasswordPolicy),
Config: pulumi.String(json0),
},
},
Description: pulumi.String(name),
BaselineName: pulumi.Sprintf("%v-%v", name, _default.Result),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var @default = new Random.Index.Integer("default", new()
{
Min = 10000,
Max = 99999,
});
var itemPasswordPolicy = config.Get("itemPasswordPolicy") ?? "ACS-BP_ACCOUNT_FACTORY_RAM_USER_PASSWORD_POLICY";
var baselineNameUpdate = config.Get("baselineNameUpdate") ?? "tf-auto-example-baseline-update";
var itemServices = config.Get("itemServices") ?? "ACS-BP_ACCOUNT_FACTORY_SUBSCRIBE_SERVICES";
var baselineName = config.Get("baselineName") ?? "tf-auto-example-baseline";
var itemRamSecurity = config.Get("itemRamSecurity") ?? "ACS-BP_ACCOUNT_FACTORY_RAM_SECURITY_PREFERENCE";
var defaultBaseline = new AliCloud.Governance.Baseline("default", new()
{
BaselineItems = new[]
{
new AliCloud.Governance.Inputs.BaselineBaselineItemArgs
{
Version = "1.0",
Name = itemPasswordPolicy,
Config = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["MinimumPasswordLength"] = 8,
["RequireLowercaseCharacters"] = true,
["RequireUppercaseCharacters"] = true,
["RequireNumbers"] = true,
["RequireSymbols"] = true,
["MaxPasswordAge"] = 0,
["HardExpiry"] = false,
["PasswordReusePrevention"] = 0,
["MaxLoginAttempts"] = 0,
}),
},
},
Description = name,
BaselineName = $"{name}-{@default.Result}",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.integer;
import com.pulumi.random.IntegerArgs;
import com.pulumi.alicloud.governance.Baseline;
import com.pulumi.alicloud.governance.BaselineArgs;
import com.pulumi.alicloud.governance.inputs.BaselineBaselineItemArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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("terraform-example");
var default_ = new Integer("default", IntegerArgs.builder()
.min(10000)
.max(99999)
.build());
final var itemPasswordPolicy = config.get("itemPasswordPolicy").orElse("ACS-BP_ACCOUNT_FACTORY_RAM_USER_PASSWORD_POLICY");
final var baselineNameUpdate = config.get("baselineNameUpdate").orElse("tf-auto-example-baseline-update");
final var itemServices = config.get("itemServices").orElse("ACS-BP_ACCOUNT_FACTORY_SUBSCRIBE_SERVICES");
final var baselineName = config.get("baselineName").orElse("tf-auto-example-baseline");
final var itemRamSecurity = config.get("itemRamSecurity").orElse("ACS-BP_ACCOUNT_FACTORY_RAM_SECURITY_PREFERENCE");
var defaultBaseline = new Baseline("defaultBaseline", BaselineArgs.builder()
.baselineItems(BaselineBaselineItemArgs.builder()
.version("1.0")
.name(itemPasswordPolicy)
.config(serializeJson(
jsonObject(
jsonProperty("MinimumPasswordLength", 8),
jsonProperty("RequireLowercaseCharacters", true),
jsonProperty("RequireUppercaseCharacters", true),
jsonProperty("RequireNumbers", true),
jsonProperty("RequireSymbols", true),
jsonProperty("MaxPasswordAge", 0),
jsonProperty("HardExpiry", false),
jsonProperty("PasswordReusePrevention", 0),
jsonProperty("MaxLoginAttempts", 0)
)))
.build())
.description(name)
.baselineName(String.format("%s-%s", name,default_.result()))
.build());
}
}
configuration:
name:
type: string
default: terraform-example
itemPasswordPolicy:
type: string
default: ACS-BP_ACCOUNT_FACTORY_RAM_USER_PASSWORD_POLICY
baselineNameUpdate:
type: string
default: tf-auto-example-baseline-update
itemServices:
type: string
default: ACS-BP_ACCOUNT_FACTORY_SUBSCRIBE_SERVICES
baselineName:
type: string
default: tf-auto-example-baseline
itemRamSecurity:
type: string
default: ACS-BP_ACCOUNT_FACTORY_RAM_SECURITY_PREFERENCE
resources:
default:
type: random:integer
properties:
min: 10000
max: 99999
defaultBaseline:
type: alicloud:governance:Baseline
name: default
properties:
baselineItems:
- version: '1.0'
name: ${itemPasswordPolicy}
config:
fn::toJSON:
MinimumPasswordLength: 8
RequireLowercaseCharacters: true
RequireUppercaseCharacters: true
RequireNumbers: true
RequireSymbols: true
MaxPasswordAge: 0
HardExpiry: false
PasswordReusePrevention: 0
MaxLoginAttempts: 0
description: ${name}
baselineName: ${name}-${default.result}
Create Baseline Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Baseline(name: string, args?: BaselineArgs, opts?: CustomResourceOptions);
@overload
def Baseline(resource_name: str,
args: Optional[BaselineArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def Baseline(resource_name: str,
opts: Optional[ResourceOptions] = None,
baseline_items: Optional[Sequence[BaselineBaselineItemArgs]] = None,
baseline_name: Optional[str] = None,
description: Optional[str] = None)
func NewBaseline(ctx *Context, name string, args *BaselineArgs, opts ...ResourceOption) (*Baseline, error)
public Baseline(string name, BaselineArgs? args = null, CustomResourceOptions? opts = null)
public Baseline(String name, BaselineArgs args)
public Baseline(String name, BaselineArgs args, CustomResourceOptions options)
type: alicloud:governance:Baseline
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args BaselineArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args BaselineArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args BaselineArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args BaselineArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args BaselineArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var baselineResource = new AliCloud.Governance.Baseline("baselineResource", new()
{
BaselineItems = new[]
{
new AliCloud.Governance.Inputs.BaselineBaselineItemArgs
{
Config = "string",
Name = "string",
Version = "string",
},
},
BaselineName = "string",
Description = "string",
});
example, err := governance.NewBaseline(ctx, "baselineResource", &governance.BaselineArgs{
BaselineItems: governance.BaselineBaselineItemArray{
&governance.BaselineBaselineItemArgs{
Config: pulumi.String("string"),
Name: pulumi.String("string"),
Version: pulumi.String("string"),
},
},
BaselineName: pulumi.String("string"),
Description: pulumi.String("string"),
})
var baselineResource = new Baseline("baselineResource", BaselineArgs.builder()
.baselineItems(BaselineBaselineItemArgs.builder()
.config("string")
.name("string")
.version("string")
.build())
.baselineName("string")
.description("string")
.build());
baseline_resource = alicloud.governance.Baseline("baselineResource",
baseline_items=[{
"config": "string",
"name": "string",
"version": "string",
}],
baseline_name="string",
description="string")
const baselineResource = new alicloud.governance.Baseline("baselineResource", {
baselineItems: [{
config: "string",
name: "string",
version: "string",
}],
baselineName: "string",
description: "string",
});
type: alicloud:governance:Baseline
properties:
baselineItems:
- config: string
name: string
version: string
baselineName: string
description: string
Baseline Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Baseline resource accepts the following input properties:
- Baseline
Items List<Pulumi.Ali Cloud. Governance. Inputs. Baseline Baseline Item> List of baseline items.
You can invoke ListAccountFactoryBaselineItems to get a list of account factory baseline items supported by the Cloud Governance Center. See
baseline_items
below.- Baseline
Name string - Baseline Name.
- Description string
- Baseline Description.
- Baseline
Items []BaselineBaseline Item Args List of baseline items.
You can invoke ListAccountFactoryBaselineItems to get a list of account factory baseline items supported by the Cloud Governance Center. See
baseline_items
below.- Baseline
Name string - Baseline Name.
- Description string
- Baseline Description.
- baseline
Items List<BaselineBaseline Item> List of baseline items.
You can invoke ListAccountFactoryBaselineItems to get a list of account factory baseline items supported by the Cloud Governance Center. See
baseline_items
below.- baseline
Name String - Baseline Name.
- description String
- Baseline Description.
- baseline
Items BaselineBaseline Item[] List of baseline items.
You can invoke ListAccountFactoryBaselineItems to get a list of account factory baseline items supported by the Cloud Governance Center. See
baseline_items
below.- baseline
Name string - Baseline Name.
- description string
- Baseline Description.
- baseline_
items Sequence[BaselineBaseline Item Args] List of baseline items.
You can invoke ListAccountFactoryBaselineItems to get a list of account factory baseline items supported by the Cloud Governance Center. See
baseline_items
below.- baseline_
name str - Baseline Name.
- description str
- Baseline Description.
- baseline
Items List<Property Map> List of baseline items.
You can invoke ListAccountFactoryBaselineItems to get a list of account factory baseline items supported by the Cloud Governance Center. See
baseline_items
below.- baseline
Name String - Baseline Name.
- description String
- Baseline Description.
Outputs
All input properties are implicitly available as output properties. Additionally, the Baseline resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Baseline Resource
Get an existing Baseline resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: BaselineState, opts?: CustomResourceOptions): Baseline
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
baseline_items: Optional[Sequence[BaselineBaselineItemArgs]] = None,
baseline_name: Optional[str] = None,
description: Optional[str] = None) -> Baseline
func GetBaseline(ctx *Context, name string, id IDInput, state *BaselineState, opts ...ResourceOption) (*Baseline, error)
public static Baseline Get(string name, Input<string> id, BaselineState? state, CustomResourceOptions? opts = null)
public static Baseline get(String name, Output<String> id, BaselineState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Baseline
Items List<Pulumi.Ali Cloud. Governance. Inputs. Baseline Baseline Item> List of baseline items.
You can invoke ListAccountFactoryBaselineItems to get a list of account factory baseline items supported by the Cloud Governance Center. See
baseline_items
below.- Baseline
Name string - Baseline Name.
- Description string
- Baseline Description.
- Baseline
Items []BaselineBaseline Item Args List of baseline items.
You can invoke ListAccountFactoryBaselineItems to get a list of account factory baseline items supported by the Cloud Governance Center. See
baseline_items
below.- Baseline
Name string - Baseline Name.
- Description string
- Baseline Description.
- baseline
Items List<BaselineBaseline Item> List of baseline items.
You can invoke ListAccountFactoryBaselineItems to get a list of account factory baseline items supported by the Cloud Governance Center. See
baseline_items
below.- baseline
Name String - Baseline Name.
- description String
- Baseline Description.
- baseline
Items BaselineBaseline Item[] List of baseline items.
You can invoke ListAccountFactoryBaselineItems to get a list of account factory baseline items supported by the Cloud Governance Center. See
baseline_items
below.- baseline
Name string - Baseline Name.
- description string
- Baseline Description.
- baseline_
items Sequence[BaselineBaseline Item Args] List of baseline items.
You can invoke ListAccountFactoryBaselineItems to get a list of account factory baseline items supported by the Cloud Governance Center. See
baseline_items
below.- baseline_
name str - Baseline Name.
- description str
- Baseline Description.
- baseline
Items List<Property Map> List of baseline items.
You can invoke ListAccountFactoryBaselineItems to get a list of account factory baseline items supported by the Cloud Governance Center. See
baseline_items
below.- baseline
Name String - Baseline Name.
- description String
- Baseline Description.
Supporting Types
BaselineBaselineItem, BaselineBaselineItemArgs
Import
Governance Baseline can be imported using the id, e.g.
$ pulumi import alicloud:governance/baseline:Baseline example <id>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.