Use this data source to get information on an existing AWS Savings Plan.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.savingsplans.getSavingsPlan({
savingsPlanId: "sp-12345678901234567",
});
export const savingsPlanState = example.then(example => example.state);
import pulumi
import pulumi_aws as aws
example = aws.savingsplans.get_savings_plan(savings_plan_id="sp-12345678901234567")
pulumi.export("savingsPlanState", example.state)
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/savingsplans"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := savingsplans.LookupSavingsPlan(ctx, &savingsplans.LookupSavingsPlanArgs{
SavingsPlanId: "sp-12345678901234567",
}, nil)
if err != nil {
return err
}
ctx.Export("savingsPlanState", example.State)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = Aws.SavingsPlans.GetSavingsPlan.Invoke(new()
{
SavingsPlanId = "sp-12345678901234567",
});
return new Dictionary<string, object?>
{
["savingsPlanState"] = example.Apply(getSavingsPlanResult => getSavingsPlanResult.State),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.savingsplans.SavingsplansFunctions;
import com.pulumi.aws.savingsplans.inputs.GetSavingsPlanArgs;
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 example = SavingsplansFunctions.getSavingsPlan(GetSavingsPlanArgs.builder()
.savingsPlanId("sp-12345678901234567")
.build());
ctx.export("savingsPlanState", example.state());
}
}
variables:
example:
fn::invoke:
function: aws:savingsplans:getSavingsPlan
arguments:
savingsPlanId: sp-12345678901234567
outputs:
savingsPlanState: ${example.state}
Using getSavingsPlan
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getSavingsPlan(args: GetSavingsPlanArgs, opts?: InvokeOptions): Promise<GetSavingsPlanResult>
function getSavingsPlanOutput(args: GetSavingsPlanOutputArgs, opts?: InvokeOptions): Output<GetSavingsPlanResult>def get_savings_plan(savings_plan_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetSavingsPlanResult
def get_savings_plan_output(savings_plan_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetSavingsPlanResult]func LookupSavingsPlan(ctx *Context, args *LookupSavingsPlanArgs, opts ...InvokeOption) (*LookupSavingsPlanResult, error)
func LookupSavingsPlanOutput(ctx *Context, args *LookupSavingsPlanOutputArgs, opts ...InvokeOption) LookupSavingsPlanResultOutput> Note: This function is named LookupSavingsPlan in the Go SDK.
public static class GetSavingsPlan
{
public static Task<GetSavingsPlanResult> InvokeAsync(GetSavingsPlanArgs args, InvokeOptions? opts = null)
public static Output<GetSavingsPlanResult> Invoke(GetSavingsPlanInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetSavingsPlanResult> getSavingsPlan(GetSavingsPlanArgs args, InvokeOptions options)
public static Output<GetSavingsPlanResult> getSavingsPlan(GetSavingsPlanArgs args, InvokeOptions options)
fn::invoke:
function: aws:savingsplans/getSavingsPlan:getSavingsPlan
arguments:
# arguments dictionaryThe following arguments are supported:
- Savings
Plan stringId - The ID of the Savings Plan.
- Savings
Plan stringId - The ID of the Savings Plan.
- savings
Plan StringId - The ID of the Savings Plan.
- savings
Plan stringId - The ID of the Savings Plan.
- savings_
plan_ strid - The ID of the Savings Plan.
- savings
Plan StringId - The ID of the Savings Plan.
getSavingsPlan Result
The following output properties are available:
- Commitment string
- The hourly commitment amount.
- Currency string
- The currency of the Savings Plan.
- Description string
- Ec2Instance
Family string - The EC2 instance family for the Savings Plan.
- End string
- The end time of the Savings Plan.
- Id string
- The provider-assigned unique ID for this managed resource.
- Offering
Id string - The ID of the offering.
- Payment
Option string - The payment option for the Savings Plan.
- Product
Types List<string> - Purchase
Time string - Recurring
Payment stringAmount - The recurring payment amount.
- Region string
- The AWS Region.
- Returnable
Until string - Savings
Plan stringArn - The ARN of the Savings Plan.
- Savings
Plan stringId - Savings
Plan stringOffering Id - Savings
Plan stringType - The type of Savings Plan.
- Start string
- The start time of the Savings Plan.
- State string
- The current state of the Savings Plan.
- Dictionary<string, string>
- A map of tags assigned to the resource.
- Term
Duration intIn Seconds - The duration of the term, in seconds.
- Upfront
Payment stringAmount - The up-front payment amount.
- Commitment string
- The hourly commitment amount.
- Currency string
- The currency of the Savings Plan.
- Description string
- Ec2Instance
Family string - The EC2 instance family for the Savings Plan.
- End string
- The end time of the Savings Plan.
- Id string
- The provider-assigned unique ID for this managed resource.
- Offering
Id string - The ID of the offering.
- Payment
Option string - The payment option for the Savings Plan.
- Product
Types []string - Purchase
Time string - Recurring
Payment stringAmount - The recurring payment amount.
- Region string
- The AWS Region.
- Returnable
Until string - Savings
Plan stringArn - The ARN of the Savings Plan.
- Savings
Plan stringId - Savings
Plan stringOffering Id - Savings
Plan stringType - The type of Savings Plan.
- Start string
- The start time of the Savings Plan.
- State string
- The current state of the Savings Plan.
- map[string]string
- A map of tags assigned to the resource.
- Term
Duration intIn Seconds - The duration of the term, in seconds.
- Upfront
Payment stringAmount - The up-front payment amount.
- commitment String
- The hourly commitment amount.
- currency String
- The currency of the Savings Plan.
- description String
- ec2Instance
Family String - The EC2 instance family for the Savings Plan.
- end String
- The end time of the Savings Plan.
- id String
- The provider-assigned unique ID for this managed resource.
- offering
Id String - The ID of the offering.
- payment
Option String - The payment option for the Savings Plan.
- product
Types List<String> - purchase
Time String - recurring
Payment StringAmount - The recurring payment amount.
- region String
- The AWS Region.
- returnable
Until String - savings
Plan StringArn - The ARN of the Savings Plan.
- savings
Plan StringId - savings
Plan StringOffering Id - savings
Plan StringType - The type of Savings Plan.
- start String
- The start time of the Savings Plan.
- state String
- The current state of the Savings Plan.
- Map<String,String>
- A map of tags assigned to the resource.
- term
Duration IntegerIn Seconds - The duration of the term, in seconds.
- upfront
Payment StringAmount - The up-front payment amount.
- commitment string
- The hourly commitment amount.
- currency string
- The currency of the Savings Plan.
- description string
- ec2Instance
Family string - The EC2 instance family for the Savings Plan.
- end string
- The end time of the Savings Plan.
- id string
- The provider-assigned unique ID for this managed resource.
- offering
Id string - The ID of the offering.
- payment
Option string - The payment option for the Savings Plan.
- product
Types string[] - purchase
Time string - recurring
Payment stringAmount - The recurring payment amount.
- region string
- The AWS Region.
- returnable
Until string - savings
Plan stringArn - The ARN of the Savings Plan.
- savings
Plan stringId - savings
Plan stringOffering Id - savings
Plan stringType - The type of Savings Plan.
- start string
- The start time of the Savings Plan.
- state string
- The current state of the Savings Plan.
- {[key: string]: string}
- A map of tags assigned to the resource.
- term
Duration numberIn Seconds - The duration of the term, in seconds.
- upfront
Payment stringAmount - The up-front payment amount.
- commitment str
- The hourly commitment amount.
- currency str
- The currency of the Savings Plan.
- description str
- ec2_
instance_ strfamily - The EC2 instance family for the Savings Plan.
- end str
- The end time of the Savings Plan.
- id str
- The provider-assigned unique ID for this managed resource.
- offering_
id str - The ID of the offering.
- payment_
option str - The payment option for the Savings Plan.
- product_
types Sequence[str] - purchase_
time str - recurring_
payment_ stramount - The recurring payment amount.
- region str
- The AWS Region.
- returnable_
until str - savings_
plan_ strarn - The ARN of the Savings Plan.
- savings_
plan_ strid - savings_
plan_ stroffering_ id - savings_
plan_ strtype - The type of Savings Plan.
- start str
- The start time of the Savings Plan.
- state str
- The current state of the Savings Plan.
- Mapping[str, str]
- A map of tags assigned to the resource.
- term_
duration_ intin_ seconds - The duration of the term, in seconds.
- upfront_
payment_ stramount - The up-front payment amount.
- commitment String
- The hourly commitment amount.
- currency String
- The currency of the Savings Plan.
- description String
- ec2Instance
Family String - The EC2 instance family for the Savings Plan.
- end String
- The end time of the Savings Plan.
- id String
- The provider-assigned unique ID for this managed resource.
- offering
Id String - The ID of the offering.
- payment
Option String - The payment option for the Savings Plan.
- product
Types List<String> - purchase
Time String - recurring
Payment StringAmount - The recurring payment amount.
- region String
- The AWS Region.
- returnable
Until String - savings
Plan StringArn - The ARN of the Savings Plan.
- savings
Plan StringId - savings
Plan StringOffering Id - savings
Plan StringType - The type of Savings Plan.
- start String
- The start time of the Savings Plan.
- state String
- The current state of the Savings Plan.
- Map<String>
- A map of tags assigned to the resource.
- term
Duration NumberIn Seconds - The duration of the term, in seconds.
- upfront
Payment StringAmount - The up-front payment amount.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.
