Skip to content

Commit

Permalink
Merge pull request #2 from johnricords/initialDev
Browse files Browse the repository at this point in the history
  • Loading branch information
johnricords authored Mar 16, 2023
2 parents 4848913 + b39e5e2 commit 6fac888
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.1.0
current_version = 1.0.0
commit = True
message = Bumps version to {new_version}
tag = False
Expand Down
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ updates:
directory: /
schedule:
interval: weekly
- package-ecosystem: terraform
directory: /
schedule:
interval: weekly
20 changes: 4 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
## repo-template
## terraform-aws-tardigrade-resource-group

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

### 1.1.0
### [1.0.0] (https://github.com/plus3it/terraform-aws-tardigrade-resource-group/releases/tag/1.0.0)

**Commit Delta**: N/A

**Released**: 2023.01.27

**Summary**:

* Updated workflow files to be consumable and reusable, and now points to actions-workflows repo

### 1.0.0

**Commit Delta**: N/A

**Released**: 2023.01.10
**Released**: 2023.03.16

**Summary**:

* Initial release of capability
* Initial capability release, create an AWS resource group
15 changes: 0 additions & 15 deletions CHANGELOG.template.md

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2023 Maintainers of plus3it/repo-template
Copyright 2023 Maintainers of plus3it/terraform-aws-tardigrade-resource-group

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
SHELL := /bin/bash

include $(shell test -f .tardigrade-ci || curl -sSL -o .tardigrade-ci "https://raw.githubusercontent.com/plus3it/tardigrade-ci/master/bootstrap/Makefile.bootstrap"; echo .tardigrade-ci)
50 changes: 27 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
# repo-template
Generic repo template for Plus3IT repositories

To use this template:

1. Select the green "Use this template" button, or [click here](https://github.com/plus3it/repo-template/generate).
2. Select the repo Owner, give the repo a name, enter a description, select Public or Private, and click "Create repository from template".
3. Clone the repository and create a new branch.
4. Edit the following files to customize them for the new repository:
* `LICENSE`
* Near the end of the file, edit the date and change the repository name
* `CHANGELOG.template.md`
* Rename to `CHANGELOG.md`, replacing the repo-template changelog
* Edit templated items for the new repo
* `.bumpversion.cfg`
* Edit the version number for the new repo, ask team if not sure what to
start with
* `README.md`
* Replace contents for the new repo
* `.github/`
* Inspect dependabot and workflow files in case changes are needed for
the new repo
5. Commit the changes and open a pull request
<!-- BEGIN TFDOCS -->
## Requirements

No requirements.

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a |

## Resources

| Name | Type |
|------|------|

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_resource_group"></a> [resource\_group](#input\_resource\_group) | Object of configuration attributes for the resource group | <pre>object({<br> name = string<br> description = optional(string)<br><br> resource_query = object({<br> type = optional(string, "TAG_FILTERS_1_0")<br> query = object({<br> ResourceTypeFilters = optional(list(string), ["AWS::AllSupported"])<br> TagFilters = list(object({<br> Key = string,<br> Values = list(string)<br> }))<br> })<br> })<br> })</pre> | n/a | yes |

## Outputs

No outputs.

<!-- END TFDOCS -->
9 changes: 9 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "aws_resourcegroups_group" "this" {
name = var.resource_group.name
description = var.resource_group.description

resource_query {
query = jsonencode(var.resource_group.resource_query.query)
type = var.resource_group.resource_query.type
}
}
24 changes: 24 additions & 0 deletions tests/test-resource-groups/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module "resource_group" {
source = "../.."
resource_group = {
name = local.name

resource_query = {
type = local.type
query = local.query
}
}
}

locals {
name = "ec2_grouped_by_something"
type = "TAG_FILTERS_1_0"
query = {
ResourceTypeFilters = ["AWS::EC2::Instance", "AWS::S3::Bucket"]
TagFilters = [{
Key = "some_tag_key"
Values = ["some_tag_value"]
}
]
}
}
31 changes: 31 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
variable "resource_group" {
description = "Object of configuration attributes for the resource group"
type = object({
name = string
description = optional(string)

resource_query = object({
type = optional(string, "TAG_FILTERS_1_0")
query = object({
ResourceTypeFilters = optional(list(string), ["AWS::AllSupported"])
TagFilters = list(object({
Key = string,
Values = list(string)
}))
})
})
})

validation {
condition = lower(var.resource_group.name) != "aws"
error_message = "The resource_group.name must not begin with aws or AWS"
}

validation {
condition = contains(
["TAG_FILTERS_1_0", "CLOUDFORMATION_STACK_1_0"],
var.resource_group.resource_query.type
)
error_message = "The resource_group.resource_query.type must be one of: TAG_FILTERS_1_O, CLOUDFORMATION_STACK_1_0"
}
}

0 comments on commit 6fac888

Please sign in to comment.