Skip to content

hellokity #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions infra/terraform/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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

# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json

# 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
3 changes: 3 additions & 0 deletions infra/terraform/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# README
This is a readme file for IaC generated with appCD.
You can modify your appStack -> [here](http://cloud.stackgen.com/appstacks/79b6128e-55c9-4866-b3bd-5e987ad12e89)
84 changes: 84 additions & 0 deletions infra/terraform/modules.tf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"module": {
"appcd_00a20b0a-2ec0-5bdc-a08d-65a85dc81d5b": {
"architecture": "x86_64",
"authorization_type": "NONE",
"cors": [],
"create_function_url": true,
"description": null,
"environment_variables": {
"IMAGES_BUCKET": "leodavis9344"
},
"event_source_arn": null,
"event_source_mapping": [],
"filename": null,
"function_name": "hello-kitty-function-leodavis9344",
"handler": "main.lambda_handler",
"log_format": null,
"log_group_name": "${module.appcd_86ec452a-770a-59bf-87dd-67ed883e25e5.name}",
"memory_size": 128,
"role": "${module.appcd_b71fd16c-797e-5a95-8e1b-ab22f1e34f43.arn}",
"runtime": "python3.8",
"s3_bucket": "stackgen-builds",
"s3_key": "build/app.zip",
"s3_object_version": null,
"source": "./modules/aws_lambda",
"system_log_level": null,
"tags": {
"appstack": "hello-kittyy",
"component": "hello-kitty"
},
"timeout": 3
},
"appcd_551e1d2b-88ec-5406-87cf-c51521bbe894": {
"block_public_access": true,
"bucket_name": "leodavis9344",
"bucket_policy": "",
"enable_versioning": true,
"enable_website_configuration": false,
"source": "./modules/aws_s3",
"sse_algorithm": "aws:kms",
"tags": {
"appstack": "hello-kittyy",
"component": "hello-kitty"
},
"website_error_document": "404.html",
"website_index_document": "index.html"
},
"appcd_7d6a4095-5599-4601-af7e-02c91a095ada": {
"name": "aws_s3-hello-kitty-policy",
"policy": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"AllowKmsAccess\",\n \"Action\": [\n \"kms:Decrypt\",\n \"kms:Encrypt\",\n \"kms:GenerateDataKey\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"${module.appcd_551e1d2b-88ec-5406-87cf-c51521bbe894.kms_arn}\"\n ]\n },\n {\n \"Sid\": \"hellokittyIMAGESBUCKETS3Bucket551e1d2b88ec540687cfc51521bbe894\",\n \"Action\": [\n \"s3:PutObject\",\n \"s3:ListBucket\",\n \"s3:GetObject\",\n \"s3:GetObjectVersion\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"${module.appcd_551e1d2b-88ec-5406-87cf-c51521bbe894.arn}\",\n \"${module.appcd_551e1d2b-88ec-5406-87cf-c51521bbe894.arn}/*\"\n ]\n }\n ]\n}",
"role": "${module.appcd_b71fd16c-797e-5a95-8e1b-ab22f1e34f43.name}",
"role_type": "Custom",
"source": "./modules/aws_iam_role_policy"
},
"appcd_86ec452a-770a-59bf-87dd-67ed883e25e5": {
"name": "/aws/lambda/hello-kitty-function-leodavis9344",
"retention_in_days": 7,
"source": "./modules/aws_cloudwatch_log_group",
"tags": {
"appstack": "hello-kittyy",
"component": "hello-kitty"
}
},
"appcd_a3ef0f41-97b7-4f03-a9db-b9ac21e97e7c": {
"name": "Writer",
"policy": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"CloudWatchLogGroup86ec452a770a59bf87dd67ed883e25e50\",\n \"Action\": [\n \"logs:CreateLogGroup\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"${module.appcd_86ec452a-770a-59bf-87dd-67ed883e25e5.arn}\"\n ]\n },\n {\n \"Sid\": \"CloudWatchLogGroup86ec452a770a59bf87dd67ed883e25e51\",\n \"Action\": [\n \"logs:CreateLogStream\",\n \"logs:PutLogEvents\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"${module.appcd_86ec452a-770a-59bf-87dd-67ed883e25e5.arn}:*\"\n ]\n }\n ]\n}",
"role": "${module.appcd_b71fd16c-797e-5a95-8e1b-ab22f1e34f43.name}",
"role_type": "Writer",
"source": "./modules/aws_iam_role_policy"
},
"appcd_b71fd16c-797e-5a95-8e1b-ab22f1e34f43": {
"assume_role_policy": "{\n\t\"Version\": \"2012-10-17\",\n\t\"Statement\": {\n\t\t\"Action\": \"sts:AssumeRole\",\n\t\t\"Effect\": \"Allow\",\n\t\t\"Principal\": {\n\t\t\t\"Service\": \"lambda.amazonaws.com\"\n\t\t}\n\t}\n}",
"description": null,
"force_detach_policies": true,
"inline_policy": [],
"name": "hello-kitty-role-leodavis9344",
"source": "./modules/aws_iam_role",
"tags": {
"appstack": "hello-kittyy",
"component": "hello-kitty"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "aws_cloudwatch_log_group" "this" {
name = var.name
retention_in_days = var.retention_in_days

tags = var.tags
}




14 changes: 14 additions & 0 deletions infra/terraform/modules/aws_cloudwatch_log_group/outputs.tf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"output": {
"arn": {
"description": "The value of the arn output",
"sensitive": false,
"value": "${aws_cloudwatch_log_group.this.arn}"
},
"name": {
"description": "The value of the name output",
"sensitive": false,
"value": "${aws_cloudwatch_log_group.this.name}"
}
}
}
26 changes: 26 additions & 0 deletions infra/terraform/modules/aws_cloudwatch_log_group/variables.tf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"variable": {
"name": [
{
"description": "The name of the log group",
"type": "string"
}
],
"retention_in_days": [
{
"description": "The number of days to retain log events",
"type": "number",
"nullable": true,
"default": 7
}
],
"tags": [
{
"description": "A map of tags to add to all resources",
"default": {},
"type": "map(string)",
"nullable": true
}
]
}
}
17 changes: 17 additions & 0 deletions infra/terraform/modules/aws_iam_role/aws_iam_role.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
resource "aws_iam_role" "this" {
name = var.name
description = var.description
assume_role_policy = var.assume_role_policy

dynamic "inline_policy" {
for_each = var.inline_policy
content {
name = inline_policy.value["name"]
policy = inline_policy.value["policy"]
}
}
force_detach_policies = var.force_detach_policies
tags = var.tags
}


14 changes: 14 additions & 0 deletions infra/terraform/modules/aws_iam_role/outputs.tf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"output": {
"arn": {
"description": "The value of the arn output",
"sensitive": false,
"value": "${aws_iam_role.this.arn}"
},
"name": {
"description": "The value of the name output",
"sensitive": false,
"value": "${aws_iam_role.this.name}"
}
}
}
44 changes: 44 additions & 0 deletions infra/terraform/modules/aws_iam_role/variables.tf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"variable": {
"assume_role_policy": [
{
"description": "The policy that grants an entity permission to assume the role",
"type": "string"
}
],
"description": [
{
"description": "The description of the role",
"nullable": true,
"type": "string"
}
],
"force_detach_policies": [
{
"default": true,
"description": "Specifies to force detaching any policies the role has before destroying it",
"type": "bool"
}
],
"inline_policy": [
{
"description": "The policy document",
"nullable": true,
"type": "list(object({ name: string, policy: string }))"
}
],
"name": [
{
"description": "The name of the role",
"type": "string"
}
],
"tags": [
{
"description": "A mapping of tags to assign to the role",
"nullable": true,
"type": "map(string)"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resource "aws_iam_role_policy" "this" {
name = var.name
role = var.role
policy = var.policy
}
29 changes: 29 additions & 0 deletions infra/terraform/modules/aws_iam_role_policy/variables.tf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"variable": {
"name": [
{
"description": "Name of the Role Policy",
"type": "string"
}
],
"policy": [
{
"description": "JSON formatted inline policy document",
"type": "string"
}
],
"role": [
{
"description": "The name of the IAM role to attach to the policy",
"type": "string"
}
],
"role_type":[
{
"description": "The type of the IAM role to attach to the policy",
"default": "custom",
"type": "string"
}
]
}
}
Loading