Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide some infrastructure as code configuration files for Terraform/Ansible/Cloudformation #1505

Merged
merged 5 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions infra/aws-s3/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Apache Camel Kamelets - AWS S3 Commodity Configuration files

In this directory you'll find:

- Ansible
- Terraform
- Cloudformation

Configuration files, to be used for creating your infra for using AWS S3 Kamelets.

This will create an S3 Bucket with basic functionalities.

## Ansible

The commmand to create the infra is:

```bash
$ ansible-playbook -v ansible/aws-s3.yaml --extra-vars bucket_name=<bucket-name>
```

## Terraform

The commmand to create the infra is:

```bash
$ cd terraform/
$ terraform init
$ terraform apply -var="bucket_name=<bucket-name>"
```

Once completed do:

```bash
$ cd terraform/
$ terraform destroy
```

## Cloudformation

The commmand to create the infra is:

```bash
$ aws cloudformation deploy --template-file cloudformation/aws-s3.yaml --stack-name my-new-stack --parameter-overrides BucketName=<bucket-name>
```

Once completed do:

```bash
$ aws cloudformation delete-stack --stack-name my-new-stack
```


12 changes: 12 additions & 0 deletions infra/aws-s3/ansible/aws-s3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Create AWS S3 Bucket
hosts: localhost
vars:
encryption_type: "AES256"
tasks:
- name: Create bucket without JSON policy
amazon.aws.s3_bucket:
name: "{{ bucket_name }}"
state: present
encryption: "{{ encryption_type }}"
register: created_bucket
12 changes: 12 additions & 0 deletions infra/aws-s3/cloudformation/aws-s3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Parameters:
BucketName:
Type: String
Description: The bucket name.

Resources:
S3Bucket:
Type: 'AWS::S3::Bucket'
DeletionPolicy: Retain
Properties:
BucketName:
Ref: BucketName
7 changes: 7 additions & 0 deletions infra/aws-s3/terraform/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
variable "bucket_name" {
type = string
}

resource "aws_s3_bucket" "example" {
bucket = var.bucket_name
}
Loading