Skip to content

Commit

Permalink
fix names and add param
Browse files Browse the repository at this point in the history
  • Loading branch information
luisffc committed Oct 16, 2023
1 parent 16ca61f commit 42fd413
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 25 deletions.
20 changes: 0 additions & 20 deletions pipelines/ec2/describe_ec2_instance.hcl

This file was deleted.

40 changes: 40 additions & 0 deletions pipelines/ec2/describe_ec2_instances.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
pipeline "describe_ec2_instances" {
# Credentials
param "aws_region" {
type = string
description = "AWS Region"
default = var.aws_region
}

param "aws_access_key_id" {
type = string
description = "AWS Access Key ID"
default = var.aws_access_key_id
}

param "aws_secret_access_key" {
type = string
description = "AWS Secret Access Key"
default = var.aws_secret_access_key
}

param "instance_id" {
type = string
}

step "container" "container_run_aws" {
image = "amazon/aws-cli"
cmd = ["ec2", "describe-instances", "--instance-ids", param.instance_id]
env = {
AWS_REGION = param.aws_region
AWS_ACCESS_KEY_ID = param.aws_access_key_id
AWS_SECRET_ACCESS_KEY = param.aws_secret_access_key
}
}
output "stdout" {
value = step.container.container_run_aws.stdout
}
output "stderr" {
value = step.container.container_run_aws.stderr
}
}
30 changes: 25 additions & 5 deletions pipelines/ec2/start_ec2_instance.hcl
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
pipeline "describe_ec2_instance" {
pipeline "start_ec2_instance" {
# Credentials
param "aws_region" {
type = string
description = "AWS Region"
default = var.aws_region
}

param "aws_access_key_id" {
type = string
description = "AWS Access Key ID"
default = var.aws_access_key_id
}

param "aws_secret_access_key" {
type = string
description = "AWS Secret Access Key"
default = var.aws_secret_access_key
}

param "instance_id" {
type = string
}

step "container" "container_run_aws" {
image = "amazon/aws-cli"
cmd = ["ec2", "describe-instances", "--instance-ids", param.instance_id]
cmd = ["ec2", "start-instances", "--instance-ids", param.instance_id]
env = {
AWS_REGION = var.aws_region
AWS_ACCESS_KEY_ID = var.aws_access_key_id
AWS_SECRET_ACCESS_KEY = var.aws_secret_access_key
AWS_REGION = param.aws_region
AWS_ACCESS_KEY_ID = param.aws_access_key_id
AWS_SECRET_ACCESS_KEY = param.aws_secret_access_key
}
}
output "stdout_aws" {
Expand Down

0 comments on commit 42fd413

Please sign in to comment.