-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathterraform-example.cfn.yaml
78 lines (65 loc) · 2.09 KB
/
terraform-example.cfn.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
AWSTemplateFormatVersion: 2010-09-09
Description: Terraform in CloudFormation example, using the Terraform Connector for CloudFormation
Parameters:
CFNBucket1Name:
Type: String
Default: terraform-rp-example-bucket1-default-from-cfn-2
CFNBucket2Name:
Type: String
Default: terraform-rp-example-bucket2-default-from-cfn-2
Resources:
TerraformExample:
Type: Cloudsoft::Terraform::Infrastructure
Properties:
LogBucketName: cloudsoft-terraform-infrastructure-my-user-logs
ConfigurationContent: |
variable "AWSRegion" {
type = string
default = "eu-central-1"
}
variable "TFBucket1Name" {
type = string
default = "terraform-rp-example-bucket1-default-from-tf-overridden-by-cfn-so-not-used-or-needed"
}
variable "TFBucket2Name" {
type = string
}
provider "aws" {
region = var.AWSRegion
}
resource "aws_s3_bucket" "bucket1" {
bucket = var.TFBucket1Name
acl = "private"
}
resource "aws_s3_bucket" "bucket2" {
bucket = var.TFBucket2Name
acl = "private"
}
output "bucket1-id" {
value = aws_s3_bucket.bucket1.id
}
output "bucket1-arn" {
value = aws_s3_bucket.bucket1.arn
}
output "bucket1-region" {
value = aws_s3_bucket.bucket1.region
}
output "bucket2-id" {
value = aws_s3_bucket.bucket2.id
}
output "bucket2-arn" {
value = aws_s3_bucket.bucket2.arn
}
output "bucket2-region" {
value = aws_s3_bucket.bucket2.region
}
Variables:
AWSRegion: !Ref "AWS::Region"
TFBucket1Name: !Ref CFNBucket1Name
TFBucket2Name: !Ref CFNBucket2Name
Outputs:
TerraformOutputs:
Description: Outputs from Terraform as a stringified JSON map
Value: !GetAtt TerraformExample.OutputsStringified
LogBucketUrl:
Value: !GetAtt TerraformExample.LogBucketUrl