Skip to content

Commit

Permalink
Dev (#10)
Browse files Browse the repository at this point in the history
* Init Azure provider

* Add fix for ASG

* Add fix for ASG

* Add NAT for VPC

* Add NAT for VPC

* Add templates

* Add templates

* Add templates

* Add templates

* Add templates

* Add templates

* Add templates

* Add templates

* Add templates

* Add templates

* Add templates

* Add templates

* Add templates

* Add templates

* Add doc

* Add output

* Add output

* add refactoring

* add refactoring

* add refactoring

* add refactoring

* add refactoring

* add refactoring

* add refactoring

* add refactoring

* add refactoring

* Add docs

* Add docs

* Add docs

* Add docs

* Add docs

* Add tags for k8s subnets

* Add module

* Add module

* Add fixes

* Add module

* Add module

* Add module

* Add module

* Add dependency

* Add fix

* Add outputs

* Add outputs

* Add module

* Add module

* Add module

* Add module

* Add module

* Add module; fixes

* Fix for tags

* Fix

* Fix

* Fix

* Fix

* Add output

* Add output

* Refactoring

* Fix

* Refactoring

* Refactoring

Co-authored-by: Vitaliy Natarov <[email protected]>
  • Loading branch information
SebastianUA and Vitaliy Natarov committed May 18, 2022
1 parent 30a781d commit af979b4
Show file tree
Hide file tree
Showing 1,201 changed files with 21,444 additions and 337 deletions.
70 changes: 35 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,45 +94,45 @@ $ terraform graph | dot -Tpng > graph.png
To get help, use:

```bash
$ terraform help
Usage: terraform [-version] [-help] <command> [args]
$ terraform -help
Usage: terraform [global options] <subcommand> [args]

The available commands for execution are listed below.
The most common, useful commands are shown first, followed by
less common or more advanced commands. If you're just getting
started with Terraform, stick with the common commands. For the
other commands, please read the help and docs before usage.
Common commands:
apply Builds or changes infrastructure
console Interactive console for Terraform interpolations
destroy Destroy Terraform-managed infrastructure
env Workspace management
fmt Rewrites config files to canonical format
get Download and install modules for the configuration
graph Create a visual graph of Terraform resources
import Import existing infrastructure into Terraform
init Initialize a Terraform working directory
login Obtain and save credentials for a remote host
logout Remove locally-stored credentials for a remote host
output Read an output from a state file
plan Generate and show an execution plan
providers Prints a tree of the providers used in the configuration
refresh Update local state file against real resources
show Inspect Terraform state or plan
taint Manually mark a resource for recreation
untaint Manually unmark a resource as tainted
validate Validates the Terraform files
version Prints the Terraform version
workspace Workspace management
The primary workflow commands are given first, followed by
less common or more advanced commands.

Main commands:
init Prepare your working directory for other commands
validate Check whether the configuration is valid
plan Show changes required by the current configuration
apply Create or update infrastructure
destroy Destroy previously-created infrastructure

All other commands:
0.12upgrade Rewrites pre-0.12 module source code for v0.12
0.13upgrade Rewrites pre-0.13 module source code for v0.13
debug Debug output management (experimental)
force-unlock Manually unlock the terraform state
push Obsolete command for Terraform Enterprise legacy (v1)
state Advanced state management```
console Try Terraform expressions at an interactive command prompt
fmt Reformat your configuration in the standard style
force-unlock Release a stuck lock on the current workspace
get Install or upgrade remote Terraform modules
graph Generate a Graphviz graph of the steps in an operation
import Associate existing infrastructure with a Terraform resource
login Obtain and save credentials for a remote host
logout Remove locally-stored credentials for a remote host
output Show output values from your root module
providers Show the providers required for this configuration
refresh Update the state to match remote systems
show Show the current state or a saved plan
state Advanced state management
taint Mark a resource instance as not fully functional
test Experimental support for module integration testing
untaint Remove the 'tainted' state from a resource instance
version Show the current Terraform version
workspace Workspace management

Global options (use these before the subcommand, if any):
-chdir=DIR Switch to a different working directory before executing the
given subcommand.
-help Show this help output, or the help for a specified subcommand.
-version An alias for the "version" subcommand.
```
## Auto-switching Terraform version
Expand Down
408 changes: 408 additions & 0 deletions aws/examples/apigatewayv2/README.md

Large diffs are not rendered by default.

259 changes: 259 additions & 0 deletions aws/examples/apigatewayv2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,268 @@ module "apigatewayv2" {
source = "../../modules/apigatewayv2"


// API gateway v2 api
enable_apigatewayv2_api = true
apigatewayv2_api_name = ""
apigatewayv2_api_protocol_type = "HTTP"

// API gateway v2 api domain name
enable_apigatewayv2_domain_name = true
apigatewayv2_domain_name_domain_name = "domain.org"
apigatewayv2_domain_name_domain_name_configuration = {
certificate_arn = "aws_acm_certificate_arn"
endpoint_type = "REGIONAL"
security_policy = "TLS_1_2"
}

// API gateway v2 api stage
enable_apigatewayv2_stage = true
apigatewayv2_stage_name = ""

// API gateway v2 api mapping
enable_apigatewayv2_api_mapping = true

tags = tomap({
"Environment" = "dev",
"Createdby" = "Vitaliy Natarov"
})

}

#---------------------------------------------------------------
# lambda for Firehose
#---------------------------------------------------------------
module "api_gateway_staging_firehose" {
source = "[email protected]:sebastianua/terraform.git//aws/modules/apigatewayv2?ref=dev"

providers = {
aws = aws.default
}

name = "test-api-gateway-staging-firehose"
environment = "staging"

// API gateway v2 api
enable_apigatewayv2_api = true
apigatewayv2_api_name = "test-firehose-staging-apigatewayv2"
apigatewayv2_api_protocol_type = "HTTP"

// API gateway v2 api stage
enable_apigatewayv2_stage = true
apigatewayv2_stage_name = "default"
apigatewayv2_stage_auto_deploy = true

// apigatewayv2_api_cors_configuration = {
// allow_credentials = ""
// allow_headers = ""
// allow_methods = ""
// allow_origins = ""
// expose_headers = ""
// max_age = 3600
// }

depends_on = []
}

module "api_gateway_stage_staging_firehose" {
source = "[email protected]:sebastianua/terraform.git//aws/modules/apigatewayv2?ref=dev"

providers = {
aws = aws.default
}

name = "test-api-gateway-staging-firehose"
environment = "staging"

// API gateway v2 api stage
enable_apigatewayv2_stage = true
apigatewayv2_stage_name = "firehose"
apigatewayv2_stage_auto_deploy = true
apigatewayv2_stage_api_id = module.api_gateway_staging_firehose.apigatewayv2_api_id

depends_on = [
module.api_gateway_staging_firehose
]
}

module "api_gateway_route_staging_firehose" {
source = "[email protected]:sebastianua/terraform.git//aws/modules/apigatewayv2?ref=dev"

providers = {
aws = aws.default
}

name = "test-api-gateway-staging-firehose"
environment = "staging"

// API gateway route
enable_apigatewayv2_route = true
apigatewayv2_route_route_key = "ANY /firehose"
apigatewayv2_stage_auto_deploy = false
apigatewayv2_route_api_id = module.api_gateway_staging_firehose.apigatewayv2_api_id

apigatewayv2_route_target = "integrations/${module.api_gateway_integration_staging_firehose.apigatewayv2_integration_id}"

depends_on = [
module.api_gateway_staging_firehose,
module.api_gateway_integration_staging_firehose
]
}

module "api_gateway_domain_name_staging_firehose" {
source = "[email protected]:sebastianua/terraform.git//aws/modules/apigatewayv2?ref=dev"

providers = {
aws = aws.default
}

name = "test-api-gateway-staging-firehose"
environment = "staging"

// API gateway v2 api domain name
enable_apigatewayv2_domain_name = true
apigatewayv2_domain_name_domain_name = "firehose.internal.test.io"
apigatewayv2_domain_name_domain_name_configuration = {
certificate_arn = "arn:aws:acm:us-east-1:${data.aws_caller_identity.default.account_id}:certificate/802132ce-c944-4e44-8365-8fd8d7616aab"
endpoint_type = "REGIONAL"
security_policy = "TLS_1_2"
}

depends_on = []
}

module "api_gateway_integration_staging_firehose" {
source = "[email protected]:sebastianua/terraform.git//aws/modules/apigatewayv2?ref=dev"

providers = {
aws = aws.default
}

name = "test-api-gateway-staging-firehose"
environment = "staging"

// API gateway integration
enable_apigatewayv2_integration = true
apigatewayv2_integration_integration_type = "AWS_PROXY" // "PROXY" // "AWS" // "HTTP_PROXY" // "AWS_PROXY"

apigatewayv2_integration_connection_type = "INTERNET"
apigatewayv2_integration_description = "Lambda firehose"
apigatewayv2_integration_integration_method = "ANY" # "POST"
apigatewayv2_integration_integration_uri = data.terraform_remote_state.testio_lambda_staging_firehose.outputs.lambda_staging_firehose_lambda_function_arn
apigatewayv2_integration_api_id = module.api_gateway_staging_firehose.apigatewayv2_api_id

depends_on = [
module.api_gateway_staging_firehose
]
}

module "api_gateway_authorizer_staging_firehose" {
source = "[email protected]:sebastianua/terraform.git//aws/modules/apigatewayv2?ref=dev"

providers = {
aws = aws.default
}

name = "test-api-gateway-staging-firehose"
environment = "staging"

// API gateway authorizer
enable_apigatewayv2_authorizer = true
apigatewayv2_authorizer_name = ""
apigatewayv2_authorizer_api_id = module.api_gateway_staging_firehose.apigatewayv2_api_id

apigatewayv2_authorizer_authorizer_type = "REQUEST"
apigatewayv2_authorizer_authorizer_uri = data.terraform_remote_state.testio_lambda_staging_firehose.outputs.lambda_staging_firehose_lambda_invoke_arn
apigatewayv2_authorizer_identity_sources = []
apigatewayv2_authorizer_authorizer_result_ttl_in_seconds = 0
apigatewayv2_authorizer_authorizer_payload_format_version = "2.0"

depends_on = [
data.terraform_remote_state.testio_lambda_staging_firehose,
module.api_gateway_staging_firehose
]
}

// not working fine for now
module "api_gateway_deployment_staging_firehose" {
source = "[email protected]:sebastianua/terraform.git//aws/modules/apigatewayv2?ref=dev"

providers = {
aws = aws.default
}

name = "test-api-gateway-staging-firehose"
environment = "staging"

// API gateway deployment
enable_apigatewayv2_deployment = true
apigatewayv2_deployment_description = "Firehose deployment"
apigatewayv2_deployment_triggers = {}
apigatewayv2_deployment_api_id = module.api_gateway_staging_firehose.apigatewayv2_api_id

depends_on = [
module.api_gateway_staging_firehose
]
}

#---------------------------------------------------------------
# lambda trigger for Firehose
#---------------------------------------------------------------
module "lambda_staging_firehose_trigger" {
source = "[email protected]:sebastianua/terraform.git//aws/modules/lambda?ref=dev"

providers = {
aws = aws.default
}

name = "test-lambda-firehose"
environment = "staging"

enable_lambda_permission = true
lambda_permission_function_name = "test-lambda-staging-firehose"
lambda_permission_source_arn = "arn:aws:execute-api:${data.aws_region.default.name}:${data.aws_caller_identity.default.account_id}:${module.api_gateway_staging_firehose.apigatewayv2_api_id}/default/*"

lambda_permission_action = "lambda:InvokeFunction"
lambda_permission_principal = "apigateway.amazonaws.com"

tags = tomap({
"Environment" = "staging",
"Createdby" = "Vitaliy Natarov",
"Orchestration" = "Terraform"
})

depends_on = [
module.api_gateway_staging_firehose
]
}

#---------------------------------------------------------------
# Route53 for Firehose
#---------------------------------------------------------------
module "route53_lambda_staging_firehose" {
source = "[email protected]:sebastianua/terraform.git//aws/modules/route53?ref=dev"

# Route53 alias
enable_route53_record = true
route53_record_parent_zone_id = "Z16BИТIERZ9NH6" # internal.test.io
route53_record_type = "A"
route53_record_name = module.api_gateway_domain_name_staging_firehose.apigatewayv2_domain_name_domain_name
route53_record_records = null
route53_record_alias = [
{
name = module.api_gateway_domain_name_staging_firehose.apigatewayv2_domain_name_domain_name_configuration[0][0]["target_domain_name"]
zone_id = module.api_gateway_domain_name_staging_firehose.apigatewayv2_domain_name_domain_name_configuration[0][0]["hosted_zone_id"]
evaluate_target_health = false
}
]

tags = tomap({
"Environment" = "staging",
"Createdby" = "Vitaliy Natarov",
"Orchestration" = "Terraform"
})

depends_on = [
module.api_gateway_domain_name_staging_firehose
]
}
21 changes: 16 additions & 5 deletions aws/examples/asg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,24 @@ module "asg" {
lc_enable_monitoring = "true"
lc_placement_tenancy = "default"
lc_root_block_device = [
lc_root_block_device = {
volume_size = 8
volume_type = "gp3"
}
lc_ebs_block_device = [
{
volume_size = "8"
volume_type = "gp2"
},
device_name = "/dev/sdm"
volume_size = 50
volume_type = "gp3"
delete_on_termination = null
encrypted = null
iops = null
}
]
lc_associate_public_ip_address = null
# asg
Expand Down Expand Up @@ -172,7 +183,7 @@ module "asg" {
- `lc_spot_price` - (Optional; Default: On-demand price) The maximum price to use for reserving spot instances. (`default = null`)
- `lc_ebs_optimized` - (Optional) If true, the launched EC2 instance will be EBS-optimized. (`default = null`)
- `lc_ebs_block_device` - Additional EBS block devices to attach to the instance (`default = []`)
- `lc_root_block_device` - Customize details about the root block device of the instance. See Block Devices below for details (`default = []`)
- `lc_root_block_device` - Customize details about the root block device of the instance. See Block Devices below for details (`default = {}`)
- `lc_ephemeral_block_device` - Customize Ephemeral (also known as Instance Store) volumes on the instance (`default = []`)
- `enable_lt` - Enable ASG with launch_template (`default = False`)
- `lt_name` - The name of the launch template. If you leave this blank, Terraform will auto-generate a unique name. (`default = ""`)
Expand Down
Loading

0 comments on commit af979b4

Please sign in to comment.