Skip to content

Commit

Permalink
Merge pull request #1492 from wongCH/d-improve-awscc_billingconductor…
Browse files Browse the repository at this point in the history
…_pricing_rule

docs: add example for: awscc_billingconductor_pricing_rule and awscc_billingconductor_pricing_plan
  • Loading branch information
marcosentino authored Apr 9, 2024
2 parents 797cba4 + 5de7fb5 commit f5ca5d8
Show file tree
Hide file tree
Showing 10 changed files with 302 additions and 5 deletions.
21 changes: 18 additions & 3 deletions docs/resources/billingconductor_pricing_plan.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "awscc_billingconductor_pricing_plan Resource - terraform-provider-awscc"
subcategory: ""
description: |-
Expand All @@ -10,7 +9,23 @@ description: |-

Pricing Plan enables you to customize your billing details consistent with the usage that accrues in each of your billing groups.


## Example Usage

### Pricing plan with rules
This example create a billing plan and assigned the billing rules
```terraform
resource "awscc_billingconductor_pricing_plan" "example" {
name = "HR-Rates"
pricing_rule_arns = [awscc_billingconductor_pricing_rule.example.arn]
tags = [
{
key = "Modified By"
value = "AWSCC"
}
]
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down Expand Up @@ -47,4 +62,4 @@ Import is supported using the following syntax:

```shell
$ terraform import awscc_billingconductor_pricing_plan.example <resource ID>
```
```
116 changes: 114 additions & 2 deletions docs/resources/billingconductor_pricing_rule.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "awscc_billingconductor_pricing_rule Resource - terraform-provider-awscc"
subcategory: ""
description: |-
Expand All @@ -10,7 +9,120 @@ description: |-

A markup/discount that is defined for a specific set of services that can later be associated with a pricing plan.

## Example Usage

### Pricing rule with global scope
This example to create pricing rule using global scope
```terraform
resource "awscc_billingconductor_pricing_rule" "example" {
name = "Markup10percent"
scope = "GLOBAL"
type = "MARKUP"
modifier_percentage = 10
tags = [
{
key = "Modified By"
value = "AWSCC"
}
]
}
```

### Pricing rule with service scope
This example create pricing rule using service scope
```terraform
resource "awscc_billingconductor_pricing_rule" "example_service" {
name = "S3Discount"
scope = "SERVICE"
service = "AmazonS3"
type = "DISCOUNT"
modifier_percentage = 5
tags = [
{
key = "Modified By"
value = "AWSCC"
}
]
}
```

### Pricing rule with with tier type
This example enable free-tier
```terraform
resource "awscc_billingconductor_pricing_rule" "example_tiering" {
name = "EnableFreeTiering"
scope = "GLOBAL"
type = "TIERING"
tiering = {
free_tier = {
activated = true
}
}
tags = [
{
key = "Modified By"
value = "AWSCC"
}
]
}
```

### Pricing rule with billing entity scope
This example create using billing entity scope to markup when marketplace is in use.
```terraform
resource "awscc_billingconductor_pricing_rule" "example_billing_entity" {
name = "MarketplaceDiscount"
scope = "BILLING_ENTITY"
billing_entity = "AWS Marketplace"
type = "MARKUP"
modifier_percentage = 5
tags = [
{
key = "Modified By"
value = "AWSCC"
}
]
}
```

