geoengineer 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +8 -6
- data/lib/geoengineer.rb +2 -0
- data/lib/geoengineer/cli/geo_cli.rb +1 -4
- data/lib/geoengineer/cli/terraform_commands.rb +4 -2
- data/lib/geoengineer/environment.rb +14 -1
- data/lib/geoengineer/provider.rb +38 -0
- data/lib/geoengineer/resource.rb +29 -15
- data/lib/geoengineer/resources/api_gateway/helpers.rb +107 -0
- data/lib/geoengineer/resources/aws_alb.rb +39 -0
- data/lib/geoengineer/resources/aws_alb_listener.rb +39 -0
- data/lib/geoengineer/resources/aws_alb_listener_rule.rb +42 -0
- data/lib/geoengineer/resources/aws_alb_target_group.rb +30 -0
- data/lib/geoengineer/resources/aws_api_gateway_account.rb +18 -0
- data/lib/geoengineer/resources/aws_api_gateway_api_key.rb +20 -0
- data/lib/geoengineer/resources/aws_api_gateway_authorizer.rb +20 -0
- data/lib/geoengineer/resources/aws_api_gateway_base_path_mapping.rb +20 -0
- data/lib/geoengineer/resources/aws_api_gateway_client_certificate.rb +24 -0
- data/lib/geoengineer/resources/aws_api_gateway_deployment.rb +65 -0
- data/lib/geoengineer/resources/aws_api_gateway_domain_name.rb +27 -0
- data/lib/geoengineer/resources/aws_api_gateway_integration.rb +58 -0
- data/lib/geoengineer/resources/aws_api_gateway_integration_response.rb +68 -0
- data/lib/geoengineer/resources/aws_api_gateway_method.rb +59 -0
- data/lib/geoengineer/resources/aws_api_gateway_method_response.rb +69 -0
- data/lib/geoengineer/resources/aws_api_gateway_model.rb +19 -0
- data/lib/geoengineer/resources/aws_api_gateway_resource.rb +47 -0
- data/lib/geoengineer/resources/aws_api_gateway_rest_api.rb +79 -0
- data/lib/geoengineer/resources/aws_api_gateway_usage_plan.rb +27 -0
- data/lib/geoengineer/resources/aws_cloudfront_distribution.rb +25 -0
- data/lib/geoengineer/resources/aws_cloudtrail.rb +2 -2
- data/lib/geoengineer/resources/aws_cloudwatch_event_rule.rb +12 -3
- data/lib/geoengineer/resources/aws_cloudwatch_event_target.rb +2 -2
- data/lib/geoengineer/resources/aws_cloudwatch_metric_alarm.rb +10 -8
- data/lib/geoengineer/resources/aws_customer_gateway.rb +4 -2
- data/lib/geoengineer/resources/aws_db_instance.rb +2 -2
- data/lib/geoengineer/resources/aws_db_parameter_group.rb +4 -2
- data/lib/geoengineer/resources/aws_dynamodb_table.rb +2 -2
- data/lib/geoengineer/resources/aws_eip.rb +2 -2
- data/lib/geoengineer/resources/aws_elasticache_cluster.rb +2 -2
- data/lib/geoengineer/resources/aws_elasticache_parameter_group.rb +2 -2
- data/lib/geoengineer/resources/aws_elasticache_replication_group.rb +2 -2
- data/lib/geoengineer/resources/aws_elasticache_subnet_group.rb +2 -2
- data/lib/geoengineer/resources/aws_elasticsearch_domain.rb +2 -2
- data/lib/geoengineer/resources/aws_elb.rb +4 -2
- data/lib/geoengineer/resources/aws_iam_account_password_policy.rb +2 -1
- data/lib/geoengineer/resources/aws_iam_group.rb +2 -2
- data/lib/geoengineer/resources/aws_iam_group_membership.rb +1 -1
- data/lib/geoengineer/resources/aws_iam_instance_profile.rb +3 -3
- data/lib/geoengineer/resources/aws_iam_policy.rb +6 -4
- data/lib/geoengineer/resources/aws_iam_policy_attachment.rb +1 -1
- data/lib/geoengineer/resources/aws_iam_role.rb +2 -2
- data/lib/geoengineer/resources/aws_iam_role_policy.rb +10 -9
- data/lib/geoengineer/resources/aws_iam_user.rb +4 -4
- data/lib/geoengineer/resources/aws_instance.rb +3 -3
- data/lib/geoengineer/resources/aws_internet_gateway.rb +3 -2
- data/lib/geoengineer/resources/aws_kinesis_stream.rb +4 -4
- data/lib/geoengineer/resources/aws_kms_key.rb +5 -3
- data/lib/geoengineer/resources/aws_lambda_alias.rb +7 -7
- data/lib/geoengineer/resources/aws_lambda_event_source_mapping.rb +2 -2
- data/lib/geoengineer/resources/aws_lambda_function.rb +2 -2
- data/lib/geoengineer/resources/aws_lambda_permission.rb +9 -8
- data/lib/geoengineer/resources/aws_lb_cookie_stickiness_policy.rb +47 -0
- data/lib/geoengineer/resources/aws_load_balancer_backend_server_policy.rb +2 -2
- data/lib/geoengineer/resources/aws_load_balancer_policy.rb +5 -5
- data/lib/geoengineer/resources/aws_main_route_table_association.rb +2 -2
- data/lib/geoengineer/resources/aws_nat_gateway.rb +2 -2
- data/lib/geoengineer/resources/aws_network_acl.rb +2 -2
- data/lib/geoengineer/resources/aws_network_acl_rule.rb +2 -2
- data/lib/geoengineer/resources/aws_proxy_protocol_policy.rb +1 -1
- data/lib/geoengineer/resources/aws_redshift_cluster.rb +2 -2
- data/lib/geoengineer/resources/aws_route.rb +2 -2
- data/lib/geoengineer/resources/aws_route53_record.rb +6 -6
- data/lib/geoengineer/resources/aws_route53_zone.rb +2 -2
- data/lib/geoengineer/resources/aws_route_table.rb +2 -2
- data/lib/geoengineer/resources/aws_route_table_association.rb +2 -2
- data/lib/geoengineer/resources/aws_s3_bucket.rb +2 -2
- data/lib/geoengineer/resources/aws_s3_bucket_notification.rb +38 -0
- data/lib/geoengineer/resources/aws_security_group.rb +2 -2
- data/lib/geoengineer/resources/aws_ses_receipt_rule.rb +2 -2
- data/lib/geoengineer/resources/aws_ses_receipt_rule_set.rb +2 -2
- data/lib/geoengineer/resources/aws_sns_topic.rb +2 -2
- data/lib/geoengineer/resources/aws_sns_topic_subscription.rb +5 -5
- data/lib/geoengineer/resources/aws_sqs_queue.rb +2 -2
- data/lib/geoengineer/resources/aws_subnet.rb +2 -2
- data/lib/geoengineer/resources/aws_vpc.rb +2 -2
- data/lib/geoengineer/resources/aws_vpc_dhcp_options.rb +2 -2
- data/lib/geoengineer/resources/aws_vpc_dhcp_options_association.rb +2 -2
- data/lib/geoengineer/resources/aws_vpc_endpoint.rb +2 -2
- data/lib/geoengineer/resources/aws_vpc_peering_connection.rb +2 -2
- data/lib/geoengineer/resources/aws_vpn_connection.rb +3 -2
- data/lib/geoengineer/resources/aws_vpn_connection_route.rb +2 -2
- data/lib/geoengineer/resources/aws_vpn_gateway.rb +2 -2
- data/lib/geoengineer/resources/aws_vpn_gateway_attachment.rb +2 -2
- data/lib/geoengineer/template.rb +3 -1
- data/lib/geoengineer/templates/json_rest_api.rb +197 -0
- data/lib/geoengineer/utils/aws_clients.rb +129 -38
- data/lib/geoengineer/utils/has_templates.rb +1 -1
- data/lib/geoengineer/version.rb +1 -1
- data/spec/environment_spec.rb +1 -1
- data/spec/resource_spec.rb +24 -10
- data/spec/resources/aws_alb_listener_rule_spec.rb +45 -0
- data/spec/resources/aws_alb_listener_spec.rb +33 -0
- data/spec/resources/aws_alb_spec.rb +33 -0
- data/spec/resources/aws_alb_target_group_spec.rb +35 -0
- data/spec/resources/aws_api_gateway_account_spec.rb +6 -0
- data/spec/resources/aws_api_gateway_api_key_spec.rb +6 -0
- data/spec/resources/aws_api_gateway_authorizer_spec.rb +6 -0
- data/spec/resources/aws_api_gateway_base_path_mapping_spec.rb +6 -0
- data/spec/resources/aws_api_gateway_client_certificate_spec.rb +6 -0
- data/spec/resources/aws_api_gateway_deployment_spec.rb +6 -0
- data/spec/resources/aws_api_gateway_domain_name_spec.rb +6 -0
- data/spec/resources/aws_api_gateway_integration_response_spec.rb +6 -0
- data/spec/resources/aws_api_gateway_integration_spec.rb +6 -0
- data/spec/resources/aws_api_gateway_method_response_spec.rb +6 -0
- data/spec/resources/aws_api_gateway_method_spec.rb +6 -0
- data/spec/resources/aws_api_gateway_model_spec.rb +6 -0
- data/spec/resources/aws_api_gateway_resource_spec.rb +6 -0
- data/spec/resources/aws_api_gateway_rest_api_spec.rb +6 -0
- data/spec/resources/aws_cloudfront_distribution_spec.rb +50 -0
- data/spec/resources/aws_cloudtrail_spec.rb +3 -3
- data/spec/resources/aws_cloudwatch_event_rule_spec.rb +3 -3
- data/spec/resources/aws_cloudwatch_event_target_spec.rb +4 -6
- data/spec/resources/aws_cloudwatch_metric_alarm_spec.rb +3 -6
- data/spec/resources/aws_customer_gateway_spec.rb +4 -3
- data/spec/resources/aws_db_instance_spec.rb +3 -3
- data/spec/resources/aws_db_parameter_group_spec.rb +3 -3
- data/spec/resources/aws_dynamodb_table_spec.rb +3 -3
- data/spec/resources/aws_eip_spec.rb +3 -3
- data/spec/resources/aws_elasticache_replication_group_spec.rb +3 -6
- data/spec/resources/aws_elasticache_subnet_group_spec.rb +4 -6
- data/spec/resources/aws_elasticcache_cluster_spec.rb +3 -3
- data/spec/resources/aws_elasticcache_parameter_group_spec.rb +3 -6
- data/spec/resources/aws_elasticsearch_domain_spec.rb +3 -3
- data/spec/resources/aws_elb_spec.rb +3 -3
- data/spec/resources/aws_iam_account_password_policy_spec.rb +2 -6
- data/spec/resources/aws_iam_group_membership_spec.rb +2 -6
- data/spec/resources/aws_iam_group_spec.rb +3 -3
- data/spec/resources/aws_iam_instance_profile_spec.rb +3 -6
- data/spec/resources/aws_iam_policy_attachment_spec.rb +2 -6
- data/spec/resources/aws_iam_policy_spec.rb +3 -5
- data/spec/resources/aws_iam_role_spec.rb +3 -4
- data/spec/resources/aws_iam_rule_policy_spec.rb +2 -5
- data/spec/resources/aws_iam_user_spec.rb +3 -4
- data/spec/resources/aws_instance_spec.rb +3 -3
- data/spec/resources/aws_internet_gateway_spec.rb +3 -3
- data/spec/resources/aws_kinesis_stream_spec.rb +3 -4
- data/spec/resources/aws_kms_key_spec.rb +3 -3
- data/spec/resources/aws_lambda_alias_spec.rb +2 -3
- data/spec/resources/aws_lambda_event_source_mapping_spec.rb +2 -5
- data/spec/resources/aws_lambda_function_spec.rb +3 -4
- data/spec/resources/aws_lambda_permission_spec.rb +1 -1
- data/spec/resources/aws_lb_cookie_stickiness_policy_spec.rb +38 -0
- data/spec/resources/aws_load_balancer_backend_server_policy_spec.rb +2 -3
- data/spec/resources/aws_load_balancer_policy_spec.rb +3 -4
- data/spec/resources/aws_main_route_table_association_spec.rb +2 -5
- data/spec/resources/aws_nat_gateway_spec.rb +3 -4
- data/spec/resources/aws_network_acl_rule_spec.rb +2 -3
- data/spec/resources/aws_network_acl_spec.rb +3 -3
- data/spec/resources/aws_proxy_protocol_policy_spec.rb +2 -2
- data/spec/resources/aws_redshift_cluster_spec.rb +3 -3
- data/spec/resources/aws_route53_record_spec.rb +3 -4
- data/spec/resources/aws_route53_zone_spec.rb +3 -4
- data/spec/resources/aws_route_spec.rb +3 -6
- data/spec/resources/aws_route_table_association_spec.rb +4 -6
- data/spec/resources/aws_route_table_spec.rb +3 -3
- data/spec/resources/aws_s3_bucket_notification_spec.rb +4 -0
- data/spec/resources/aws_s3_bucket_spec.rb +3 -3
- data/spec/resources/aws_security_group_spec.rb +5 -5
- data/spec/resources/aws_ses_receipt_rule_set_spec.rb +3 -4
- data/spec/resources/aws_ses_receipt_rule_spec.rb +3 -4
- data/spec/resources/aws_sns_topic_spec.rb +10 -6
- data/spec/resources/aws_sns_topic_subscription_spec.rb +8 -7
- data/spec/resources/aws_sqs_queue_spec.rb +3 -3
- data/spec/resources/aws_subnet_spec.rb +3 -3
- data/spec/resources/aws_vpc_dhcp_options_association_spec.rb +3 -6
- data/spec/resources/aws_vpc_dhcp_options_spec.rb +3 -3
- data/spec/resources/aws_vpc_endpoint_spec.rb +3 -6
- data/spec/resources/aws_vpc_peering_connection_spec.rb +4 -6
- data/spec/resources/aws_vpc_spec.rb +3 -3
- data/spec/resources/aws_vpn_connection_route_spec.rb +3 -6
- data/spec/resources/aws_vpn_connection_spec.rb +3 -3
- data/spec/resources/aws_vpn_gateway_attachment_spec.rb +4 -6
- data/spec/resources/aws_vpn_gateway_spec.rb +3 -3
- data/spec/spec_helper.rb +3 -1
- data/spec/support/normalize_indent.rb +12 -0
- metadata +92 -22
- metadata.gz.sig +0 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
########################################################################
|
2
|
+
# AwsAlbTargetGroup is the +aws_alb_target_group+ terrform resource,
|
3
|
+
#
|
4
|
+
# {https://www.terraform.io/docs/providers/aws/r/alb_target_group.html Terraform Docs}
|
5
|
+
########################################################################
|
6
|
+
class GeoEngineer::Resources::AwsAlbTargetGroup < GeoEngineer::Resource
|
7
|
+
validate -> {
|
8
|
+
validate_required_attributes([:port, :protocol, :vpc_id])
|
9
|
+
}
|
10
|
+
validate -> { validate_subresource_required_attributes(:stickiness, [:type]) }
|
11
|
+
|
12
|
+
after :initialize, -> { _terraform_id -> { NullObject.maybe(remote_resource)._terraform_id } }
|
13
|
+
after :initialize, -> { _geo_id -> { "#{vpc_id}::#{protocol}::#{port}" } }
|
14
|
+
|
15
|
+
def short_type
|
16
|
+
"alb_target_group"
|
17
|
+
end
|
18
|
+
|
19
|
+
def self._fetch_remote_resources(provider)
|
20
|
+
target_groups = AwsClients.alb(provider).describe_target_groups.target_groups.map(&:to_h)
|
21
|
+
target_groups.map do |group|
|
22
|
+
group.merge(
|
23
|
+
{
|
24
|
+
_geo_id: "#{group[:vpc_id]}::#{group[:protocol]}::#{group[:port]}",
|
25
|
+
_terraform_id: group[:target_group_arn]
|
26
|
+
}
|
27
|
+
)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative "./api_gateway/helpers"
|
2
|
+
|
3
|
+
########################################################################
|
4
|
+
# AwsCloudTrail is the +api_gatewat_rest_api+ terrform resource,
|
5
|
+
#
|
6
|
+
# {https://www.terraform.io/docs/providers/aws/r/api_gateway_account.html}
|
7
|
+
########################################################################
|
8
|
+
# TODO: not fully implemented
|
9
|
+
class GeoEngineer::Resources::AwsApiGatewayAccount < GeoEngineer::Resource
|
10
|
+
include GeoEngineer::ApiGatewayHelpers
|
11
|
+
|
12
|
+
after :initialize, -> { _terraform_id -> { nil } }
|
13
|
+
after :initialize, -> { _geo_id -> { rand(36**20).to_s(36) } }
|
14
|
+
|
15
|
+
def support_tags?
|
16
|
+
false
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative "./api_gateway/helpers"
|
2
|
+
|
3
|
+
########################################################################
|
4
|
+
# AwsCloudTrail is the +aws_api_gateway_api_key+ terrform resource,
|
5
|
+
#
|
6
|
+
# {https://www.terraform.io/docs/providers/aws/r/aws_api_gateway_api_key.html}
|
7
|
+
########################################################################
|
8
|
+
# TODO: not fully implemented
|
9
|
+
class GeoEngineer::Resources::AwsApiGatewayApiKey < GeoEngineer::Resource
|
10
|
+
include GeoEngineer::ApiGatewayHelpers
|
11
|
+
|
12
|
+
validate -> { validate_required_attributes([:name]) }
|
13
|
+
|
14
|
+
after :initialize, -> { _terraform_id -> { NullObject.maybe(remote_resource)._terraform_id } }
|
15
|
+
after :initialize, -> { _geo_id -> { name } }
|
16
|
+
|
17
|
+
def support_tags?
|
18
|
+
false
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative "./api_gateway/helpers"
|
2
|
+
|
3
|
+
########################################################################
|
4
|
+
# AwsCloudTrail is the +aws_api_gateway_authorizer+ terrform resource,
|
5
|
+
#
|
6
|
+
# {https://www.terraform.io/docs/providers/aws/r/aws_api_gateway_authorizer.html}
|
7
|
+
########################################################################
|
8
|
+
# TODO: not fully implemented
|
9
|
+
class GeoEngineer::Resources::AwsApiGatewayAuthorizer < GeoEngineer::Resource
|
10
|
+
include GeoEngineer::ApiGatewayHelpers
|
11
|
+
|
12
|
+
validate -> { validate_required_attributes([:authorizer_uri, :name, :rest_api_id]) }
|
13
|
+
|
14
|
+
after :initialize, -> { _terraform_id -> { NullObject.maybe(remote_resource)._terraform_id } }
|
15
|
+
after :initialize, -> { _geo_id -> { name } }
|
16
|
+
|
17
|
+
def support_tags?
|
18
|
+
false
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative "./api_gateway/helpers"
|
2
|
+
|
3
|
+
########################################################################
|
4
|
+
# AwsCloudTrail is the +aws_api_gateway_base_path_mapping+ terrform resource,
|
5
|
+
#
|
6
|
+
# {https://www.terraform.io/docs/providers/aws/r/aws_api_gateway_base_path_mapping.html}
|
7
|
+
########################################################################
|
8
|
+
# TODO: not fully implemented
|
9
|
+
class GeoEngineer::Resources::AwsApiGatewayBasePathMapping < GeoEngineer::Resource
|
10
|
+
include GeoEngineer::ApiGatewayHelpers
|
11
|
+
|
12
|
+
validate -> { validate_required_attributes([:domain_name, :rest_api_id]) }
|
13
|
+
|
14
|
+
after :initialize, -> { _terraform_id -> { NullObject.maybe(remote_resource)._terraform_id } }
|
15
|
+
after :initialize, -> { _geo_id -> { domain_name } }
|
16
|
+
|
17
|
+
def support_tags?
|
18
|
+
false
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative "./api_gateway/helpers"
|
2
|
+
|
3
|
+
########################################################################
|
4
|
+
# AwsCloudTrail is the +aws_api_gateway_client_certificate+ terrform resource,
|
5
|
+
#
|
6
|
+
# {https://www.terraform.io/docs/providers/aws/r/aws_api_gateway_client_certificate.html}
|
7
|
+
########################################################################
|
8
|
+
# TODO: not fully implemented
|
9
|
+
class GeoEngineer::Resources::AwsApiGatewayClientCertificate < GeoEngineer::Resource
|
10
|
+
include GeoEngineer::ApiGatewayHelpers
|
11
|
+
|
12
|
+
validate -> {
|
13
|
+
validate_required_attributes([
|
14
|
+
:description
|
15
|
+
])
|
16
|
+
}
|
17
|
+
|
18
|
+
after :initialize, -> { _terraform_id -> { NullObject.maybe(remote_resource)._terraform_id } }
|
19
|
+
after :initialize, -> { _geo_id -> { description } }
|
20
|
+
|
21
|
+
def support_tags?
|
22
|
+
false
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require_relative "./api_gateway/helpers"
|
2
|
+
|
3
|
+
########################################################################
|
4
|
+
# AwsCloudTrail is the +api_gateway_deployment+ terrform resource,
|
5
|
+
#
|
6
|
+
# {https://www.terraform.io/docs/providers/aws/r/api_gateway_deployment.html}
|
7
|
+
########################################################################
|
8
|
+
class GeoEngineer::Resources::AwsApiGatewayDeployment < GeoEngineer::Resource
|
9
|
+
include GeoEngineer::ApiGatewayHelpers
|
10
|
+
|
11
|
+
validate -> {
|
12
|
+
validate_required_attributes([:rest_api_id, :stage_name])
|
13
|
+
}
|
14
|
+
|
15
|
+
after :initialize, -> {
|
16
|
+
if self._rest_api
|
17
|
+
self.rest_api_id = _rest_api.to_ref
|
18
|
+
_rest_api.api_resources[self.type][self.id] = self
|
19
|
+
depends_on [_rest_api].map(&:terraform_name)
|
20
|
+
end
|
21
|
+
}
|
22
|
+
|
23
|
+
after :initialize, -> { _geo_id -> { "#{_rest_api._geo_id}::#{stage_name}" } }
|
24
|
+
|
25
|
+
after :initialize, -> { _terraform_id -> { NullObject.maybe(remote_resource)._terraform_id } }
|
26
|
+
|
27
|
+
def to_terraform_state
|
28
|
+
tfstate = super
|
29
|
+
tfstate[:primary][:attributes] = {
|
30
|
+
"rest_api_id" => _rest_api._terraform_id,
|
31
|
+
"stage_name" => stage_name
|
32
|
+
}
|
33
|
+
tfstate
|
34
|
+
end
|
35
|
+
|
36
|
+
def support_tags?
|
37
|
+
false
|
38
|
+
end
|
39
|
+
|
40
|
+
def self._fetch_deployments(provider, rr)
|
41
|
+
_client(provider).get_deployments({
|
42
|
+
rest_api_id: rr[:_terraform_id]
|
43
|
+
})['items'].map(&:to_h)
|
44
|
+
end
|
45
|
+
|
46
|
+
def self._fetch_stage_name(provider, rr, deployment)
|
47
|
+
_client(provider).get_stages({
|
48
|
+
rest_api_id: rr[:_terraform_id],
|
49
|
+
deployment_id: deployment[:id]
|
50
|
+
}).item.first&.stage_name
|
51
|
+
end
|
52
|
+
|
53
|
+
def self._fetch_remote_resources(provider)
|
54
|
+
_fetch_remote_rest_apis(provider).map do |rr|
|
55
|
+
_fetch_deployments(provider, rr) .map do |deployment|
|
56
|
+
stage_name = _fetch_stage_name(provider, rr, deployment)
|
57
|
+
next unless stage_name
|
58
|
+
deployment[:_terraform_id] = deployment[:id]
|
59
|
+
deployment[:_geo_id] = "#{rr[:_geo_id]}::#{stage_name}"
|
60
|
+
deployment[:stage_name] = stage_name
|
61
|
+
deployment
|
62
|
+
end
|
63
|
+
end.flatten.compact
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative "./api_gateway/helpers"
|
2
|
+
|
3
|
+
########################################################################
|
4
|
+
# AwsCloudTrail is the +aws_api_gateway_domain_name+ terrform resource,
|
5
|
+
#
|
6
|
+
# {https://www.terraform.io/docs/providers/aws/r/aws_api_gateway_domain_name.html}
|
7
|
+
########################################################################
|
8
|
+
class GeoEngineer::Resources::AwsApiGatewayDomainName < GeoEngineer::Resource
|
9
|
+
include GeoEngineer::ApiGatewayHelpers
|
10
|
+
|
11
|
+
validate -> {
|
12
|
+
validate_required_attributes([
|
13
|
+
:domain_name,
|
14
|
+
:certificate_name,
|
15
|
+
:certificate_body,
|
16
|
+
:certificate_chain,
|
17
|
+
:certificate_private_key
|
18
|
+
])
|
19
|
+
}
|
20
|
+
|
21
|
+
after :initialize, -> { _terraform_id -> { NullObject.maybe(remote_resource)._terraform_id } }
|
22
|
+
after :initialize, -> { _geo_id -> { domain_name } }
|
23
|
+
|
24
|
+
def support_tags?
|
25
|
+
false
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require_relative "./api_gateway/helpers"
|
2
|
+
|
3
|
+
########################################################################
|
4
|
+
# AwsCloudTrail is the +api_gatewat_rest_api+ terrform resource,
|
5
|
+
#
|
6
|
+
# {https://www.terraform.io/docs/providers/aws/r/api_gateway_integration.html}
|
7
|
+
########################################################################
|
8
|
+
class GeoEngineer::Resources::AwsApiGatewayIntegration < GeoEngineer::Resource
|
9
|
+
include GeoEngineer::ApiGatewayHelpers
|
10
|
+
|
11
|
+
validate -> {
|
12
|
+
validate_required_attributes([
|
13
|
+
:rest_api_id,
|
14
|
+
:resource_id,
|
15
|
+
:http_method,
|
16
|
+
:type
|
17
|
+
])
|
18
|
+
}
|
19
|
+
|
20
|
+
after :initialize, -> { self.rest_api_id = _rest_api.to_ref }
|
21
|
+
after :initialize, -> { _rest_api.api_resources[self.type][self.id] = self }
|
22
|
+
|
23
|
+
after :initialize, -> { self.resource_id = _resource.to_ref }
|
24
|
+
after :initialize, -> { depends_on [_rest_api, _resource].map(&:terraform_name) }
|
25
|
+
|
26
|
+
after :initialize, -> {
|
27
|
+
_geo_id -> {
|
28
|
+
"#{_rest_api._geo_id}::#{_resource._geo_id}::#{http_method}"
|
29
|
+
} }
|
30
|
+
|
31
|
+
after :initialize, -> { _terraform_id -> { NullObject.maybe(remote_resource)._terraform_id } }
|
32
|
+
|
33
|
+
def to_terraform_state
|
34
|
+
tfstate = super
|
35
|
+
tfstate[:primary][:attributes] = {
|
36
|
+
"rest_api_id" => _rest_api._terraform_id,
|
37
|
+
"resource_id" => _resource._terraform_id,
|
38
|
+
"http_method" => http_method,
|
39
|
+
"integration_http_method" => integration_http_method
|
40
|
+
}
|
41
|
+
tfstate
|
42
|
+
end
|
43
|
+
|
44
|
+
def support_tags?
|
45
|
+
false
|
46
|
+
end
|
47
|
+
|
48
|
+
def self._fetch_remote_resources(provider)
|
49
|
+
_remote_rest_api_resource_method(provider) do |rr, res, meth|
|
50
|
+
api_integration = self._fetch_integration(provider, rr, res, meth)
|
51
|
+
next nil if api_integration.nil?
|
52
|
+
|
53
|
+
api_integration[:_terraform_id] = "agi-#{rr[:_terraform_id]}-#{res[:_terraform_id]}-#{meth}"
|
54
|
+
api_integration[:_geo_id] = "#{rr[:_geo_id]}::#{res[:_geo_id]}::#{meth}"
|
55
|
+
api_integration
|
56
|
+
end.flatten.compact
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require_relative "./api_gateway/helpers"
|
2
|
+
|
3
|
+
########################################################################
|
4
|
+
# AwsCloudTrail is the +api_gatewat_rest_api+ terrform resource,
|
5
|
+
#
|
6
|
+
# {https://www.terraform.io/docs/providers/aws/r/api_gateway_integration_response.html}
|
7
|
+
########################################################################
|
8
|
+
class GeoEngineer::Resources::AwsApiGatewayIntegrationResponse < GeoEngineer::Resource
|
9
|
+
include GeoEngineer::ApiGatewayHelpers
|
10
|
+
|
11
|
+
validate -> {
|
12
|
+
validate_required_attributes([
|
13
|
+
:rest_api_id,
|
14
|
+
:resource_id,
|
15
|
+
:http_method,
|
16
|
+
:status_code
|
17
|
+
])
|
18
|
+
}
|
19
|
+
|
20
|
+
after :initialize, -> { self.rest_api_id = _rest_api.to_ref }
|
21
|
+
after :initialize, -> { _rest_api.api_resources[self.type][self.id] = self }
|
22
|
+
|
23
|
+
after :initialize, -> { self.resource_id = _resource.to_ref }
|
24
|
+
after :initialize, -> { depends_on [_rest_api, _resource].map(&:terraform_name) }
|
25
|
+
|
26
|
+
after :initialize, -> {
|
27
|
+
_geo_id -> {
|
28
|
+
[
|
29
|
+
_rest_api[:_geo_id],
|
30
|
+
_resource[:_geo_id],
|
31
|
+
http_method,
|
32
|
+
status_code
|
33
|
+
].join("::")
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
after :initialize, -> { _terraform_id -> { NullObject.maybe(remote_resource)._terraform_id } }
|
38
|
+
|
39
|
+
def to_terraform_state
|
40
|
+
tfstate = super
|
41
|
+
tfstate[:primary][:attributes] = {
|
42
|
+
"rest_api_id" => _rest_api._terraform_id,
|
43
|
+
"resource_id" => _resource._terraform_id,
|
44
|
+
"http_method" => http_method,
|
45
|
+
"status_code" => status_code
|
46
|
+
}
|
47
|
+
tfstate
|
48
|
+
end
|
49
|
+
|
50
|
+
def support_tags?
|
51
|
+
false
|
52
|
+
end
|
53
|
+
|
54
|
+
def self._fetch_remote_resources(provider)
|
55
|
+
_remote_rest_api_resource_method(provider) do |rr, res, meth|
|
56
|
+
api_integration = self._fetch_integration(provider, rr, res, meth)
|
57
|
+
next nil if api_integration.nil?
|
58
|
+
|
59
|
+
(api_integration[:integration_responses] || {}).keys.map do |status_code|
|
60
|
+
agir = {}
|
61
|
+
tr_id = "agir-#{rr[:_terraform_id]}-#{res[:_terraform_id]}-#{meth}-#{status_code}"
|
62
|
+
agir[:_terraform_id] = tr_id
|
63
|
+
agir[:_geo_id] = "#{rr[:_geo_id]}::#{res[:_geo_id]}::#{meth}::#{status_code}"
|
64
|
+
agir
|
65
|
+
end
|
66
|
+
end.flatten.compact
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require_relative "./api_gateway/helpers"
|
2
|
+
|
3
|
+
########################################################################
|
4
|
+
# AwsCloudTrail is the +api_gatewat_rest_api+ terrform resource,
|
5
|
+
#
|
6
|
+
# {https://www.terraform.io/docs/providers/aws/r/api_gateway_method.html}
|
7
|
+
########################################################################
|
8
|
+
class GeoEngineer::Resources::AwsApiGatewayMethod < GeoEngineer::Resource
|
9
|
+
include GeoEngineer::ApiGatewayHelpers
|
10
|
+
|
11
|
+
validate -> {
|
12
|
+
validate_required_attributes([
|
13
|
+
:rest_api_id,
|
14
|
+
:resource_id,
|
15
|
+
:http_method,
|
16
|
+
:authorization
|
17
|
+
])
|
18
|
+
}
|
19
|
+
|
20
|
+
# Must pass the rest_api as _rest_api resource for additional information
|
21
|
+
after :initialize, -> { self.rest_api_id = _rest_api.to_ref }
|
22
|
+
after :initialize, -> { _rest_api.api_resources[self.type][self.id] = self }
|
23
|
+
|
24
|
+
after :initialize, -> { self.resource_id = _resource.to_ref }
|
25
|
+
after :initialize, -> { depends_on [_rest_api, _resource].map(&:terraform_name) }
|
26
|
+
|
27
|
+
after :initialize, -> {
|
28
|
+
_geo_id -> {
|
29
|
+
"#{_rest_api._geo_id}::#{_resource._geo_id}::#{http_method}"
|
30
|
+
} }
|
31
|
+
|
32
|
+
after :initialize, -> { _terraform_id -> { NullObject.maybe(remote_resource)._terraform_id } }
|
33
|
+
|
34
|
+
def to_terraform_state
|
35
|
+
tfstate = super
|
36
|
+
tfstate[:primary][:attributes] = {
|
37
|
+
"rest_api_id" => _rest_api._terraform_id,
|
38
|
+
"resource_id" => _resource._terraform_id,
|
39
|
+
"http_method" => http_method,
|
40
|
+
"authorization" => authorization
|
41
|
+
}
|
42
|
+
tfstate
|
43
|
+
end
|
44
|
+
|
45
|
+
def support_tags?
|
46
|
+
false
|
47
|
+
end
|
48
|
+
|
49
|
+
def self._fetch_remote_resources(provider)
|
50
|
+
_remote_rest_api_resource_method(provider) do |rr, res, meth|
|
51
|
+
api_method = self._fetch_method(provider, rr, res, meth)
|
52
|
+
next nil if api_method.nil?
|
53
|
+
|
54
|
+
api_method[:_terraform_id] = "agm-#{rr[:_terraform_id]}-#{res[:_terraform_id]}-#{meth}"
|
55
|
+
api_method[:_geo_id] = "#{rr[:_geo_id]}::#{res[:_geo_id]}::#{meth}"
|
56
|
+
api_method
|
57
|
+
end.flatten.compact
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require_relative "./api_gateway/helpers"
|
2
|
+
|
3
|
+
########################################################################
|
4
|
+
# AwsCloudTrail is the +api_gatewat_rest_api+ terrform resource,
|
5
|
+
#
|
6
|
+
# {https://www.terraform.io/docs/providers/aws/r/api_gateway_method_response.html}
|
7
|
+
########################################################################
|
8
|
+
class GeoEngineer::Resources::AwsApiGatewayMethodResponse < GeoEngineer::Resource
|
9
|
+
include GeoEngineer::ApiGatewayHelpers
|
10
|
+
|
11
|
+
validate -> {
|
12
|
+
validate_required_attributes([
|
13
|
+
:rest_api_id,
|
14
|
+
:resource_id,
|
15
|
+
:http_method,
|
16
|
+
:status_code
|
17
|
+
])
|
18
|
+
}
|
19
|
+
|
20
|
+
# Must pass the rest_api as _rest_api resource for additional information
|
21
|
+
after :initialize, -> { self.rest_api_id = _rest_api.to_ref }
|
22
|
+
after :initialize, -> { _rest_api.api_resources[self.type][self.id] = self }
|
23
|
+
|
24
|
+
after :initialize, -> { self.resource_id = _resource.to_ref }
|
25
|
+
after :initialize, -> { depends_on [_rest_api, _resource].map(&:terraform_name) }
|
26
|
+
|
27
|
+
after :initialize, -> {
|
28
|
+
_geo_id -> {
|
29
|
+
[
|
30
|
+
_rest_api._geo_id,
|
31
|
+
_resource._geo_id,
|
32
|
+
http_method,
|
33
|
+
status_code
|
34
|
+
].join("::")
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
after :initialize, -> { _terraform_id -> { NullObject.maybe(remote_resource)._terraform_id } }
|
39
|
+
|
40
|
+
def to_terraform_state
|
41
|
+
tfstate = super
|
42
|
+
tfstate[:primary][:attributes] = {
|
43
|
+
"rest_api_id" => _rest_api._terraform_id,
|
44
|
+
"resource_id" => _resource._terraform_id,
|
45
|
+
"http_method" => http_method,
|
46
|
+
"status_code" => status_code
|
47
|
+
}
|
48
|
+
tfstate
|
49
|
+
end
|
50
|
+
|
51
|
+
def support_tags?
|
52
|
+
false
|
53
|
+
end
|
54
|
+
|
55
|
+
def self._fetch_remote_resources(provider)
|
56
|
+
_remote_rest_api_resource_method(provider) do |rr, res, meth|
|
57
|
+
api_method = self._fetch_method(provider, rr, res, meth)
|
58
|
+
next nil if api_method.nil?
|
59
|
+
|
60
|
+
(api_method[:method_responses] || {}).keys.map do |status_code|
|
61
|
+
agmr = {}
|
62
|
+
tf_id = "agmr-#{rr[:_terraform_id]}-#{res[:_terraform_id]}-#{meth}-#{status_code}"
|
63
|
+
agmr[:_terraform_id] = tf_id
|
64
|
+
agmr[:_geo_id] = "#{rr[:_geo_id]}::#{res[:_geo_id]}::#{meth}::#{status_code}"
|
65
|
+
agmr
|
66
|
+
end
|
67
|
+
end.flatten.compact
|
68
|
+
end
|
69
|
+
end
|