Skip to content

Commit

Permalink
Merge pull request GoogleCloudPlatform#440 from aqche/aws_qldb_ledger
Browse files Browse the repository at this point in the history
add support for aws_qldb_ledger
  • Loading branch information
sergeylanzman authored Mar 19, 2020
2 parents 61a0cd7 + 67e93ee commit 529e542
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,8 @@ In that case terraformer will not know with which region resources are associate
* `aws_organizations_organizational_unit`
* `aws_organizations_policy`
* `aws_organizations_policy_attachment`
* `qldb`
* `aws_qldb_ledger`
* `rds`
* `aws_db_instance`
* `aws_db_parameter_group`
Expand Down
1 change: 1 addition & 0 deletions providers/aws/aws_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ func (p *AWSProvider) GetSupportedService() map[string]terraform_utils.ServiceGe
"nacl": &NaclGenerator{},
"nat": &NatGatewayGenerator{},
"organization": &OrganizationGenerator{},
"qldb": &QLDBGenerator{},
"rds": &RDSGenerator{},
"route53": &Route53Generator{},
"route_table": &RouteTableGenerator{},
Expand Down
52 changes: 52 additions & 0 deletions providers/aws/qldb.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright 2020 The Terraformer Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package aws

import (
"context"

"github.com/GoogleCloudPlatform/terraformer/terraform_utils"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/qldb"
)

var qldbAllowEmptyValues = []string{"tags."}

type QLDBGenerator struct {
AWSService
}

func (g *QLDBGenerator) InitResources() error {
config, e := g.generateConfig()
if e != nil {
return e
}
svc := qldb.New(config)
p := qldb.NewListLedgersPaginator(svc.ListLedgersRequest(&qldb.ListLedgersInput{}))
var resources []terraform_utils.Resource
for p.Next(context.Background()) {
for _, ledger := range p.CurrentPage().Ledgers {
ledgerName := aws.StringValue(ledger.Name)
resources = append(resources, terraform_utils.NewSimpleResource(
ledgerName,
ledgerName,
"aws_qldb_ledger",
"aws",
qldbAllowEmptyValues))
}
}
g.Resources = resources
return p.Err()
}

0 comments on commit 529e542

Please sign in to comment.