-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update EC2 pipelines and var names (#1)
- Loading branch information
Showing
3 changed files
with
63 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,63 @@ | ||
pipeline "describe_ec2_instances" { | ||
# Credentials | ||
param "aws_region" { | ||
|
||
param "region" { | ||
type = string | ||
description = "AWS Region" | ||
default = var.aws_region | ||
description = "The name of the Region." | ||
default = var.region | ||
} | ||
|
||
param "aws_access_key_id" { | ||
param "access_key_id" { | ||
type = string | ||
description = "AWS Access Key ID" | ||
default = var.aws_access_key_id | ||
description = "The ID for this access key." | ||
default = var.access_key_id | ||
} | ||
|
||
param "aws_secret_access_key" { | ||
param "secret_access_key" { | ||
type = string | ||
description = "AWS Secret Access Key" | ||
default = var.aws_secret_access_key | ||
description = "The secret key used to sign requests." | ||
default = var.secret_access_key | ||
} | ||
|
||
param "instance_ids" { | ||
type = list(string) | ||
type = list(string) | ||
description = "The instance IDs." | ||
optional = true | ||
} | ||
|
||
param "instance_type" { | ||
type = string | ||
description = "The type of instance (for example, t2.micro)." | ||
optional = true | ||
} | ||
|
||
param "filter" { | ||
type = string | ||
optional = true | ||
param "ebs_optimized" { | ||
type = bool | ||
description = "A Boolean that indicates whether the instance is optimized for Amazon EBS I/O." | ||
optional = true | ||
} | ||
|
||
step "container" "container_run_aws" { | ||
image = "amazon/aws-cli" | ||
step "container" "describe_ec2_instances" { | ||
image = "amazon/aws-cli" | ||
|
||
cmd = concat([ | ||
"ec2", | ||
"describe-instances", | ||
## TODO next step is to only include instance-ids if any are provided | ||
"--instance-ids", | ||
], param.instance_ids) | ||
cmd = concat( | ||
["ec2", "describe-instances"], | ||
param.instance_ids != null && length(param.instance_ids) > 0 ? concat(["--instance-ids"], param.instance_ids) : [], | ||
param.instance_type != null ? ["--filters", "Name=instance-type,Values=${param.instance_type}"] : [], | ||
param.ebs_optimized != null ? ["--filters", "Name=ebs-optimized,Values=${param.ebs_optimized}"] : [] | ||
) | ||
|
||
env = { | ||
AWS_REGION = param.aws_region | ||
AWS_ACCESS_KEY_ID = param.aws_access_key_id | ||
AWS_SECRET_ACCESS_KEY = param.aws_secret_access_key | ||
} | ||
env = { | ||
AWS_REGION = param.region | ||
AWS_ACCESS_KEY_ID = param.access_key_id | ||
AWS_SECRET_ACCESS_KEY = param.secret_access_key | ||
} | ||
} | ||
|
||
output "stdout" { | ||
value = jsondecode(step.container.container_run_aws.stdout) | ||
value = jsondecode(step.container.container_run_aws.stdout) | ||
} | ||
|
||
output "stderr" { | ||
value = jsondecode(step.container.container_run_aws.stderr) | ||
value = jsondecode(step.container.container_run_aws.stderr) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
variable "aws_region" { | ||
variable "region" { | ||
type = string | ||
description = "AWS Region" | ||
description = "The name of the Region." | ||
} | ||
|
||
variable "aws_access_key_id" { | ||
variable "access_key_id" { | ||
type = string | ||
description = "AWS Access Key ID" | ||
description = "The ID for this access key." | ||
} | ||
|
||
variable "aws_secret_access_key" { | ||
variable "secret_access_key" { | ||
type = string | ||
description = "AWS Secret Access Key" | ||
description = "The secret key used to sign requests." | ||
} |