Skip to content

Commit 316a11f

Browse files
committed
add example
1 parent d884cda commit 316a11f

File tree

4 files changed

+96
-0
lines changed

4 files changed

+96
-0
lines changed

example/common.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
##################################################
2+
# Provider/Backend/Workspace Check
3+
##################################################
4+
provider "aws" {
5+
region = var.region
6+
}
7+
8+
terraform {
9+
required_version = ">= 0.12.25"
10+
required_providers {
11+
aws = "~> 2.61.0"
12+
}
13+
}
14+
15+
variable "owner" {
16+
description = "Team/person responsible for resources defined within this project"
17+
type = string
18+
}
19+
20+
variable "region" {
21+
description = "Region resources are being deployed to"
22+
type = string
23+
}

example/global.auto.tfvars

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
# Project defaults
3+
region = "us-east-1"
4+
owner = "test"
5+

example/main.tf

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
data "aws_caller_identity" "current" {
2+
}
3+
4+
locals {
5+
account_id = data.aws_caller_identity.current.account_id
6+
tags = module.tags.tags_no_name
7+
}
8+
9+
module "tags" {
10+
source = "git::https://github.com/rhythmictech/terraform-terraform-tags.git?ref=v1.0.0"
11+
12+
names = [
13+
"smiller",
14+
"imagebuilder-test"
15+
]
16+
17+
tags = merge({
18+
"Env" = "test"
19+
"Namespace" = "smiller"
20+
"notes" = "Testing only - Can be safely deleted"
21+
"Owner" = var.owner
22+
}, var.additional_tags)
23+
}
24+
25+
module "test-component" {
26+
source = "git::https://github.com/rhythmictech/terraform-aws-imagebuilder-component-ansible.git?ref=init"
27+
28+
component_version = "1.0.0"
29+
description = "Testing component"
30+
name = "testing-component"
31+
playbook_dir = "packer-generic-images/base"
32+
playbook_repo = "https://github.com/rhythmictech/packer-generic-images.git"
33+
tags = local.tags
34+
}
35+
36+
module "test-recipe" {
37+
source = "git::https://github.com/rhythmictech/terraform-aws-imagebuilder-recipe.git?ref=init"
38+
39+
description = "Testing recipe"
40+
name = "test-recipe"
41+
parent_image = "arn:aws:imagebuilder:us-east-1:aws:image/amazon-linux-2-x86/x.x.x"
42+
recipe_version = "1.0.0"
43+
tags = local.tags
44+
update = true
45+
46+
components = [
47+
module.test-component.component_arn,
48+
"arn:aws:imagebuilder:us-east-1:aws:component/simple-boot-test-linux/1.0.0/1",
49+
"arn:aws:imagebuilder:us-east-1:aws:component/reboot-test-linux/1.0.0/1"
50+
]
51+
}
52+
53+
module "test-pipeline" {
54+
source = "git::https://github.com/rhythmictech/terraform-aws-imagebuilder-pipeline.git?ref=init"
55+
56+
description = "Testing pipeline"
57+
name = "test-pipeline"
58+
tags = local.tags
59+
recipe_arn = module.test-recipe.recipe_arn
60+
}

example/variables.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
########################################
2+
# General Vars
3+
########################################
4+
variable "additional_tags" {
5+
default = {}
6+
description = "Additional tags to add to supported resources"
7+
type = map(string)
8+
}

0 commit comments

Comments
 (0)