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

rm embedded provider #10

Merged
merged 6 commits into from
Apr 28, 2022
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
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---

fail_fast: false
minimum_pre_commit_version: "2.6.0"

repos:
- repo: https://github.com/aws-ia/pre-commit-configs
rev: ce5b80d2643c3510bd17bb309cb767b6b21dc5ea # frozen: 1.4
hooks:
- id: aws-ia-meta-hook
66 changes: 66 additions & 0 deletions .tflint.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/module-inspection.md
# borrowed & modified indefinitely from https://github.com/ksatirli/building-infrastructure-you-can-mostly-trust/blob/main/.tflint.hcl

plugin "aws" {
enabled = true
version = "0.12.0"
source = "github.com/terraform-linters/tflint-ruleset-aws"
}

config {
module = true
force = false
}

rule "terraform_required_providers" {
enabled = true
}

rule "terraform_required_version" {
enabled = true
}

rule "terraform_naming_convention" {
enabled = true
format = "snake_case"
}

rule "terraform_typed_variables" {
enabled = true
}

rule "terraform_unused_declarations" {
enabled = true
}

rule "terraform_comment_syntax" {
enabled = true
}

rule "terraform_deprecated_index" {
enabled = true
}

rule "terraform_deprecated_interpolation" {
enabled = true
}

rule "terraform_documented_outputs" {
enabled = true
}

rule "terraform_documented_variables" {
enabled = true
}

rule "terraform_module_pinned_source" {
enabled = true
}

rule "terraform_standard_module_structure" {
enabled = true
}

rule "terraform_workspace_remote" {
enabled = true
}
6 changes: 4 additions & 2 deletions examples/basic/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
output "tags" {
value = module.labels.tags
description = "Output of tags."
value = module.labels.tags
}

output "id" {
value = module.labels.id
description = "Computed id."
value = module.labels.id
}
File renamed without changes.
27 changes: 0 additions & 27 deletions output.tf

This file was deleted.

34 changes: 34 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
output "tags" {
description = "Output of tags in awscc provider format."
value = local.tags
}

output "tags_aws" {
description = "Output of tags in aws provider format."
value = local.tags_aws
}

output "id" {
description = "Output of computed id based on inputs to module."
value = local.ordered_id
}

output "name" {
description = "Name of workload."
value = local.vars["name"]
}

output "namespace" {
description = "Namespace of workload."
value = local.vars["namespace"]
}

output "account" {
description = "Account of workload."
value = local.vars["account"]
}

output "env" {
description = "Environment of workload."
value = local.vars["env"]
}
9 changes: 1 addition & 8 deletions versions.tf → provider.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
terraform {
required_version = ">= 0.15.0"
required_providers {
awscc = {
source = "hashicorp/awscc"
Expand All @@ -10,11 +11,3 @@ terraform {
}
}
}

provider "awscc" {
user_agent = [{
product_name = "terraform-awscc-label"
product_version = "0.0.4"
comment = "V1/AWS-D69B4015/376222271"
}]
}
15 changes: 5 additions & 10 deletions variable.tf → variables.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
variable "region" {
type = string
default = "us-west-1"
}

variable "namespace" {
type = string
description = "namespace, which could be your organization name, e.g. amazon"
Expand All @@ -29,26 +24,26 @@ variable "name" {

variable "delimiter" {
type = string
description = "delimiter, which could be used between name, namespace and env"
description = "delimiter, which could be used between name, namespace and env."
default = "-"
}

variable "attributes" {
type = list(any)
default = []
description = "attributes, which could be used for additional attributes"
description = "attributes, which could be used for additional attributes."
}

variable "tags" {
description = "tags, which could be used for additional tags"
description = "tags, which could be used for additional tags."
type = any
default = []
}

variable "id_order" {
description = "The order in which the `id` is constructed. Default yields `namespace-account-env-name` if your var.delimiter is `-`. Variables that are not populated but order is preserved. Eg: If no `var.namespace` and `var.account` are not specified, yields `env-name`."
type = list(any)
default = ["namespace", "account", "env", "name"]
type = list(any)
default = ["namespace", "account", "env", "name"]
validation {
condition = anytrue([
contains(var.id_order, "namespace"),
Expand Down