diff --git a/stackgen_iac/terraform/.gitignore b/stackgen_iac/terraform/.gitignore new file mode 100644 index 0000000..05b2a76 --- /dev/null +++ b/stackgen_iac/terraform/.gitignore @@ -0,0 +1,32 @@ +# Source: https://github.com/github/gitignore/blob/main/Terraform.gitignore +# Local .terraform directories +**/.terraform/* + +# .tfstate files +*.tfstate +*.tfstate.* + +# Crash log files +crash.log +crash.*.log + +# Ignore override files as they are usually used to override resources locally and so +# are not checked in +override.tf +override.tf.json +*_override.tf +*_override.tf.json + +# Ignore transient lock info files created by terraform apply +.terraform.tfstate.lock.info + +# Include override files you do wish to add to version control using negated pattern +# !example_override.tf + +# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan +# example: *tfplan* + +# Ignore CLI configuration files +.terraformrc +terraform.rc + diff --git a/stackgen_iac/terraform/.metadata b/stackgen_iac/terraform/.metadata new file mode 100644 index 0000000..7269eb2 --- /dev/null +++ b/stackgen_iac/terraform/.metadata @@ -0,0 +1,7 @@ +{ + "app_stack_name": "untitled-appStack-2fb49a54", + "iac_type": "Terraform", + "provider": "aws", + "multi_env": false, + "exporter": "terraform" +} \ No newline at end of file diff --git a/stackgen_iac/terraform/README.md b/stackgen_iac/terraform/README.md new file mode 100644 index 0000000..6c91fab --- /dev/null +++ b/stackgen_iac/terraform/README.md @@ -0,0 +1,3 @@ +# README +This is a readme file for IaC generated with StackGen. +You can modify your appStack -> [here](http://appcd.local/appstacks/60b59299-441d-4c9f-9bbe-fd973f74b4b4) diff --git a/stackgen_iac/terraform/main.tf b/stackgen_iac/terraform/main.tf new file mode 100644 index 0000000..e20dacd --- /dev/null +++ b/stackgen_iac/terraform/main.tf @@ -0,0 +1,7 @@ +module "stackgen_16cb0083-c1d1-44e9-a26b-6fbcf0206dea" { + source = "./modules/aws_api_gateway_http_api" + name = "demo" + stage_name = "dev" + tags = {} +} + diff --git a/stackgen_iac/terraform/modules/aws_api_gateway_http_api/aws_api_gateway_http_api.tf b/stackgen_iac/terraform/modules/aws_api_gateway_http_api/aws_api_gateway_http_api.tf new file mode 100644 index 0000000..64d22a4 --- /dev/null +++ b/stackgen_iac/terraform/modules/aws_api_gateway_http_api/aws_api_gateway_http_api.tf @@ -0,0 +1,15 @@ +resource "aws_apigatewayv2_api" "this" { + name = var.name + protocol_type = "HTTP" + tags = var.tags +} + +resource "aws_apigatewayv2_stage" "this" { + api_id = aws_apigatewayv2_api.this.id + name = var.stage_name + auto_deploy = true +} + + + + diff --git a/stackgen_iac/terraform/modules/aws_api_gateway_http_api/outputs.tf.json b/stackgen_iac/terraform/modules/aws_api_gateway_http_api/outputs.tf.json new file mode 100644 index 0000000..152886f --- /dev/null +++ b/stackgen_iac/terraform/modules/aws_api_gateway_http_api/outputs.tf.json @@ -0,0 +1,14 @@ +{ + "output": { + "apigateway_id": { + "description": "The value of the apigateway_id output", + "sensitive": false, + "value": "${aws_apigatewayv2_api.this.id}" + }, + "arn": { + "description": "The value of the arn output", + "sensitive": false, + "value": "${aws_apigatewayv2_api.this.arn}" + } + } +} \ No newline at end of file diff --git a/stackgen_iac/terraform/modules/aws_api_gateway_http_api/variables.tf.json b/stackgen_iac/terraform/modules/aws_api_gateway_http_api/variables.tf.json new file mode 100644 index 0000000..aac4e29 --- /dev/null +++ b/stackgen_iac/terraform/modules/aws_api_gateway_http_api/variables.tf.json @@ -0,0 +1,26 @@ +{ + "variable": { + "name": [ + { + "description": "The name of the API", + "nullable": false, + "type": "string" + } + ], + "stage_name": [ + { + "default": "dev", + "description": "The name of the stage", + "nullable": false, + "type": "string" + } + ], + "tags": [ + { + "description": "A map of tags to add to all resources", + "type": "map(string)", + "nullable": true + } + ] + } +} diff --git a/stackgen_iac/terraform/outputs.tf b/stackgen_iac/terraform/outputs.tf new file mode 100644 index 0000000..6804ba4 --- /dev/null +++ b/stackgen_iac/terraform/outputs.tf @@ -0,0 +1,13 @@ +output "aws_api_gateway_http_api_stackgen_16cb0083-c1d1-44e9-a26b-6fbcf0206dea_apigateway_id" { + value = module.stackgen_16cb0083-c1d1-44e9-a26b-6fbcf0206dea.apigateway_id + sensitive = false +} + +output "aws_api_gateway_http_api_stackgen_16cb0083-c1d1-44e9-a26b-6fbcf0206dea_arn" { + value = module.stackgen_16cb0083-c1d1-44e9-a26b-6fbcf0206dea.arn + sensitive = false +} + + +################################################################################ + diff --git a/stackgen_iac/terraform/provider.tf b/stackgen_iac/terraform/provider.tf new file mode 100644 index 0000000..f411dbd --- /dev/null +++ b/stackgen_iac/terraform/provider.tf @@ -0,0 +1,23 @@ +terraform { + required_version = ">= 1.0.0, < 2.0.0" + + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 5.0" + } + + awscc = { // AWS Cloud Control + source = "hashicorp/awscc" + version = "~> 1.0" + } + } +} + +provider "awscc" { + region = var.region +} + +provider "aws" { + region = var.region +} diff --git a/stackgen_iac/terraform/variables.tf b/stackgen_iac/terraform/variables.tf new file mode 100644 index 0000000..8075d7f --- /dev/null +++ b/stackgen_iac/terraform/variables.tf @@ -0,0 +1,3 @@ +variable "region" { + description = "AWS region in which the project needs to be setup (us-east-1, ca-west-1, eu-west-3, etc)" +}