diff --git a/modules/account/README.md b/modules/account/README.md index 8e69c98..66311bc 100644 --- a/modules/account/README.md +++ b/modules/account/README.md @@ -8,6 +8,7 @@ This module creates following resources. - `aws_account_primary_contact` (optional) - `aws_account_alternate_contact` (optional) - `aws_account_region` (optional) +- `aws_ce_cost_allocation_tag` (optional) - `aws_s3_account_public_access_block` - `aws_spot_datafeed_subscription` (optional) @@ -40,6 +41,7 @@ No modules. | [aws_account_alternate_contact.security](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/account_alternate_contact) | resource | | [aws_account_primary_contact.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/account_primary_contact) | resource | | [aws_account_region.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/account_region) | resource | +| [aws_ce_cost_allocation_tag.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ce_cost_allocation_tag) | resource | | [aws_iam_account_alias.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_account_alias) | resource | | [aws_iam_account_password_policy.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_account_password_policy) | resource | | [aws_iam_security_token_service_preferences.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_security_token_service_preferences) | resource | @@ -57,6 +59,7 @@ No modules. | [name](#input\_name) | (Required) The name for the AWS account. Used for the account alias. | `string` | n/a | yes | | [additional\_regions](#input\_additional\_regions) | (Optional) A set of regions to enable in the account. | `set(string)` | `[]` | no | | [billing\_contact](#input\_billing\_contact) | (Optional) The configuration of the billing contact for the AWS Account. `billing_contact` as defined below.
(Required) `name` - The name of the billing contact.
(Optional) `title` - The tile of the billing contact. Defaults to `Billing Manager`.
(Required) `email` - The email address of the billing contact.
(Required) `phone` - The phone number of the billing contact. |
object({
name = string
title = optional(string, "Billing Manager")
email = string
phone = string
})
| `null` | no | +| [cost](#input\_cost) | (Optional) The configuration of the Cost & Billing for the AWS Account. `cost` as defined below.
(Optional) `cost_allocation_tags` - A set of the key for the cost allocation tags. |
object({
cost_allocation_tags = optional(set(string), [])
})
| `{}` | no | | [ec2\_spot\_datafeed\_subscription](#input\_ec2\_spot\_datafeed\_subscription) | (Optional) The configuration of the Spot Data Feed Subscription. `ec2_spot_datafeed_subscription` as defined below.
(Optional) `enabled` - Indicate whether to enable Spot Data Feed Subscription to S3 Bucket. Defaults to `false`.
(Optional) `s3_bucket` - The configuration of the S3 bucket where AWS deliver the spot data feed. `s3_bucket` as defined below.
(Required) `name` - The name of the S3 bucket where AWS deliver the spot data feed.
(Optional) `key_prefix` - The path of directory inside S3 bucket to place spot pricing data. |
object({
enabled = optional(bool, false)
s3_bucket = optional(object({
name = optional(string, "")
key_prefix = optional(string, "")
}))
})
| `{}` | no | | [operation\_contact](#input\_operation\_contact) | (Optional) The configuration of the operation contact for the AWS Account. `operation_contact` as defined below.
(Required) `name` - The name of the operation contact.
(Optional) `title` - The tile of the operation contact. Defaults to `Operation Manager`.
(Required) `email` - The email address of the operation contact.
(Required) `phone` - The phone number of the operation contact. |
object({
name = string
title = optional(string, "Operation Manager")
email = string
phone = string
})
| `null` | no | | [password\_policy](#input\_password\_policy) | (Optional) Password Policy for the AWS account. |
object({
minimum_password_length = optional(number, 8)
require_numbers = optional(bool, true)
require_symbols = optional(bool, true)
require_lowercase_characters = optional(bool, true)
require_uppercase_characters = optional(bool, true)
allow_users_to_change_password = optional(bool, true)
hard_expiry = optional(bool, false)
max_password_age = optional(number, 0)
password_reuse_prevention = optional(number, 0)
})
| `{}` | no | @@ -72,6 +75,7 @@ No modules. |------|-------------| | [additional\_regions](#output\_additional\_regions) | A set of additional regions enabled in the account. | | [billing\_contact](#output\_billing\_contact) | The billing contact attached to an AWS Account. | +| [cost](#output\_cost) | The account-level configurations of Cost & Billing Management service.
`cost_allocation_tags` - A set of the key for the cost allocation tags. | | [ec2](#output\_ec2) | The account-level configurations of EC2 service.
`spot_datafeed_subscription` - To help you understand the charges for your Spot instances, Amazon EC2 provides a data feed that describes your Spot instance usage and pricing. This data feed is sent to an Amazon S3 bucket that you specify when you subscribe to the data feed. | | [id](#output\_id) | The AWS Account ID. | | [name](#output\_name) | Name of the AWS account. The account alias. | diff --git a/modules/account/cost.tf b/modules/account/cost.tf new file mode 100644 index 0000000..ca062e3 --- /dev/null +++ b/modules/account/cost.tf @@ -0,0 +1,10 @@ +################################################### +# Cost Allocation Tags +################################################### + +resource "aws_ce_cost_allocation_tag" "this" { + for_each = toset(var.cost.cost_allocation_tags) + + tag_key = each.value + status = "Active" +} diff --git a/modules/account/outputs.tf b/modules/account/outputs.tf index 2e67264..9d8ebca 100644 --- a/modules/account/outputs.tf +++ b/modules/account/outputs.tf @@ -71,6 +71,16 @@ output "security_contact" { }, null) } +output "cost" { + description = <