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

Remove provider config #49

Closed
wants to merge 14 commits into from
618 changes: 0 additions & 618 deletions README.md

This file was deleted.

26 changes: 22 additions & 4 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,23 @@ usage: |2-
For a complete example, see [examples/complete](examples/complete)

```hcl

provider "aws" {
alias = "requester"
region = "us-west-2"
assume_role {
role_arn = "arn:aws:iam::XXXXXXXX:role/cross-account-vpc-peering-test"
}
}

provider "aws" {
alias = "accepter"
region = "us-west-2"
assume_role {
role_arn = "arn:aws:iam::YYYYYYYY:role/cross-account-vpc-peering-test"
}
}

module "vpc_peering_cross_account" {
source = "cloudposse/vpc-peering-multi-account/aws"
# Cloud Posse recommends pinning every module to a specific version
Expand All @@ -77,15 +94,16 @@ usage: |2-
stage = "dev"
name = "cluster"

requester_aws_assume_role_arn = "arn:aws:iam::XXXXXXXX:role/cross-account-vpc-peering-test"
requester_region = "us-west-2"
requester_vpc_id = "vpc-xxxxxxxx"
requester_allow_remote_vpc_dns_resolution = true

accepter_aws_assume_role_arn = "arn:aws:iam::YYYYYYYY:role/cross-account-vpc-peering-test"
accepter_region = "us-east-1"
accepter_vpc_id = "vpc-yyyyyyyy"
accepter_allow_remote_vpc_dns_resolution = true

providers = {
aws.accepter = aws.accepter
aws.requester = aws.requester
Comment on lines +104 to +105
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Showing how to set these providers above would be helpful for copying and pasting the example.

}
}
```

Expand Down
19 changes: 0 additions & 19 deletions accepter.tf
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
# Accepter's credentials
provider "aws" {
alias = "accepter"
region = var.accepter_region
profile = var.accepter_aws_profile
skip_metadata_api_check = var.skip_metadata_api_check

dynamic "assume_role" {
for_each = var.accepter_aws_assume_role_arn != "" ? ["true"] : []
content {
role_arn = var.accepter_aws_assume_role_arn
}
}

access_key = var.accepter_aws_access_key
secret_key = var.accepter_aws_secret_key
token = var.accepter_aws_token
}

module "accepter" {
source = "cloudposse/label/null"
version = "0.24.1"
Expand Down
97 changes: 0 additions & 97 deletions docs/terraform.md

This file was deleted.

4 changes: 0 additions & 4 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@ provider "aws" {
module "vpc_peering_cross_account" {
source = "../../"

requester_aws_assume_role_arn = var.requester_aws_assume_role_arn
requester_region = var.requester_region
requester_vpc_id = var.requester_vpc_id
requester_allow_remote_vpc_dns_resolution = var.requester_allow_remote_vpc_dns_resolution

accepter_aws_assume_role_arn = var.accepter_aws_assume_role_arn
accepter_region = var.accepter_region
accepter_vpc_id = var.accepter_vpc_id
accepter_allow_remote_vpc_dns_resolution = var.accepter_allow_remote_vpc_dns_resolution

Expand Down
22 changes: 0 additions & 22 deletions examples/complete/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@ variable "region" {
default = "us-east-1"
}

variable "requester_aws_assume_role_arn" {
type = string
description = "Requester AWS Assume Role ARN"
}

variable "requester_region" {
type = string
description = "Requester AWS region"
default = "us-west-2"
}

variable "requester_vpc_id" {
type = string
description = "Requester VPC ID filter"
Expand All @@ -26,17 +15,6 @@ variable "requester_allow_remote_vpc_dns_resolution" {
default = true
}

variable "accepter_aws_assume_role_arn" {
type = string
description = "Accepter AWS Assume Role ARN"
}

variable "accepter_region" {
type = string
description = "Accepter AWS region"
default = "us-east-1"
}

variable "accepter_vpc_id" {
type = string
description = "Accepter VPC ID filter"
Expand Down
2 changes: 1 addition & 1 deletion examples/vpc-only/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 0.13.0"
required_version = ">= 0.15.0"

required_providers {
aws = {
Expand Down
54 changes: 0 additions & 54 deletions requester.tf
Original file line number Diff line number Diff line change
@@ -1,37 +1,3 @@
variable "requester_aws_profile" {
description = "Profile used to assume requester_aws_assume_role_arn"
type = string
default = ""
}

variable "requester_aws_access_key" {
description = "Access key id to use in requester account"
type = string
default = null
}

variable "requester_aws_assume_role_arn" {
description = "Requester AWS Assume Role ARN"
type = string
}

variable "requester_aws_secret_key" {
description = "Secret access key to use in requester account"
type = string
default = null
}

variable "requester_aws_token" {
description = "Session token for validating temporary credentials"
type = string
default = null
}

variable "requester_region" {
type = string
description = "Requester AWS region"
}

variable "requester_subnet_tags" {
type = map(string)
description = "Only add peer routes to requester VPC route tables of subnets matching these tags"
Expand All @@ -56,26 +22,6 @@ variable "requester_allow_remote_vpc_dns_resolution" {
description = "Allow requester VPC to resolve public DNS hostnames to private IP addresses when queried from instances in the accepter VPC"
}

# Requestors's credentials
provider "aws" {
alias = "requester"
region = var.requester_region
profile = var.requester_aws_profile
skip_metadata_api_check = var.skip_metadata_api_check

dynamic "assume_role" {
for_each = var.requester_aws_assume_role_arn != "" ? ["true"] : []
content {
role_arn = var.requester_aws_assume_role_arn
}
}

access_key = var.requester_aws_access_key
secret_key = var.requester_aws_secret_key
token = var.requester_aws_token

}

module "requester" {
source = "cloudposse/label/null"
version = "0.24.1"
Expand Down
34 changes: 0 additions & 34 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,6 @@ variable "auto_accept" {
description = "Automatically accept the peering"
}

variable "accepter_aws_access_key" {
description = "Access key id to use in accepter account"
type = string
default = null
}

variable "accepter_aws_profile" {
description = "Profile used to assume accepter_aws_assume_role_arn"
type = string
default = ""
}

variable "accepter_aws_assume_role_arn" {
description = "Accepter AWS Assume Role ARN"
type = string
}

variable "accepter_aws_secret_key" {
description = "Secret access key to use in accepter account"
type = string
default = null
}

variable "accepter_aws_token" {
description = "Session token for validating temporary credentials"
type = string
default = null
}

variable "accepter_region" {
type = string
description = "Accepter AWS region"
}

variable "accepter_vpc_id" {
type = string
description = "Accepter VPC ID filter"
Expand Down
7 changes: 4 additions & 3 deletions versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
terraform {
required_version = ">= 0.13.0"
required_version = ">= 0.15.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 2.0"
source = "hashicorp/aws"
version = ">= 2.0"
configuration_aliases = [aws.accepter, aws.requester]
}
null = {
source = "hashicorp/null"
Expand Down