Spotinst v3.94.0 published on Friday, Sep 20, 2024 by Pulumi
spotinst.organization.Policy
Explore with Pulumi AI
Provides a Spotinst access policy.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as spotinst from "@pulumi/spotinst";
const terraformPolicy = new spotinst.organization.Policy("terraform_policy", {
name: "test-policy",
description: "policy by terraform",
policyContents: [{
statements: [
{
actions: ["ocean:deleteCluster"],
effect: "DENY",
resources: [
"o-abcd1234",
"o-defg6789",
],
},
{
actions: ["ocean:createCluster"],
effect: "DENY",
resources: [
"o-fhau4752",
"o-761owf4r3",
],
},
],
}],
});
import pulumi
import pulumi_spotinst as spotinst
terraform_policy = spotinst.organization.Policy("terraform_policy",
name="test-policy",
description="policy by terraform",
policy_contents=[{
"statements": [
{
"actions": ["ocean:deleteCluster"],
"effect": "DENY",
"resources": [
"o-abcd1234",
"o-defg6789",
],
},
{
"actions": ["ocean:createCluster"],
"effect": "DENY",
"resources": [
"o-fhau4752",
"o-761owf4r3",
],
},
],
}])
package main
import (
"github.com/pulumi/pulumi-spotinst/sdk/v3/go/spotinst/organization"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := organization.NewPolicy(ctx, "terraform_policy", &organization.PolicyArgs{
Name: pulumi.String("test-policy"),
Description: pulumi.String("policy by terraform"),
PolicyContents: organization.PolicyPolicyContentArray{
&organization.PolicyPolicyContentArgs{
Statements: organization.PolicyPolicyContentStatementArray{
&organization.PolicyPolicyContentStatementArgs{
Actions: pulumi.StringArray{
pulumi.String("ocean:deleteCluster"),
},
Effect: pulumi.String("DENY"),
Resources: pulumi.StringArray{
pulumi.String("o-abcd1234"),
pulumi.String("o-defg6789"),
},
},
&organization.PolicyPolicyContentStatementArgs{
Actions: pulumi.StringArray{
pulumi.String("ocean:createCluster"),
},
Effect: pulumi.String("DENY"),
Resources: pulumi.StringArray{
pulumi.String("o-fhau4752"),
pulumi.String("o-761owf4r3"),
},
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using SpotInst = Pulumi.SpotInst;
return await Deployment.RunAsync(() =>
{
var terraformPolicy = new SpotInst.Organization.Policy("terraform_policy", new()
{
Name = "test-policy",
Description = "policy by terraform",
PolicyContents = new[]
{
new SpotInst.Organization.Inputs.PolicyPolicyContentArgs
{
Statements = new[]
{
new SpotInst.Organization.Inputs.PolicyPolicyContentStatementArgs
{
Actions = new[]
{
"ocean:deleteCluster",
},
Effect = "DENY",
Resources = new[]
{
"o-abcd1234",
"o-defg6789",
},
},
new SpotInst.Organization.Inputs.PolicyPolicyContentStatementArgs
{
Actions = new[]
{
"ocean:createCluster",
},
Effect = "DENY",
Resources = new[]
{
"o-fhau4752",
"o-761owf4r3",
},
},
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.spotinst.organization.Policy;
import com.pulumi.spotinst.organization.PolicyArgs;
import com.pulumi.spotinst.organization.inputs.PolicyPolicyContentArgs;
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 terraformPolicy = new Policy("terraformPolicy", PolicyArgs.builder()
.name("test-policy")
.description("policy by terraform")
.policyContents(PolicyPolicyContentArgs.builder()
.statements(
PolicyPolicyContentStatementArgs.builder()
.actions("ocean:deleteCluster")
.effect("DENY")
.resources(
"o-abcd1234",
"o-defg6789")
.build(),
PolicyPolicyContentStatementArgs.builder()
.actions("ocean:createCluster")
.effect("DENY")
.resources(
"o-fhau4752",
"o-761owf4r3")
.build())
.build())
.build());
}
}
resources:
terraformPolicy:
type: spotinst:organization:Policy
name: terraform_policy
properties:
name: test-policy
description: policy by terraform
policyContents:
- statements:
- actions:
- ocean:deleteCluster
effect: DENY
resources:
- o-abcd1234
- o-defg6789
- actions:
- ocean:createCluster
effect: DENY
resources:
- o-fhau4752
- o-761owf4r3
Create Policy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Policy(name: string, args: PolicyArgs, opts?: CustomResourceOptions);
@overload
def Policy(resource_name: str,
args: PolicyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Policy(resource_name: str,
opts: Optional[ResourceOptions] = None,
policy_contents: Optional[Sequence[PolicyPolicyContentArgs]] = None,
description: Optional[str] = None,
name: Optional[str] = None)
func NewPolicy(ctx *Context, name string, args PolicyArgs, opts ...ResourceOption) (*Policy, error)
public Policy(string name, PolicyArgs args, CustomResourceOptions? opts = null)
public Policy(String name, PolicyArgs args)
public Policy(String name, PolicyArgs args, CustomResourceOptions options)
type: spotinst:organization:Policy
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 PolicyArgs
- 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 PolicyArgs
- 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 PolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PolicyArgs
- 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 policyResource = new SpotInst.Organization.Policy("policyResource", new()
{
PolicyContents = new[]
{
new SpotInst.Organization.Inputs.PolicyPolicyContentArgs
{
Statements = new[]
{
new SpotInst.Organization.Inputs.PolicyPolicyContentStatementArgs
{
Actions = new[]
{
"string",
},
Effect = "string",
Resources = new[]
{
"string",
},
},
},
},
},
Description = "string",
Name = "string",
});
example, err := organization.NewPolicy(ctx, "policyResource", &organization.PolicyArgs{
PolicyContents: organization.PolicyPolicyContentArray{
&organization.PolicyPolicyContentArgs{
Statements: organization.PolicyPolicyContentStatementArray{
&organization.PolicyPolicyContentStatementArgs{
Actions: pulumi.StringArray{
pulumi.String("string"),
},
Effect: pulumi.String("string"),
Resources: pulumi.StringArray{
pulumi.String("string"),
},
},
},
},
},
Description: pulumi.String("string"),
Name: pulumi.String("string"),
})
var policyResource = new Policy("policyResource", PolicyArgs.builder()
.policyContents(PolicyPolicyContentArgs.builder()
.statements(PolicyPolicyContentStatementArgs.builder()
.actions("string")
.effect("string")
.resources("string")
.build())
.build())
.description("string")
.name("string")
.build());
policy_resource = spotinst.organization.Policy("policyResource",
policy_contents=[spotinst.organization.PolicyPolicyContentArgs(
statements=[spotinst.organization.PolicyPolicyContentStatementArgs(
actions=["string"],
effect="string",
resources=["string"],
)],
)],
description="string",
name="string")
const policyResource = new spotinst.organization.Policy("policyResource", {
policyContents: [{
statements: [{
actions: ["string"],
effect: "string",
resources: ["string"],
}],
}],
description: "string",
name: "string",
});
type: spotinst:organization:Policy
properties:
description: string
name: string
policyContents:
- statements:
- actions:
- string
effect: string
resources:
- string
Policy Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The Policy resource accepts the following input properties:
- Policy
Contents List<Pulumi.Spot Inst. Organization. Inputs. Policy Policy Content> - Set permissions objects list.
- Description string
- Short description of policy.
- Name string
- Name of the Policy.
- Policy
Contents []PolicyPolicy Content Args - Set permissions objects list.
- Description string
- Short description of policy.
- Name string
- Name of the Policy.
- policy
Contents List<PolicyPolicy Content> - Set permissions objects list.
- description String
- Short description of policy.
- name String
- Name of the Policy.
- policy
Contents PolicyPolicy Content[] - Set permissions objects list.
- description string
- Short description of policy.
- name string
- Name of the Policy.
- policy_
contents Sequence[PolicyPolicy Content Args] - Set permissions objects list.
- description str
- Short description of policy.
- name str
- Name of the Policy.
- policy
Contents List<Property Map> - Set permissions objects list.
- description String
- Short description of policy.
- name String
- Name of the Policy.
Outputs
All input properties are implicitly available as output properties. Additionally, the Policy 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 Policy Resource
Get an existing Policy 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?: PolicyState, opts?: CustomResourceOptions): Policy
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
name: Optional[str] = None,
policy_contents: Optional[Sequence[PolicyPolicyContentArgs]] = None) -> Policy
func GetPolicy(ctx *Context, name string, id IDInput, state *PolicyState, opts ...ResourceOption) (*Policy, error)
public static Policy Get(string name, Input<string> id, PolicyState? state, CustomResourceOptions? opts = null)
public static Policy get(String name, Output<String> id, PolicyState 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.
- Description string
- Short description of policy.
- Name string
- Name of the Policy.
- Policy
Contents List<Pulumi.Spot Inst. Organization. Inputs. Policy Policy Content> - Set permissions objects list.
- Description string
- Short description of policy.
- Name string
- Name of the Policy.
- Policy
Contents []PolicyPolicy Content Args - Set permissions objects list.
- description String
- Short description of policy.
- name String
- Name of the Policy.
- policy
Contents List<PolicyPolicy Content> - Set permissions objects list.
- description string
- Short description of policy.
- name string
- Name of the Policy.
- policy
Contents PolicyPolicy Content[] - Set permissions objects list.
- description str
- Short description of policy.
- name str
- Name of the Policy.
- policy_
contents Sequence[PolicyPolicy Content Args] - Set permissions objects list.
- description String
- Short description of policy.
- name String
- Name of the Policy.
- policy
Contents List<Property Map> - Set permissions objects list.
Supporting Types
PolicyPolicyContent, PolicyPolicyContentArgs
- Statements
List<Pulumi.
Spot Inst. Organization. Inputs. Policy Policy Content Statement> - List of permissions statements.
- Statements
[]Policy
Policy Content Statement - List of permissions statements.
- statements
List<Policy
Policy Content Statement> - List of permissions statements.
- statements
Policy
Policy Content Statement[] - List of permissions statements.
- statements
Sequence[Policy
Policy Content Statement] - List of permissions statements.
- statements List<Property Map>
- List of permissions statements.
PolicyPolicyContentStatement, PolicyPolicyContentStatementArgs
- Actions List<string>
- Set a list of required actions for this permissions statement. Full list of actions can be found in https://docs.spot.io/account-user-management/user-management/access-policies-actions/.
- Effect string
- Valid values "ALLOW", "DENY".
- Resources List<string>
- Set a list of resources IDs. In order to include all resources in this statement - use "*".
- Actions []string
- Set a list of required actions for this permissions statement. Full list of actions can be found in https://docs.spot.io/account-user-management/user-management/access-policies-actions/.
- Effect string
- Valid values "ALLOW", "DENY".
- Resources []string
- Set a list of resources IDs. In order to include all resources in this statement - use "*".
- actions List<String>
- Set a list of required actions for this permissions statement. Full list of actions can be found in https://docs.spot.io/account-user-management/user-management/access-policies-actions/.
- effect String
- Valid values "ALLOW", "DENY".
- resources List<String>
- Set a list of resources IDs. In order to include all resources in this statement - use "*".
- actions string[]
- Set a list of required actions for this permissions statement. Full list of actions can be found in https://docs.spot.io/account-user-management/user-management/access-policies-actions/.
- effect string
- Valid values "ALLOW", "DENY".
- resources string[]
- Set a list of resources IDs. In order to include all resources in this statement - use "*".
- actions Sequence[str]
- Set a list of required actions for this permissions statement. Full list of actions can be found in https://docs.spot.io/account-user-management/user-management/access-policies-actions/.
- effect str
- Valid values "ALLOW", "DENY".
- resources Sequence[str]
- Set a list of resources IDs. In order to include all resources in this statement - use "*".
- actions List<String>
- Set a list of required actions for this permissions statement. Full list of actions can be found in https://docs.spot.io/account-user-management/user-management/access-policies-actions/.
- effect String
- Valid values "ALLOW", "DENY".
- resources List<String>
- Set a list of resources IDs. In order to include all resources in this statement - use "*".
Package Details
- Repository
- Spotinst pulumi/pulumi-spotinst
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
spotinst
Terraform Provider.