Skip to content

Commit d1b068e

Browse files
committed
feat: Add remaining resources including cloudwatch log group and security group
1 parent 66eb4a0 commit d1b068e

File tree

8 files changed

+468
-55
lines changed

8 files changed

+468
-55
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.77.1
3+
rev: v1.83.6
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_validate
@@ -23,7 +23,7 @@ repos:
2323
- '--args=--only=terraform_standard_module_structure'
2424
- '--args=--only=terraform_workspace_remote'
2525
- repo: https://github.com/pre-commit/pre-commit-hooks
26-
rev: v4.4.0
26+
rev: v4.5.0
2727
hooks:
2828
- id: check-merge-conflict
2929
- id: end-of-file-fixer

README.md

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,42 +45,70 @@ No modules.
4545

4646
| Name | Type |
4747
|------|------|
48+
| [aws_cloudwatch_log_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource |
49+
| [aws_cloudwatch_log_resource_policy.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_resource_policy) | resource |
4850
| [aws_opensearch_domain.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/opensearch_domain) | resource |
49-
| [aws_opensearch_domain_policy.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/opensearch_domain_policy) | resource |
50-
| [aws_iam_policy_document.service](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
51+
| [aws_opensearch_domain_policy.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/opensearch_domain_policy) | resource |
52+
| [aws_opensearch_domain_saml_options.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/opensearch_domain_saml_options) | resource |
53+
| [aws_opensearch_outbound_connection.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/opensearch_outbound_connection) | resource |
54+
| [aws_security_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
55+
| [aws_security_group_rule.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
56+
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
57+
| [aws_iam_policy_document.cloudwatch](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
58+
| [aws_iam_policy_document.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
59+
| [aws_iam_session_context.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_session_context) | data source |
60+
| [aws_partition.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) | data source |
61+
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
62+
| [aws_subnet.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet) | data source |
5163

5264
## Inputs
5365

5466
| Name | Description | Type | Default | Required |
5567
|------|-------------|------|---------|:--------:|
5668
| <a name="input_access_policies"></a> [access\_policies](#input\_access\_policies) | IAM policy document specifying the access policies for the domain. Required if `create_access_policy` is `false` | `string` | `null` | no |
57-
| <a name="input_access_pollicy_statements"></a> [access\_pollicy\_statements](#input\_access\_pollicy\_statements) | A map of IAM policy [statements](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document#statement) for custom permission usage | `any` | `{}` | no |
69+
| <a name="input_access_policy_statements"></a> [access\_policy\_statements](#input\_access\_policy\_statements) | A map of IAM policy [statements](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document#statement) for custom permission usage | `any` | `{}` | no |
5870
| <a name="input_advanced_options"></a> [advanced\_options](#input\_advanced\_options) | Key-value string pairs to specify advanced configuration options. Note that the values for these configuration options must be strings (wrapped in quotes) or they may be wrong and cause a perpetual diff, causing Terraform to want to recreate your Elasticsearch domain on every apply | `map(string)` | `{}` | no |
59-
| <a name="input_advanced_security_options"></a> [advanced\_security\_options](#input\_advanced\_security\_options) | Configuration block for [fine-grained access control](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/fgac.html) | `any` | `{}` | no |
60-
| <a name="input_auto_tune_options"></a> [auto\_tune\_options](#input\_auto\_tune\_options) | Configuration block for the Auto-Tune options of the domain | `any` | `{}` | no |
61-
| <a name="input_cluster_config"></a> [cluster\_config](#input\_cluster\_config) | Configuration block for the cluster of the domain | `any` | `{}` | no |
71+
| <a name="input_advanced_security_options"></a> [advanced\_security\_options](#input\_advanced\_security\_options) | Configuration block for [fine-grained access control](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/fgac.html) | `any` | <pre>{<br> "anonymous_auth_enabled": false,<br> "enabled": true<br>}</pre> | no |
72+
| <a name="input_auto_tune_options"></a> [auto\_tune\_options](#input\_auto\_tune\_options) | Configuration block for the Auto-Tune options of the domain | `any` | <pre>{<br> "desired_state": "ENABLED",<br> "rollback_on_disable": "NO_ROLLBACK"<br>}</pre> | no |
73+
| <a name="input_cloudwatch_log_group_kms_key_id"></a> [cloudwatch\_log\_group\_kms\_key\_id](#input\_cloudwatch\_log\_group\_kms\_key\_id) | If a KMS Key ARN is set, this key will be used to encrypt the corresponding log group. Please be sure that the KMS Key has an appropriate key policy (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/encrypt-log-data-kms.html) | `string` | `null` | no |
74+
| <a name="input_cloudwatch_log_group_retention_in_days"></a> [cloudwatch\_log\_group\_retention\_in\_days](#input\_cloudwatch\_log\_group\_retention\_in\_days) | Number of days to retain log events. Default retention - 90 days | `number` | `90` | no |
75+
| <a name="input_cloudwatch_log_resource_policy_name"></a> [cloudwatch\_log\_resource\_policy\_name](#input\_cloudwatch\_log\_resource\_policy\_name) | Name of the resource policy for OpenSearch to log to CloudWatch | `string` | `null` | no |
76+
| <a name="input_cluster_config"></a> [cluster\_config](#input\_cluster\_config) | Configuration block for the cluster of the domain | `any` | <pre>{<br> "dedicated_master_count": 3,<br> "dedicated_master_enabled": true,<br> "dedicated_master_type": "c5.large.search",<br> "instance_count": 3,<br> "instance_type": "r5.large.search",<br> "zone_awareness_config": {<br> "availability_zone_count": 3<br> },<br> "zone_awareness_enabled": true<br>}</pre> | no |
6277
| <a name="input_cognito_options"></a> [cognito\_options](#input\_cognito\_options) | Configuration block for authenticating Kibana with Cognito | `any` | `{}` | no |
6378
| <a name="input_create"></a> [create](#input\_create) | Determines whether resources will be created (affects all resources) | `bool` | `true` | no |
6479
| <a name="input_create_access_policy"></a> [create\_access\_policy](#input\_create\_access\_policy) | Determines whether an access policy will be created | `bool` | `true` | no |
65-
| <a name="input_domain_endpoint_options"></a> [domain\_endpoint\_options](#input\_domain\_endpoint\_options) | Configuration block for domain endpoint HTTP(S) related options | `any` | `{}` | no |
80+
| <a name="input_create_cloudwatch_log_groups"></a> [create\_cloudwatch\_log\_groups](#input\_create\_cloudwatch\_log\_groups) | Determines whether log groups are created | `bool` | `true` | no |
81+
| <a name="input_create_cloudwatch_log_resource_policy"></a> [create\_cloudwatch\_log\_resource\_policy](#input\_create\_cloudwatch\_log\_resource\_policy) | Determines whether a resource policy will be created for OpenSearch to log to CloudWatch | `bool` | `true` | no |
82+
| <a name="input_create_saml_options"></a> [create\_saml\_options](#input\_create\_saml\_options) | Determines whether SAML options will be created | `bool` | `false` | no |
83+
| <a name="input_create_security_group"></a> [create\_security\_group](#input\_create\_security\_group) | Determines whether the security group is created | `bool` | `true` | no |
84+
| <a name="input_domain_endpoint_options"></a> [domain\_endpoint\_options](#input\_domain\_endpoint\_options) | Configuration block for domain endpoint HTTP(S) related options | `any` | <pre>{<br> "enforce_https": true,<br> "tls_security_policy": "Policy-Min-TLS-1-2-2019-07"<br>}</pre> | no |
6685
| <a name="input_domain_name"></a> [domain\_name](#input\_domain\_name) | Name of the domain | `string` | `""` | no |
67-
| <a name="input_ebs_options"></a> [ebs\_options](#input\_ebs\_options) | Configuration block for EBS related options, may be required based on chosen [instance size](https://aws.amazon.com/elasticsearch-service/pricing/) | `any` | `{}` | no |
86+
| <a name="input_ebs_options"></a> [ebs\_options](#input\_ebs\_options) | Configuration block for EBS related options, may be required based on chosen [instance size](https://aws.amazon.com/elasticsearch-service/pricing/) | `any` | <pre>{<br> "ebs_enabled": true,<br> "volume_size": 64,<br> "volume_type": "gp3"<br>}</pre> | no |
6887
| <a name="input_enable_access_policy"></a> [enable\_access\_policy](#input\_enable\_access\_policy) | Determines whether an access policy will be applied to the domain | `bool` | `true` | no |
69-
| <a name="input_encrypt_at_rest"></a> [encrypt\_at\_rest](#input\_encrypt\_at\_rest) | Configuration block for encrypting at rest | `any` | `{}` | no |
88+
| <a name="input_encrypt_at_rest"></a> [encrypt\_at\_rest](#input\_encrypt\_at\_rest) | Configuration block for encrypting at rest | `any` | <pre>{<br> "enabled": true<br>}</pre> | no |
7089
| <a name="input_engine_version"></a> [engine\_version](#input\_engine\_version) | Version of the OpenSearch engine to use | `string` | `"OpenSearch_2.3"` | no |
71-
| <a name="input_log_publishing_options"></a> [log\_publishing\_options](#input\_log\_publishing\_options) | Configuration block for publishing slow and application logs to CloudWatch Logs. This block can be declared multiple times, for each log\_type, within the same resource | `any` | `[]` | no |
72-
| <a name="input_node_to_node_encryption"></a> [node\_to\_node\_encryption](#input\_node\_to\_node\_encryption) | Configuration block for node-to-node encryption options | `any` | `{}` | no |
90+
| <a name="input_log_publishing_options"></a> [log\_publishing\_options](#input\_log\_publishing\_options) | Configuration block for publishing slow and application logs to CloudWatch Logs. This block can be declared multiple times, for each log\_type, within the same resource | `any` | <pre>[<br> {<br> "log_type": "INDEX_SLOW_LOGS"<br> },<br> {<br> "log_type": "SEARCH_SLOW_LOGS"<br> },<br> {<br> "log_type": "AUDIT_LOGS"<br> }<br>]</pre> | no |
91+
| <a name="input_node_to_node_encryption"></a> [node\_to\_node\_encryption](#input\_node\_to\_node\_encryption) | Configuration block for node-to-node encryption options | `any` | <pre>{<br> "enabled": true<br>}</pre> | no |
92+
| <a name="input_outbound_connections"></a> [outbound\_connections](#input\_outbound\_connections) | Map of AWS OpenSearch outbound connections to create | `any` | `{}` | no |
93+
| <a name="input_saml_options"></a> [saml\_options](#input\_saml\_options) | SAML authentication options for an AWS OpenSearch Domain | `any` | `{}` | no |
94+
| <a name="input_security_group_description"></a> [security\_group\_description](#input\_security\_group\_description) | Description of the security group created | `string` | `null` | no |
95+
| <a name="input_security_group_name"></a> [security\_group\_name](#input\_security\_group\_name) | Name to use on manged security group created | `string` | `null` | no |
96+
| <a name="input_security_group_rules"></a> [security\_group\_rules](#input\_security\_group\_rules) | Security group rules to add to the security group created | `any` | `{}` | no |
97+
| <a name="input_security_group_tags"></a> [security\_group\_tags](#input\_security\_group\_tags) | A map of additional tags to add to the security group created | `map(string)` | `{}` | no |
98+
| <a name="input_security_group_use_name_prefix"></a> [security\_group\_use\_name\_prefix](#input\_security\_group\_use\_name\_prefix) | Determines whether the security group name (`security_group_name`) is used as a prefix | `bool` | `true` | no |
7399
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |
74100
| <a name="input_vpc_options"></a> [vpc\_options](#input\_vpc\_options) | Configuration block for VPC related options. Adding or removing this configuration forces a new resource ([documentation](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-vpc.html#es-vpc-limitations)) | `any` | `{}` | no |
75101

76102
## Outputs
77103

78104
| Name | Description |
79105
|------|-------------|
106+
| <a name="output_cloudwatch_logs"></a> [cloudwatch\_logs](#output\_cloudwatch\_logs) | Map of CloudWatch log groups created and their attributes |
80107
| <a name="output_domain_arn"></a> [domain\_arn](#output\_domain\_arn) | The Amazon Resource Name (ARN) of the domain |
81108
| <a name="output_domain_endpoint"></a> [domain\_endpoint](#output\_domain\_endpoint) | Domain-specific endpoint used to submit index, search, and data upload requests |
82109
| <a name="output_domain_id"></a> [domain\_id](#output\_domain\_id) | The unique identifier for the domain |
83110
| <a name="output_domain_kibana_endpoint"></a> [domain\_kibana\_endpoint](#output\_domain\_kibana\_endpoint) | Domain-specific endpoint for kibana without https scheme |
111+
| <a name="output_outbound_connections"></a> [outbound\_connections](#output\_outbound\_connections) | Map of outbound connections created and their attributes |
84112
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
85113

86114
## License

examples/complete/README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ Note that this example may create resources which will incur monetary charges on
3434

3535
| Name | Source | Version |
3636
|------|--------|---------|
37-
| <a name="module_opensearch"></a> [opensearch](#module\_opensearch) | ../.. | n/a |
37+
| <a name="module_opensearch_complete"></a> [opensearch\_complete](#module\_opensearch\_complete) | ../.. | n/a |
38+
| <a name="module_opensearch_default"></a> [opensearch\_default](#module\_opensearch\_default) | ../.. | n/a |
3839
| <a name="module_opensearch_disabled"></a> [opensearch\_disabled](#module\_opensearch\_disabled) | ../.. | n/a |
39-
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 3.0 |
40+
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.0 |
4041

4142
## Resources
4243

@@ -50,7 +51,14 @@ No inputs.
5051

5152
## Outputs
5253

53-
No outputs.
54+
| Name | Description |
55+
|------|-------------|
56+
| <a name="output_default_cloudwatch_logs"></a> [default\_cloudwatch\_logs](#output\_default\_cloudwatch\_logs) | Map of CloudWatch log groups created and their attributes |
57+
| <a name="output_default_domain_arn"></a> [default\_domain\_arn](#output\_default\_domain\_arn) | The Amazon Resource Name (ARN) of the domain |
58+
| <a name="output_default_domain_endpoint"></a> [default\_domain\_endpoint](#output\_default\_domain\_endpoint) | Domain-specific endpoint used to submit index, search, and data upload requests |
59+
| <a name="output_default_domain_id"></a> [default\_domain\_id](#output\_default\_domain\_id) | The unique identifier for the domain |
60+
| <a name="output_default_domain_kibana_endpoint"></a> [default\_domain\_kibana\_endpoint](#output\_default\_domain\_kibana\_endpoint) | Domain-specific endpoint for kibana without https scheme |
61+
| <a name="output_default_outbound_connections"></a> [default\_outbound\_connections](#output\_default\_outbound\_connections) | Map of outbound connections created and their attributes |
5462
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
5563

5664
Apache-2.0 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-aws-opensearch/blob/master/LICENSE).

examples/complete/main.tf

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,22 @@ locals {
2222
# Opensearch Module
2323
################################################################################
2424

25-
module "opensearch" {
25+
module "opensearch_complete" {
2626
source = "../.."
2727

2828
create = false
2929

3030
tags = local.tags
3131
}
3232

33+
module "opensearch_default" {
34+
source = "../.."
35+
36+
domain_name = "${local.name}-default"
37+
38+
tags = local.tags
39+
}
40+
3341
module "opensearch_disabled" {
3442
source = "../.."
3543

@@ -42,7 +50,7 @@ module "opensearch_disabled" {
4250

4351
module "vpc" {
4452
source = "terraform-aws-modules/vpc/aws"
45-
version = "~> 3.0"
53+
version = "~> 5.0"
4654

4755
name = local.name
4856
cidr = local.vpc_cidr
@@ -51,9 +59,5 @@ module "vpc" {
5159
public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)]
5260
private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 10)]
5361

54-
enable_nat_gateway = false
55-
single_nat_gateway = true
56-
enable_dns_hostnames = true
57-
5862
tags = local.tags
5963
}

examples/complete/outputs.tf

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
################################################################################
2+
# Default
3+
################################################################################
4+
5+
output "default_domain_arn" {
6+
description = "The Amazon Resource Name (ARN) of the domain"
7+
value = module.opensearch_default.domain_arn
8+
}
9+
10+
output "default_domain_id" {
11+
description = "The unique identifier for the domain"
12+
value = module.opensearch_default.domain_id
13+
}
14+
15+
output "default_domain_endpoint" {
16+
description = "Domain-specific endpoint used to submit index, search, and data upload requests"
17+
value = module.opensearch_default.domain_endpoint
18+
}
19+
20+
output "default_domain_kibana_endpoint" {
21+
description = "Domain-specific endpoint for kibana without https scheme"
22+
value = module.opensearch_default.domain_kibana_endpoint
23+
}
24+
25+
output "default_cloudwatch_logs" {
26+
description = "Map of CloudWatch log groups created and their attributes"
27+
value = module.opensearch_default.cloudwatch_logs
28+
}
29+
30+
output "default_outbound_connections" {
31+
description = "Map of outbound connections created and their attributes"
32+
value = module.opensearch_default.outbound_connections
33+
}

0 commit comments

Comments
 (0)