### Pricing rule with SKU scope
This example provides using SKU as scope to provides discount billing item that uses t2.micro on Linux/Unix in Singapore region
```terraform
resource "awscc_billingconductor_pricing_rule" "example_sku" {
name = "DiscountEC2_T2Micro_LinuxUnix"
description = "5% Discount for t2.micro on Linux/Unix in Singapore region"
scope = "SKU"
service = "AmazonEC2"
usage_type = "APS1-BoxUsage:t2.medium"
operation = "RunInstances"
type = "DISCOUNT"
modifier_percentage = 5
tags = [
{
key = "Modified By"
value = "AWSCC"
}
]
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down Expand Up @@ -69,4 +181,4 @@ Import is supported using the following syntax:

```shell
$ terraform import awscc_billingconductor_pricing_rule.example <resource ID>
```
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

resource "awscc_billingconductor_pricing_plan" "example" {
name = "HR-Rates"
pricing_rule_arns = [awscc_billingconductor_pricing_rule.example.arn]

tags = [
{
key = "Modified By"
value = "AWSCC"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
resource "awscc_billingconductor_pricing_rule" "example" {
name = "Markup10percent"

scope = "GLOBAL"
type = "MARKUP"
modifier_percentage = 10

tags = [
{
key = "Modified By"
value = "AWSCC"
}

]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
resource "awscc_billingconductor_pricing_rule" "example_billing_entity" {
name = "MarketplaceDiscount"

scope = "BILLING_ENTITY"
billing_entity = "AWS Marketplace"
type = "MARKUP"
modifier_percentage = 5

tags = [
{
key = "Modified By"
value = "AWSCC"
}

]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
resource "awscc_billingconductor_pricing_rule" "example_service" {
name = "S3Discount"

scope = "SERVICE"
service = "AmazonS3"
type = "DISCOUNT"
modifier_percentage = 5

tags = [
{
key = "Modified By"
value = "AWSCC"
}

]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
resource "awscc_billingconductor_pricing_rule" "example_sku" {
name = "DiscountEC2_T2Micro_LinuxUnix"
description = "5% Discount for t2.micro on Linux/Unix in Singapore region"

scope = "SKU"
service = "AmazonEC2"
usage_type = "APS1-BoxUsage:t2.medium"
operation = "RunInstances"

type = "DISCOUNT"
modifier_percentage = 5

tags = [
{
key = "Modified By"
value = "AWSCC"
}

]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
resource "awscc_billingconductor_pricing_rule" "example_tiering" {
name = "EnableFreeTiering"

scope = "GLOBAL"
type = "TIERING"

tiering = {
free_tier = {
activated = true
}
}


tags = [
{
key = "Modified By"
value = "AWSCC"
}

]
}
27 changes: 27 additions & 0 deletions templates/resources/billingconductor_pricing_plan.md.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}"
subcategory: ""
description: |-
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
---

# {{.Name}} ({{.Type}})

{{ .Description | trimspace }}

## Example Usage

### Pricing plan with rules
This example create a billing plan and assigned the billing rules
{{ tffile (printf "examples/resources/%s/billingconductor_pricing_plan.tf" .Name)}}

{{ .SchemaMarkdown | trimspace }}
{{- if .HasImport }}

## Import

Import is supported using the following syntax:

{{ codefile "shell" .ImportFile }}

{{- end }}
43 changes: 43 additions & 0 deletions templates/resources/billingconductor_pricing_rule.md.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}"
subcategory: ""
description: |-
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
---

# {{.Name}} ({{.Type}})

{{ .Description | trimspace }}

## Example Usage

### Pricing rule with global scope
This example to create pricing rule using global scope
{{ tffile (printf "examples/resources/%s/billingconductor_pricing_rule.tf" .Name)}}

### Pricing rule with service scope
This example create pricing rule using service scope
{{ tffile (printf "examples/resources/%s/billingconductor_pricing_rule_service.tf" .Name)}}

### Pricing rule with with tier type
This example enable free-tier
{{ tffile (printf "examples/resources/%s/billingconductor_pricing_rule_tiering.tf" .Name)}}

### Pricing rule with billing entity scope
This example create using billing entity scope to markup when marketplace is in use.
{{ tffile (printf "examples/resources/%s/billingconductor_pricing_rule_billing_entity.tf" .Name)}}

### Pricing rule with SKU scope
This example provides using SKU as scope to provides discount billing item that uses t2.micro on Linux/Unix in Singapore region
{{ tffile (printf "examples/resources/%s/billingconductor_pricing_rule_sku.tf" .Name)}}

{{ .SchemaMarkdown | trimspace }}
{{- if .HasImport }}

## Import

Import is supported using the following syntax:

{{ codefile "shell" .ImportFile }}

{{- end }}

0 comments on commit f5ca5d8

Please sign in to comment.