Skip to content

Commit

Permalink
fix: add route53 record dependencies (#43)
Browse files Browse the repository at this point in the history
* fix: Elasticsearch resources should depend on R53

The Elasticsearch resources should depend on Route53 record so the provider
can connect to it.

* fix: Add HTTP provider version to fix tflint warn
  • Loading branch information
amontalban authored Sep 1, 2023
1 parent 7253458 commit 0346090
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Here is a working example of using this Terraform module:
| [elasticsearch_opensearch_ism_policy.ism_policy](https://registry.terraform.io/providers/phillbaker/elasticsearch/latest/docs/resources/opensearch_ism_policy) | resource |
| [elasticsearch_opensearch_role.role](https://registry.terraform.io/providers/phillbaker/elasticsearch/latest/docs/resources/opensearch_role) | resource |
| [elasticsearch_opensearch_roles_mapping.master_user_arn](https://registry.terraform.io/providers/phillbaker/elasticsearch/latest/docs/resources/opensearch_roles_mapping) | resource |
| [elasticsearch_opensearch_roles_mapping.master_user_name](https://registry.terraform.io/providers/phillbaker/elasticsearch/latest/docs/resources/opensearch_roles_mapping) | resource |
| [elasticsearch_opensearch_roles_mapping.role_mapping](https://registry.terraform.io/providers/phillbaker/elasticsearch/latest/docs/resources/opensearch_roles_mapping) | resource |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_iam_policy_document.access_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
Expand Down
4 changes: 4 additions & 0 deletions examples/complete/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@ terraform {
source = "phillbaker/elasticsearch"
version = ">= 2.0"
}
http = {
source = "hashicorp/http"
version = ">= 3.0"
}
}
}
4 changes: 4 additions & 0 deletions examples/minimal/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@ terraform {
source = "phillbaker/elasticsearch"
version = ">= 2.0"
}
http = {
source = "hashicorp/http"
version = ">= 3.0"
}
}
}
1 change: 1 addition & 0 deletions index.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ resource "elasticsearch_index" "index" {
depends_on = [
elasticsearch_index_template.index_template,
elasticsearch_opensearch_ism_policy.ism_policy,
aws_route53_record.opensearch
]

lifecycle {
Expand Down
5 changes: 4 additions & 1 deletion index_template.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ resource "elasticsearch_index_template" "index_template" {
name = each.key
body = jsonencode(each.value)

depends_on = [elasticsearch_opensearch_roles_mapping.master_user_arn]
depends_on = [
elasticsearch_opensearch_roles_mapping.master_user_arn,
aws_route53_record.opensearch
]
}
5 changes: 4 additions & 1 deletion ism_policy.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ resource "elasticsearch_opensearch_ism_policy" "ism_policy" {
policy_id = each.key
body = jsonencode({ "policy" = each.value })

depends_on = [elasticsearch_opensearch_roles_mapping.master_user_arn]
depends_on = [
elasticsearch_opensearch_roles_mapping.master_user_arn,
aws_route53_record.opensearch
]
}
5 changes: 4 additions & 1 deletion role_mapping.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ resource "elasticsearch_opensearch_roles_mapping" "role_mapping" {
hosts = try(each.value.hosts, [])
users = try(each.value.users, [])

depends_on = [elasticsearch_opensearch_role.role]
depends_on = [
elasticsearch_opensearch_role.role,
aws_route53_record.opensearch
]
}

resource "elasticsearch_opensearch_roles_mapping" "master_user_arn" {
Expand Down
5 changes: 4 additions & 1 deletion roles.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ resource "elasticsearch_opensearch_role" "role" {
}
}

depends_on = [elasticsearch_opensearch_roles_mapping.master_user_arn]
depends_on = [
elasticsearch_opensearch_roles_mapping.master_user_arn,
aws_route53_record.opensearch
]
}

0 comments on commit 0346090

Please sign in to comment.