Skip to content
This repository has been archived by the owner on Dec 9, 2020. It is now read-only.

Commit

Permalink
Add AWS budget functionality
Browse files Browse the repository at this point in the history
basic create budget functionality

[hashicorp#753]

use human readable date format and descriptive field names

[hashicorp#753]

add cost filters to budget resource

[hashicorp#753]

delete budget on resource destroy

[hashicorp#753]

fix go vet errors

update and read a aws budget from the resource

handle read of non-existent budget gracefully

employ functions to remove duplication and clarify intent

reuse existing method for budget existence check

Added documentation for aws_budget resource. (#1)

hi @nicksantamaria ,
thanks for the contribution and the helpful feedback on this PR.

support full set of budget costtypes

use default for budget time period end

check proper creation of budget time period

enable use of budget name_prefix as alternative to budget name

update defaults budget values and documentation

dry up budget test configs

create test budget with end date which is always in the future

align max budget end date with aws api max

employ naming convention of aws service + resource

  - this is so we can keep resources grouped

  pr feedback:
  (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r172539673)

align filename with service + resource naming

  pr feedback: (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r172539673)

remove un-needed verbosity in object definition

  pr feedback: (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r172576462)

remove deprecated call to Set in AWS budgets SDK

  PR Feedback: (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r172561258)

check for errors on budget read and obey demeter

  PR Feedback: (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r172580699)

flatten budget and checks uses separate function

  PR Feedback:
  (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r172580699)

swap use of Set for struct init with value

  PR Feedback: (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r172561258)

add cost_types attr to align with aws budget api

  PR Feedback: (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r172566294)

accurate documentation of budget resource

  PR Feedback:
  - https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r172568560
  - https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r172569165
  - https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r172577391
  - https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r172569549

remove extraneous functions from budgets resource

adhere function names in budgets to conventions

inline test check rather than separate function

  PR Feedback:
  (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r172570851)

unmarshal costtypes as separate function

configure optional account_id for budget

  - includes documentation updates for supported import changes

  PR Feedback:
  (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r172560437)

account_id in budget resource docs

use inline schema definition for budgets budget

  PR Feedback:
  (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r176823677)

use aws string helper to create pointers

  PR Feedback: (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r176824529)

compute name and name prefix for budgets budget

  PR Feedback:
  (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r176828112)

emit warning when budget is not found

  PR Feedback: (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r176828446)

call read after create budgets budget

  PR Feedback:
  (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r176824910)
  (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r176825249)

remove redundant call on resource delete

  PR Feedback: (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r176825987)

define budget name on create only

  PR Feedback: (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r176827787)

correct name for budgets budget tests

 PR Feedback: (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r178949969)

reorder test cases for budgets

  PR Feedback: (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r178956591)

align test config function names to convention

  PR Feedback:
  (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r178956192)

adjust documentations to match nameing convention

reorder and remove dups from attributes in docs

  PR Feedback:
  (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r178957219)

remove custom flat budget test struct

  - in favor of budgets.Budget

  PR Feedback:
  (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r178955760)

apply naming convention to all test functions

use resources list to cleanup test budgets

  PR Feedback: (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r178953821)

conform budgetdestroy signature to testdestroy

rework function signature for exists check

  PR Feedback: (https://github.com/terraform-providers/terraform-provider-aws/pull/1879/files#r178951991)
  • Loading branch information
xchapter7x authored and fmasuhr committed Apr 24, 2018
1 parent 4cc8735 commit 945a62e
Show file tree
Hide file tree
Showing 4 changed files with 841 additions and 0 deletions.
3 changes: 3 additions & 0 deletions aws/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/aws/aws-sdk-go/service/athena"
"github.com/aws/aws-sdk-go/service/autoscaling"
"github.com/aws/aws-sdk-go/service/batch"
"github.com/aws/aws-sdk-go/service/budgets"
"github.com/aws/aws-sdk-go/service/cloud9"
"github.com/aws/aws-sdk-go/service/cloudformation"
"github.com/aws/aws-sdk-go/service/cloudfront"
Expand Down Expand Up @@ -223,6 +224,7 @@ type AWSClient struct {
mediastoreconn *mediastore.MediaStore
appsyncconn *appsync.AppSync
lexmodelconn *lexmodelbuildingservice.LexModelBuildingService
budgetconn *budgets.Budgets
}

func (c *AWSClient) S3() *s3.S3 {
Expand Down Expand Up @@ -423,6 +425,7 @@ func (c *Config) Client() (interface{}, error) {
}
}

client.budgetconn = budgets.New(sess)
client.acmconn = acm.New(awsAcmSess)
client.acmpcaconn = acmpca.New(sess)
client.apigateway = apigateway.New(awsApigatewaySess)
Expand Down
1 change: 1 addition & 0 deletions aws/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ func Provider() terraform.ResourceProvider {
"aws_autoscaling_notification": resourceAwsAutoscalingNotification(),
"aws_autoscaling_policy": resourceAwsAutoscalingPolicy(),
"aws_autoscaling_schedule": resourceAwsAutoscalingSchedule(),
"aws_budgets_budget": resourceAwsBudgetsBudget(),
"aws_cloud9_environment_ec2": resourceAwsCloud9EnvironmentEc2(),
"aws_cloudformation_stack": resourceAwsCloudFormationStack(),
"aws_cloudfront_distribution": resourceAwsCloudFrontDistribution(),
Expand Down
Loading

0 comments on commit 945a62e

Please sign in to comment.