Skip to content

Commit

Permalink
Add initial files
Browse files Browse the repository at this point in the history
Add describe and start ec2 instance pipelines

fix names and add param

support multiple instances

json decode output

Update EC2 pipelines and var names (#1)

Fix param and step name references

Remove unnecessary null check on list(string) param

Add modify_rds_db_instance

Add list_s3_buckets pipeline

Add tag_resources pipeline

feat: update_s3_bucket_versioning pipeline

rds fixes

work-around: added defaults to vars to work-around a parse validation error

refactor: get raw stdout/stderr

Add untag_resources pipeline

Add titles, fix spacing, update descriptions

lots of changes

moving rds to its folder

add backup_retention_period to rds

add create_iam_role

Add descriptions to pipelines

Added pipeline to list groups for a user

create_iam_policy

Add start_ec2_instances pipeline

Updated the List Groups by User pipeline and param description

attach_role_policy

Add put_role_policy

add_role_inline_policy

Added session token support

Add library mod for aws-ec2.

add pipeline for deleting security group rules

fix s3 reference in security group pipeline

Added list users pipeline

Writen read s3 file

Rename IAM pipelines, add output descriptions

Updated the list users pipeline

Updated the output variable and its description

iam instance profile

vpc create and describe

remove non defaults values from read_s3_file

describe_subnets

modify_ec2_instance_metadata_options

renaming files

fix typo

put_s3_bucket_encryption

updating pipeline names

update_s3_public_access_block

Add S3 bucket create and delete pipelines with tests, update var descriptions

Add test_update_s3_bucket_versioning and update outputs in test_create_s3_bucket

Move S3 tests

Cleanup in S3 test files

add params to s3 bucket

create_subnet

Renaming bucket_name parameter to bucket to match aws-cli

Add EBS default encryption and modify volume pipelines (#2)

Add missing quote

Rename update_s3_public_access_block and add get_s3_bucket_versioning pipeline

Add more check steps to test_update_s3_bucket_versioning

update description for aws-ec2 pipelines.

Updated title and descriptions.

Add minor comments to test

Fix outputs in test_update_s3_bucket_versioning pipeline

create ec2 instance

add terminate_ec2_instances and test create

rename security group rule revocation

update pipeline descriptions

Fix revoke_security_group_ingress_rule pipeline name

Update S3 tests to use hardcoded us-east-1 region

Add TODO around location to create_s3_bucket

write documentation

moving docs to root

add test_modify_ec2_instance_metadata_options

snapshot pipelines

Code cleanup

elb, lambda, sns, sqs, vpc pipelines
  • Loading branch information
luisffc committed Nov 7, 2023
1 parent b448fa5 commit e60fb2d
Show file tree
Hide file tree
Showing 24 changed files with 1,178 additions and 2 deletions.
1 change: 1 addition & 0 deletions locals.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ locals {
access_key_id_param_description = "The ID for this access key."
region_param_description = "The name of the Region."
secret_access_key_param_description = "The secret key used to sign requests."
session_token_param_description = "The session token that identifies the federated user session."
}
51 changes: 51 additions & 0 deletions pipelines/ebs/create_ec2_snapshot.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
pipeline "create_ec2_snapshot" {
title = "Create EC2 Snapshot"
description = "Creates a snapshot of the specified EBS volume."

param "region" {
type = string
description = "The name of the Region."
default = var.region
}

param "access_key_id" {
type = string
description = "The ID for this access key."
default = var.access_key_id
}

param "secret_access_key" {
type = string
description = "The secret key used to sign requests."
default = var.secret_access_key
}

param "volume_id" {
type = string
description = "The ID of the EBS volume to create a snapshot of."
}

step "container" "create_ec2_snapshot" {
image = "amazon/aws-cli"

cmd = concat(
["ec2", "create-snapshot", "--volume-id", param.volume_id]
)

env = {
AWS_REGION = param.region
AWS_ACCESS_KEY_ID = param.access_key_id
AWS_SECRET_ACCESS_KEY = param.secret_access_key
}
}

output "stdout" {
description = "The standard output stream from the AWS CLI."
value = jsondecode(step.container.create_ec2_snapshot.stdout)
}

output "stderr" {
description = "The standard error stream from the AWS CLI."
value = step.container.create_ec2_snapshot.stderr
}
}
52 changes: 52 additions & 0 deletions pipelines/ebs/delete_ec2_snapshot.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
pipeline "delete_ec2_snapshot" {
title = "Delete EC2 Snapshot"
description = "Deletes an Amazon EC2 snapshot."

param "region" {
type = string
description = "The name of the region."
default = var.region
}

param "access_key_id" {
type = string
description = "The ID for this access key."
default = var.access_key_id
}

param "secret_access_key" {
type = string
description = "The secret key used to sign requests."
default = var.secret_access_key
}

param "snapshot_id" {
type = string
description = "The ID of the EC2 snapshot to delete."
}

step "container" "delete_ec2_snapshot" {
image = "amazon/aws-cli"

cmd = [
"ec2", "delete-snapshot",
"--snapshot-id", param.snapshot_id,
]

env = {
AWS_REGION = param.region,
AWS_ACCESS_KEY_ID = param.access_key_id,
AWS_SECRET_ACCESS_KEY = param.secret_access_key
}
}

output "stdout" {
description = "The standard output stream from the AWS CLI."
value = jsondecode(step.container.delete_ec2_snapshot.stdout)
}

output "stderr" {
description = "The standard error stream from the AWS CLI."
value = step.container.delete_ec2_snapshot.stderr
}
}
67 changes: 67 additions & 0 deletions pipelines/ebs/describe_ec2_snapshots.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
pipeline "describe_ec2_snapshots" {
title = "Describe EC2 Snapshots"
description = "Describes the specified EBS snapshots or all available snapshots."

param "region" {
type = string
description = "The name of the region."
default = var.region
}

param "access_key_id" {
type = string
description = "The ID for this access key."
default = var.access_key_id
}

param "secret_access_key" {
type = string
description = "The secret key used to sign requests."
default = var.secret_access_key
}

param "snapshot_ids" {
type = list(string)
description = "The snapshot IDs."
optional = true
}

param "owner_ids" {
type = list(string)
description = "Filter results by the IDs of the AWS accounts that own the snapshots."
optional = true
}

param "volume_ids" {
type = list(string)
description = "Filter results by the IDs of the EBS volumes associated with the snapshots."
optional = true
}

step "container" "describe_ec2_snapshots" {
image = "amazon/aws-cli"

cmd = concat(
["ec2", "describe-snapshots"],
try(length(param.snapshot_ids), 0) > 0 ? concat(["--snapshot-ids"], param.snapshot_ids) : [],
try(length(param.owner_ids), 0) > 0 ? concat(["--owner-ids"], param.owner_ids) : [],
try(length(param.volume_ids), 0) > 0 ? concat(["--filter", "Name=volume-id,Values=${param.volume_ids}"]) : []
)

env = {
AWS_REGION = param.region
AWS_ACCESS_KEY_ID = param.access_key_id
AWS_SECRET_ACCESS_KEY = param.secret_access_key
}
}

output "stdout" {
description = "The standard output stream from the AWS CLI."
value = jsondecode(step.container.describe_ec2_snapshots.stdout)
}

output "stderr" {
description = "The standard error stream from the AWS CLI."
value = step.container.describe_ec2_snapshots.stderr
}
}
64 changes: 64 additions & 0 deletions pipelines/elb/create_elb_classic_load_balancer.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
pipeline "create_elb_classic_load_balancer" {
title = "Create ELB Classic Load Balancer"
description = "Creates an classic load balancer."

param "region" {
type = string
description = "The name of the region."
default = var.region
}

param "access_key_id" {
type = string
description = "The ID for this access key."
default = var.access_key_id
}

param "secret_access_key" {
type = string
description = "The secret key used to sign requests."
default = var.secret_access_key
}

param "name" {
type = string
description = "The name for the load balancer."
}

param "listeners" {
type = list(map(string))
description = "A list of listener configurations. Each listener configuration should include 'Protocol', 'LoadBalancerPort', 'InstanceProtocol', and 'InstancePort'."
}

param "availability_zones" {
type = list(string)
description = "A list of availability zones to associate with the load balancer."
}

step "container" "create_elb_classic_load_balancer" {
image = "amazon/aws-cli"

cmd = concat(
["elb", "create-load-balancer"],
["--load-balancer-name", param.name],
flatten([for listener in param.listeners : ["--listener", jsonencode(listener)]]),
["--availability-zones", join(",", param.availability_zones)]
)

env = {
AWS_REGION = param.region
AWS_ACCESS_KEY_ID = param.access_key_id
AWS_SECRET_ACCESS_KEY = param.secret_access_key
}
}

output "stdout" {
description = "The standard output stream from the AWS CLI."
value = jsondecode(step.container.create_elb_classic_load_balancer.stdout)
}

output "stderr" {
description = "The standard error stream from the AWS CLI."
value = step.container.create_elb_classic_load_balancer.stderr
}
}
64 changes: 64 additions & 0 deletions pipelines/elb/create_elb_load_balancer.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
pipeline "create_elb_load_balancer" {
title = "Create ELB Load Balancer"
description = "Creates a load balancer (application, network or gateway)."

param "region" {
type = string
description = "The name of the region."
default = var.region
}

param "access_key_id" {
type = string
description = "The ID for this access key."
default = var.access_key_id
}

param "secret_access_key" {
type = string
description = "The secret key used to sign requests."
default = var.secret_access_key
}

param "name" {
type = string
description = "The name for the load balancer."
}

param "type" {
type = string
description = "The type of load balancer (e.g., 'application' for Application Load Balancer, 'network' for Network Load Balancer)."
}

param "availability_zones" {
type = list(string)
description = "A list of availability zones to associate with the load balancer."
}

step "container" "create_elb_load_balancer" {
image = "amazon/aws-cli"

cmd = concat(
["elbv2", "create-load-balancer"],
["--name", param.name],
["--type", param.type],
flatten([for az in param.availability_zones : ["--availability-zones", az]])
)

env = {
AWS_REGION = param.region
AWS_ACCESS_KEY_ID = param.access_key_id
AWS_SECRET_ACCESS_KEY = param.secret_access_key
}
}

output "stdout" {
description = "The standard output stream from the AWS CLI."
value = jsondecode(step.container.create_elb_load_balancer.stdout)
}

output "stderr" {
description = "The standard error stream from the AWS CLI."
value = step.container.create_elb_load_balancer.stderr
}
}
52 changes: 52 additions & 0 deletions pipelines/elb/delete_elb_load_balancer.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
pipeline "delete_elb_load_balancer" {
title = "Delete Elastic Load Balancer"
description = "Deletes an Amazon ELB (Elastic Load Balancer)."

param "region" {
type = string
description = "The name of the Region."
default = var.region
}

param "access_key_id" {
type = string
description = "The ID for this access key."
default = var.access_key_id
}

param "secret_access_key" {
type = string
description = "The secret key used to sign requests."
default = var.secret_access_key
}

param "load_balancer_name" {
type = string
description = "The name of the load balancer to delete."
}

step "container" "delete_elb_load_balancer" {
image = "amazon/aws-cli"

cmd = [
"elb", "delete-load-balancer",
"--load-balancer-name", param.load_balancer_name,
]

env = {
AWS_REGION = param.region,
AWS_ACCESS_KEY_ID = param.access_key_id,
AWS_SECRET_ACCESS_KEY = param.secret_access_key
}
}

output "stdout" {
description = "The standard output stream from the AWS CLI."
value = step.container.delete_elb_load_balancer.stdout
}

output "stderr" {
description = "The standard error stream from the AWS CLI."
value = step.container.delete_elb_load_balancer.stderr
}
}
Loading

0 comments on commit e60fb2d

Please sign in to comment.