-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Madhushree Ray <[email protected]>
- Loading branch information
1 parent
cccfaee
commit 6e8c4f3
Showing
16 changed files
with
719 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[ | ||
{ | ||
"arn": "{{ output.resource_arn.value }}", | ||
"broker_id": "{{ output.resource_id.value }}", | ||
"broker_name": "{{ resourceName }}" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
select arn, broker_name, broker_id | ||
from aws.aws_mq_broker | ||
where broker_id = '{{ output.resource_id.value }}'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ | ||
{ | ||
"arn": "{{ output.resource_arn.value }}", | ||
"broker_name": "{{ resourceName }}", | ||
"engine_type": "{{ output.engine_type.value }}", | ||
"engine_version": "{{ output.engine_version.value }}" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
select arn, engine_type, engine_version, broker_name | ||
from aws.aws_mq_broker | ||
where broker_name = '{{ resourceName }}'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
select account_id, akas, region, tags, title | ||
from aws.aws_mq_broker | ||
where broker_name = 'dummy'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[ | ||
{ | ||
"akas": [ | ||
"{{ output.resource_arn.value }}" | ||
], | ||
"broker_name": "{{ resourceName }}", | ||
"region": "{{ output.aws_region.value }}", | ||
"tags": { | ||
"Name": "{{ resourceName }}" | ||
}, | ||
"title": "{{ resourceName }}" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
select akas, broker_name, region, tags, title | ||
from aws.aws_mq_broker | ||
where broker_name = '{{ resourceName }}'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
|
||
variable "resource_name" { | ||
type = string | ||
default = "turbot-test-20200125-create-update" | ||
description = "Name of the resource used throughout the test." | ||
} | ||
|
||
variable "aws_profile" { | ||
type = string | ||
default = "default" | ||
description = "AWS credentials profile used for the test. Default is to use the default profile." | ||
} | ||
|
||
variable "aws_region" { | ||
type = string | ||
default = "us-east-1" | ||
description = "AWS region used for the test. Does not work with default region in config, so must be defined here." | ||
} | ||
|
||
variable "aws_region_alternate" { | ||
type = string | ||
default = "us-east-2" | ||
description = "Alternate AWS region used for tests that require two regions (e.g. DynamoDB global tables)." | ||
} | ||
|
||
provider "aws" { | ||
profile = var.aws_profile | ||
region = var.aws_region | ||
} | ||
|
||
provider "aws" { | ||
alias = "alternate" | ||
profile = var.aws_profile | ||
region = var.aws_region_alternate | ||
} | ||
|
||
data "aws_partition" "current" {} | ||
data "aws_caller_identity" "current" {} | ||
data "aws_region" "primary" {} | ||
data "aws_region" "alternate" { | ||
provider = aws.alternate | ||
} | ||
|
||
data "null_data_source" "resource" { | ||
inputs = { | ||
scope = "arn:${data.aws_partition.current.partition}:::${data.aws_caller_identity.current.account_id}" | ||
} | ||
} | ||
|
||
resource "aws_mq_configuration" "named_test_resource" { | ||
description = "Example Configuration" | ||
name = var.resource_name | ||
engine_type = "ActiveMQ" | ||
engine_version = "5.17.6" | ||
|
||
data = <<DATA | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<broker xmlns="http://activemq.apache.org/schema/core"> | ||
<plugins> | ||
<forcePersistencyModeBrokerPlugin persistenceFlag="true"/> | ||
<statisticsBrokerPlugin/> | ||
<timeStampingBrokerPlugin ttlCeiling="86400000" zeroExpirationOverride="86400000"/> | ||
</plugins> | ||
</broker> | ||
DATA | ||
} | ||
|
||
resource "aws_vpc" "main" { | ||
cidr_block = "10.0.0.0/16" | ||
tags = { | ||
name = var.resource_name | ||
} | ||
} | ||
|
||
resource "aws_security_group" "named_test_resource" { | ||
vpc_id = aws_vpc.main.id | ||
name = var.resource_name | ||
description = "Test Security Group." | ||
tags = { | ||
name = var.resource_name | ||
} | ||
} | ||
|
||
resource "aws_subnet" "named_test_resource" { | ||
vpc_id = aws_vpc.main.id | ||
cidr_block = "10.0.1.0/24" | ||
tags = { | ||
Name = var.resource_name | ||
} | ||
} | ||
|
||
resource "aws_mq_broker" "named_test_resource" { | ||
depends_on = [aws_subnet.named_test_resource, aws_security_group.named_test_resource, aws_vpc.main, aws_mq_configuration.named_test_resource] | ||
broker_name = var.resource_name | ||
|
||
configuration { | ||
id = aws_mq_configuration.named_test_resource.id | ||
revision = aws_mq_configuration.named_test_resource.latest_revision | ||
} | ||
|
||
engine_type = "ActiveMQ" | ||
engine_version = "5.17.6" | ||
host_instance_type = "mq.t2.micro" | ||
security_groups = [aws_security_group.named_test_resource.id] | ||
subnet_ids = [aws_subnet.named_test_resource.id] | ||
|
||
user { | ||
username = "ExampleUser" | ||
password = "MindTheGapGood" | ||
} | ||
|
||
tags = { | ||
Name = var.resource_name | ||
} | ||
} | ||
|
||
output "account_id" { | ||
value = data.aws_caller_identity.current.account_id | ||
} | ||
|
||
output "aws_region" { | ||
value = data.aws_region.primary.name | ||
} | ||
|
||
output "aws_partition" { | ||
value = data.aws_partition.current.partition | ||
} | ||
|
||
output "resource_arn" { | ||
depends_on = [aws_mq_broker.named_test_resource] | ||
value = aws_mq_broker.named_test_resource.arn | ||
} | ||
|
||
output "resource_id" { | ||
depends_on = [aws_mq_broker.named_test_resource] | ||
value = aws_mq_broker.named_test_resource.id | ||
} | ||
|
||
output "engine_type" { | ||
value = "ActiveMQ" | ||
} | ||
|
||
output "engine_version" { | ||
value = "5.17.6" | ||
} | ||
|
||
output "resource_name" { | ||
value = var.resource_name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.