Skip to content

Commit

Permalink
use elasticsearch instead of search (#94)
Browse files Browse the repository at this point in the history
Co-authored-by: Jon Calderin Goni <[email protected]>
  • Loading branch information
jcalderin and JonCholas committed Feb 14, 2022
1 parent 6a157b2 commit c7ad793
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
46 changes: 46 additions & 0 deletions providers/aws/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4258,6 +4258,9 @@ export interface ElasticsearchDomainParams {
cluster_config?: ElasticsearchDomainClusterConfigParams;
snapshot_options?: ElasticsearchDomainSnapshotOptionsParams;
cognito_options?: ElasticsearchDomainCognitoOptionsParams;
domain_endpoint_options?: ElasticsearchDomainEndpointOptionsParams;
encrypt_at_rest?: ElasticsearchEncryptAtRestParams;
node_to_node_encryption?: ElasticsearchNodeToNodeEncryptionParams;
vpc_options?: ElasticsearchDomainVpcOptionsParams;
elasticsearch_version?: string;
tags?: TF.TagsMap;
Expand All @@ -4272,6 +4275,9 @@ export function fieldsFromElasticsearchDomainParams(params: ElasticsearchDomainP
TF.addOptionalBlock(fields, "cluster_config", params.cluster_config, fieldsFromElasticsearchDomainClusterConfigParams);
TF.addOptionalBlock(fields, "snapshot_options", params.snapshot_options, fieldsFromElasticsearchDomainSnapshotOptionsParams);
TF.addOptionalBlock(fields, "cognito_options", params.cognito_options, fieldsFromElasticsearchDomainCognitoOptionsParams);
TF.addOptionalBlock(fields, "domain_endpoint_options", params.domain_endpoint_options, fieldsFromElasticsearchDomainEndpointOptionsParams);
TF.addOptionalBlock(fields, "encrypt_at_rest", params.encrypt_at_rest, fieldsFromElasticsearchEncryptAtRestParams);
TF.addOptionalBlock(fields, "node_to_node_encryption", params.node_to_node_encryption, fieldsFromElasticsearchNodeToNodeEncryptionParams);
TF.addOptionalBlock(fields, "vpc_options", params.vpc_options, fieldsFromElasticsearchDomainVpcOptionsParams);
TF.addOptionalAttribute(fields, "elasticsearch_version", params.elasticsearch_version, TF.stringValue);
TF.addOptionalAttribute(fields, "tags", params.tags, TF.tagsValue);
Expand Down Expand Up @@ -4364,6 +4370,46 @@ export function fieldsFromElasticsearchDomainPolicyParams(params: ElasticsearchD
return fields;
}

export interface ElasticsearchDomainEndpointOptionsParams {
custom_endpoint_certificate_arn?: AT.ArnT<"AcmCertificate">;
custom_endpoint_enabled?: boolean;
custom_endpoint?: string;
enforce_https?: boolean;
tls_security_policy?: string;
}

export function fieldsFromElasticsearchDomainEndpointOptionsParams(params: ElasticsearchDomainEndpointOptionsParams) : TF.ResourceFieldMap {
const fields: TF.ResourceFieldMap = [];
TF.addOptionalAttribute(fields, "custom_endpoint_certificate_arn", params.custom_endpoint_certificate_arn, TF.resourceArnValue);
TF.addOptionalAttribute(fields, "custom_endpoint_enabled", params.custom_endpoint_enabled, TF.booleanValue);
TF.addOptionalAttribute(fields, "custom_endpoint", params.custom_endpoint, TF.stringValue);
TF.addOptionalAttribute(fields, "enforce_https", params.enforce_https, TF.booleanValue);
TF.addOptionalAttribute(fields, "tls_security_policy", params.tls_security_policy, TF.stringValue);
return fields;
}

export interface ElasticsearchEncryptAtRestParams {
enabled: boolean;
kms_key_id?: string;
}

export function fieldsFromElasticsearchEncryptAtRestParams(params: ElasticsearchEncryptAtRestParams) : TF.ResourceFieldMap {
const fields: TF.ResourceFieldMap = [];
TF.addAttribute(fields, "enabled", params.enabled, TF.booleanValue);
TF.addOptionalAttribute(fields, "kms_key_id", params.kms_key_id, TF.stringValue);
return fields;
}

export interface ElasticsearchNodeToNodeEncryptionParams {
enabled: boolean;
}

export function fieldsFromElasticsearchNodeToNodeEncryptionParams(params: ElasticsearchNodeToNodeEncryptionParams) : TF.ResourceFieldMap {
const fields: TF.ResourceFieldMap = [];
TF.addAttribute(fields, "enabled", params.enabled, TF.booleanValue);
return fields;
}

export interface AcmCertificateParams {
domain_name: string;
subject_alternative_names?: (string)[];
Expand Down
41 changes: 41 additions & 0 deletions tools/gen-providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,32 @@ const elasticsearch_domain_cognito_options: RecordDecl = {
],
};

const elasticsearch_domain_endpoint_options: RecordDecl = {
name: 'elasticsearch_domain_endpoint_options',
fields: [
optionalField('custom_endpoint_certificate_arn', arnType(acm_certificate)),
optionalField('custom_endpoint_enabled', BOOLEAN),
optionalField('custom_endpoint', STRING),
optionalField('enforce_https', BOOLEAN),
optionalField('tls_security_policy', STRING),
],
};

const elasticsearch_node_to_node_encryption: RecordDecl = {
name: 'elasticsearch_node_to_node_encryption',
fields: [
requiredField('enabled', BOOLEAN),
],
};

const elasticsearch_encrypt_at_rest: RecordDecl = {
name: 'elasticsearch_encrypt_at_rest',
fields: [
requiredField('enabled', BOOLEAN),
optionalField('kms_key_id', STRING),
],
};

const elasticsearch_domain: RecordDecl = {
name: 'elasticsearch_domain',
fields: [
Expand All @@ -1145,6 +1171,18 @@ const elasticsearch_domain: RecordDecl = {
'cognito_options',
recordType(elasticsearch_domain_cognito_options)
),
optionalField(
'domain_endpoint_options',
recordType(elasticsearch_domain_endpoint_options)
),
optionalField(
'encrypt_at_rest',
recordType(elasticsearch_encrypt_at_rest)
),
optionalField(
'node_to_node_encryption',
recordType(elasticsearch_node_to_node_encryption)
),
optionalField('vpc_options', recordType(elasticsearch_domain_vpc_options)),
optionalField('elasticsearch_version', STRING),
optionalField('tags', TAGS_MAP),
Expand Down Expand Up @@ -3886,6 +3924,9 @@ function generateAws(gen: Generator) {
gen.generateParams(elasticsearch_domain_vpc_options);
gen.generateParams(elasticsearch_domain_cognito_options);
gen.generateParams(elasticsearch_domain_policy);
gen.generateParams(elasticsearch_domain_endpoint_options);
gen.generateParams(elasticsearch_encrypt_at_rest);
gen.generateParams(elasticsearch_node_to_node_encryption);
gen.generateParams(acm_certificate);
gen.generateParams(acm_certificate_validation);
gen.generateParams(lb_listener_certificate);
Expand Down

0 comments on commit c7ad793

Please sign in to comment.