|
1 | | -# terraform-terraform-template |
| 1 | +# terraform-aws-component-ansible-setup |
2 | 2 | Template repository for terraform modules. Good for any cloud and any provider. |
3 | 3 |
|
4 | | -[](https://github.com/rhythmictech/terraform-terraform-template/actions?query=workflow%3Atflint+event%3Apush+branch%3Amaster) |
5 | | -[](https://github.com/rhythmictech/terraform-terraform-template/actions?query=workflow%3Atfsec+event%3Apush+branch%3Amaster) |
6 | | -[](https://github.com/rhythmictech/terraform-terraform-template/actions?query=workflow%3Ayamllint+event%3Apush+branch%3Amaster) |
7 | | -[](https://github.com/rhythmictech/terraform-terraform-template/actions?query=workflow%3Amisspell+event%3Apush+branch%3Amaster) |
8 | | -[](https://github.com/rhythmictech/terraform-terraform-template/actions?query=workflow%3Apre-commit-check+event%3Apush+branch%3Amaster) |
| 4 | +[](https://github.com/rhythmictech/terraform-aws-component-ansible-setup/actions?query=workflow%3Atflint+event%3Apush+branch%3Amaster) |
| 5 | +[](https://github.com/rhythmictech/terraform-aws-component-ansible-setup/actions?query=workflow%3Atfsec+event%3Apush+branch%3Amaster) |
| 6 | +[](https://github.com/rhythmictech/terraform-aws-component-ansible-setup/actions?query=workflow%3Ayamllint+event%3Apush+branch%3Amaster) |
| 7 | +[](https://github.com/rhythmictech/terraform-aws-component-ansible-setup/actions?query=workflow%3Amisspell+event%3Apush+branch%3Amaster) |
| 8 | +[](https://github.com/rhythmictech/terraform-aws-component-ansible-setup/actions?query=workflow%3Apre-commit-check+event%3Apush+branch%3Amaster) |
9 | 9 | <a href="https://twitter.com/intent/follow?screen_name=RhythmicTech"><img src="https://img.shields.io/twitter/follow/RhythmicTech?style=social&logo=twitter" alt="follow on Twitter"></a> |
10 | 10 |
|
| 11 | +Terraform module that creates an EC2 Image Builder component with CloudFormation which installs Ansible on Amazon Linux 2 |
| 12 | + |
11 | 13 | ## Example |
12 | | -Here's what using the module will look like |
13 | 14 | ```hcl |
14 | | -module "example" { |
15 | | - source = "rhythmictech/terraform-mycloud-mymodule |
| 15 | +data "aws_caller_identity" "current" { |
| 16 | +} |
| 17 | +
|
| 18 | +locals { |
| 19 | + account_id = data.aws_caller_identity.current.account_id |
| 20 | + tags = module.tags.tags_no_name |
| 21 | +} |
| 22 | +
|
| 23 | +module "tags" { |
| 24 | + source = "rhythmictech/tags" |
| 25 | + version = "~> 1.1.0" |
| 26 | +
|
| 27 | + names = [ |
| 28 | + "smiller", |
| 29 | + "imagebuilder-test" |
| 30 | + ] |
| 31 | +
|
| 32 | + tags = merge({ |
| 33 | + "Env" = "test" |
| 34 | + "Namespace" = "smiller" |
| 35 | + "notes" = "Testing only - Can be safely deleted" |
| 36 | + "Owner" = var.owner |
| 37 | + }, var.additional_tags) |
| 38 | +} |
| 39 | +
|
| 40 | +module "component_ansible_setup" { |
| 41 | + source = "rhythmictech/imagebuilder-component-ansible-setup/aws" |
| 42 | + version = "~> 1.0.0-rc1" |
| 43 | +
|
| 44 | + component_version = "1.0.0" |
| 45 | + description = "Testing ansible setup" |
| 46 | + name = "testing-setup-component" |
| 47 | + tags = local.tags |
16 | 48 | } |
| 49 | +
|
| 50 | +module "test_recipe" { |
| 51 | + source = "rhythmictech/imagebuilder-recipe/aws" |
| 52 | + version = "~> 0.2.0" |
| 53 | +
|
| 54 | + description = "Testing recipe" |
| 55 | + name = "test-recipe" |
| 56 | + parent_image = "arn:aws:imagebuilder:us-east-1:aws:image/amazon-linux-2-x86/x.x.x" |
| 57 | + recipe_version = "1.0.0" |
| 58 | + tags = local.tags |
| 59 | + update = true |
| 60 | +
|
| 61 | + component_arns = [ |
| 62 | + module.component_ansible_setup.component_arn, |
| 63 | + "arn:aws:imagebuilder:us-east-1:aws:component/simple-boot-test-linux/1.0.0/1", |
| 64 | + "arn:aws:imagebuilder:us-east-1:aws:component/reboot-test-linux/1.0.0/1" |
| 65 | + ] |
| 66 | +} |
| 67 | +
|
| 68 | +module "test_pipeline" { |
| 69 | + source = "rhythmictech/imagebuilder-pipeline/aws" |
| 70 | + version = "~> 0.3.0" |
| 71 | +
|
| 72 | + description = "Testing pipeline" |
| 73 | + name = "test-pipeline" |
| 74 | + tags = local.tags |
| 75 | + recipe_arn = module.test_recipe.recipe_arn |
| 76 | + public = false |
| 77 | +} |
| 78 | +
|
17 | 79 | ``` |
18 | 80 |
|
19 | 81 | ## About |
20 | | -A bit about this module |
| 82 | +This module bridges the gap allowing Terraform to create an EC2 Image Builder component which installs Ansible on Amazon Linux 2 until native support for Image Builder is added to Terraform |
21 | 83 |
|
22 | 84 | <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
23 | 85 | ## Requirements |
24 | 86 |
|
25 | 87 | | Name | Version | |
26 | 88 | |------|---------| |
27 | | -| terraform | >= 0.12.14 | |
| 89 | +| terraform | >= 0.12.28 | |
| 90 | +| aws | >= 2.44, < 4.0.0 | |
28 | 91 |
|
29 | 92 | ## Providers |
30 | 93 |
|
31 | | -No provider. |
| 94 | +| Name | Version | |
| 95 | +|------|---------| |
| 96 | +| aws | >= 2.44, < 4.0.0 | |
32 | 97 |
|
33 | 98 | ## Inputs |
34 | 99 |
|
35 | 100 | | Name | Description | Type | Default | Required | |
36 | 101 | |------|-------------|------|---------|:--------:| |
37 | | -| name | Moniker to apply to all resources in the module | `string` | n/a | yes | |
38 | | -| tags | User-Defined tags | `map(string)` | `{}` | no | |
| 102 | +| component\_version | Version of the component | `string` | n/a | yes | |
| 103 | +| name | name to use for component | `string` | n/a | yes | |
| 104 | +| change\_description | description of changes since last version | `string` | `null` | no | |
| 105 | +| cloudformation\_timeout | How long to wait (in minutes) for CFN to apply before giving up | `number` | `10` | no | |
| 106 | +| data\_uri | Use this to override the component document with one at a particualar URL endpoint | `string` | `null` | no | |
| 107 | +| description | description of component | `string` | `null` | no | |
| 108 | +| kms\_key\_id | KMS key to use for encryption | `string` | `null` | no | |
| 109 | +| platform | platform of component (Linux or Windows) | `string` | `"Linux"` | no | |
| 110 | +| ssh\_key\_secret\_arn | ARN of a secretsmanager secret containing an SSH key (use arn OR name, not both) | `string` | `null` | no | |
| 111 | +| ssh\_key\_secret\_name | Name of a secretsmanager secret containing an SSH key (use arn OR name, not both) | `string` | `null` | no | |
| 112 | +| tags | map of tags to use for CFN stack and component | `map(string)` | `{}` | no | |
39 | 113 |
|
40 | 114 | ## Outputs |
41 | 115 |
|
42 | 116 | | Name | Description | |
43 | 117 | |------|-------------| |
44 | | -| tags\_module | Tags Module in it's entirety | |
| 118 | +| component\_arn | ARN of the EC2 Image Builder Component | |
45 | 119 |
|
46 | 120 | <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
47 | 121 |
|
48 | | -## The Giants Underneath this Module |
49 | | -- [pre-commit.com](pre-commit.com) |
50 | | -- [terraform.io](terraform.io) |
51 | | -- [github.com/tfutils/tfenv](github.com/tfutils/tfenv) |
52 | | -- [github.com/segmentio/terraform-docs](github.com/segmentio/terraform-docs) |
| 122 | +## The Giants underneath this module |
| 123 | +- pre-commit.com/ |
| 124 | +- terraform.io/ |
| 125 | +- github.com/tfutils/tfenv |
| 126 | +- github.com/segmentio/terraform-docs |
0 commit comments