Skip to content

Commit

Permalink
Make creation of IAM user optional (#4)
Browse files Browse the repository at this point in the history
Co-authored-by: anmolnagpal <anmol@clouddrove.com>
  • Loading branch information
Sohan Yadav and anmolnagpal committed May 26, 2020
1 parent 85659a4 commit 8687320
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<hr>


We eat, drink, sleep and most importantly love **DevOps**. We are working towards stratergies for standardizing architecture while ensuring security for the infrastructure. We are strong believer of the philosophy <b>Bigger problems are always solved by breaking them into smaller manageable problems</b>. Resonating with microservices architecture, it is considered best-practice to run database, cluster, storage in smaller <b>connected yet manageable pieces</b> within the infrastructure.
We eat, drink, sleep and most importantly love **DevOps**. We are working towards strategies for standardizing architecture while ensuring security for the infrastructure. We are strong believer of the philosophy <b>Bigger problems are always solved by breaking them into smaller manageable problems</b>. Resonating with microservices architecture, it is considered best-practice to run database, cluster, storage in smaller <b>connected yet manageable pieces</b> within the infrastructure.

This module is basically combination of [Terraform open source](https://www.terraform.io/) and includes automatation tests and examples. It also helps to create and improve your infrastructure with minimalistic code instead of maintaining the whole infrastructure code yourself.

Expand All @@ -61,27 +61,32 @@ This module has a few dependencies:




## Examples


**IMPORTANT:** Since the `master` branch used in `source` varies based on new modifications, we suggest that you use the release versions [here](https://github.com/clouddrove/terraform-aws-ses/releases).


### Simple Example
Here is an example of how you can use this module in your inventory structure:
```hcl
module "ses" {
source = "git::https://github.com/clouddrove/terraform-aws-ses.git?ref=tags/0.12.2"
source = "git::https://github.com/clouddrove/terraform-aws-ses.git?ref=tags/0.12.3"
domain = "clouddrove.com"
iam_name = "ses-user"
zone_id = "DSSCTGRTHD"
enable_verification = true
enable_mx = false
enable_spf_domain = false
}
}
```






## Inputs

| Name | Description | Type | Default | Required |
Expand Down Expand Up @@ -113,8 +118,8 @@ module "ses" {



## Testing

## Testing
In this module testing is performed with [terratest](https://github.com/gruntwork-io/terratest) and it creates a small piece of infrastructure, matches the output like ARN, ID and Tags name etc and destroy infrastructure in your AWS account. This testing is written in GO, so you need a [GO environment](https://golang.org/doc/install) in your system.

You need to run the following command in the testing folder:
Expand Down Expand Up @@ -142,4 +147,4 @@ At [CloudDrove][website], we offer expert guidance, implementation support and s
[linkedin]: https://cpco.io/linkedin
[twitter]: https://twitter.com/clouddrove/
[email]: https://clouddrove.com/contact-us.html
[terraform_modules]: https://github.com/clouddrove?utf8=%E2%9C%93&q=terraform-&type=&language=
[terraform_modules]: https://github.com/clouddrove?utf8=%E2%9C%93&q=terraform-&type=&language=
2 changes: 1 addition & 1 deletion README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ usage : |-
Here is an example of how you can use this module in your inventory structure:
```hcl
module "ses" {
source = "git::https://github.com/clouddrove/terraform-aws-ses.git?ref=tags/0.12.2"
source = "git::https://github.com/clouddrove/terraform-aws-ses.git?ref=tags/0.12.3"
domain = "clouddrove.com"
iam_name = "ses-user"
zone_id = "DSSCTGRTHD"
Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ resource "aws_iam_user" "default" {
# Description : Terraform module which creates SMTP Iam access key resource on AWS
resource "aws_iam_access_key" "default" {
count = var.iam_name != "" ? 1 : 0
user = aws_iam_user.default[0].name
user = join("", aws_iam_user.default.*.name)
}

# Module : IAM USER POLICY
# Description : Terraform module which creates SMTP Iam user policy resource on AWS
resource "aws_iam_user_policy" "default" {
count = var.iam_name != "" ? 1 : 0
name = var.iam_name
user = aws_iam_user.default[0].name
user = join("", aws_iam_user.default.*.name)
policy = data.aws_iam_policy_document.allow_iam_name_to_send_emails.json
}

Expand Down

0 comments on commit 8687320

Please sign in to comment.