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

Add Spotinst integration #113

Merged
merged 4 commits into from
Dec 11, 2021
Merged

Add Spotinst integration #113

merged 4 commits into from
Dec 11, 2021

Conversation

Nuru
Copy link
Contributor

@Nuru Nuru commented Dec 2, 2020

what

  • Add Spotinst integration
  • terraform fmt

why

  • Support testing of Spotinst components
  • Keep things standardized

@Nuru Nuru requested a review from a team as a code owner December 2, 2020 12:49
@Nuru Nuru requested review from aknysh, maximmi and osterman December 2, 2020 12:50
@cloudpossebot
Copy link
Member

Ran Plan for 3 projects:

  1. project: backing-services dir: conf/backing-services workspace: default
  2. project: kops dir: conf/kops workspace: default
  3. project: kops-aws-platform dir: conf/kops-aws-platform workspace: default

1. project: backing-services dir: conf/backing-services workspace: default

Plan Error

Show Output
exit status 2: running "set -o pipefail; make plan | tfmask | scenery --no-color" in "/conf/atlantis/.atlantis/repos/cloudposse/testing.cloudposse.co/113/default/conf/backing-services": 

Error: Error refreshing state: 2 errors occurred:
	* module.kops_metadata.data.aws_iam_role.masters: 1 error occurred:
	* module.kops_metadata.data.aws_iam_role.masters: data.aws_iam_role.masters: error reading IAM Role (masters.us-west-2.testing.cloudposse.co): NoSuchEntity: The role with name masters.us-west-2.testing.cloudposse.co cannot be found.
	status code: 404, request id: 8a499eeb-3507-435c-bcda-9d1fad0ff921


	* module.kops_metadata.data.aws_iam_role.nodes: 1 error occurred:
	* module.kops_metadata.data.aws_iam_role.nodes: data.aws_iam_role.nodes: error reading IAM Role (nodes.us-west-2.testing.cloudposse.co): NoSuchEntity: The role with name nodes.us-west-2.testing.cloudposse.co cannot be found.
	status code: 404, request id: 678a0104-7a5f-4ef9-b55f-002ab45efa6d






make: *** [Makefile:11: plan] Error 1
Failed to parse plan. Returning original input.
[ -f .terraform/terraform.tfstate ] || terraform init
terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

null_resource.default: Refreshing state... (ID: 2068194211242487918)
null_resource.default: Refreshing state... (ID: 1548583330817703293)
null_resource.default: Refreshing state... (ID: 7657159253810668253)
null_resource.default: Refreshing state... (ID: 478236198849183015)
null_resource.default: Refreshing state... (ID: 508572735653096510)
null_resource.default: Refreshing state... (ID: 8604237901143291683)
null_resource.default: Refreshing state... (ID: 1410006003943763716)
null_resource.tags_as_list_of_maps[2]: Refreshing state... (ID: 4205367891326982024)
null_resource.tags_as_list_of_maps[0]: Refreshing state... (ID: 4226938373967204901)
null_resource.tags_as_list_of_maps[1]: Refreshing state... (ID: 2276653179243512836)
null_resource.tags_as_list_of_maps[0]: Refreshing state... (ID: 4256081586425221770)
null_resource.tags_as_list_of_maps[1]: Refreshing state... (ID: 6217726697580730064)
null_resource.tags_as_list_of_maps[2]: Refreshing state... (ID: 7685039094893652539)
null_resource.tags_as_list_of_maps[0]: Refreshing state... (ID: 6398314311681080534)
null_resource.tags_as_list_of_maps[1]: Refreshing state... (ID: 319909937320217541)
null_resource.tags_as_list_of_maps[2]: Refreshing state... (ID: 6750951581316199605)
aws_vpc.default: Refreshing state... (ID: vpc-0b7622f0c6f33fc47)
data.aws_iam_role.nodes: Refreshing state...
data.aws_route53_zone.default: Refreshing state...
data.aws_iam_role.masters: Refreshing state...
data.aws_availability_zones.available: Refreshing state...
data.aws_region.current: Refreshing state...
data.aws_availability_zones.available: Refreshing state...
data.aws_caller_identity.default: Refreshing state...
aws_internet_gateway.default: Refreshing state... (ID: igw-049b634de941789a4)
data.aws_vpc.default: Refreshing state...
aws_eip.default[1]: Refreshing state... (ID: eipalloc-04cb6f1b8dceca1cc)
aws_eip.default[0]: Refreshing state... (ID: eipalloc-0f2c84c5c113bb96b)
aws_eip.default[2]: Refreshing state... (ID: eipalloc-0f946e5f13d1afd9e)
aws_route_table.public: Refreshing state... (ID: rtb-0d3c4796a1c222d57)
aws_subnet.private[0]: Refreshing state... (ID: subnet-06ac8a3ce7e6e2d3d)
aws_subnet.private[1]: Refreshing state... (ID: subnet-03a7ffd7204e0dca6)
aws_subnet.private[2]: Refreshing state... (ID: subnet-028e95f855e889902)
aws_route_table.private[2]: Refreshing state... (ID: rtb-01c2fceb552ed3b76)
aws_subnet.public[0]: Refreshing state... (ID: subnet-08a75989c02176662)
aws_route_table.private[1]: Refreshing state... (ID: rtb-05fb5b614d7ac88b9)
aws_route_table.private[0]: Refreshing state... (ID: rtb-0c58f6c7c8cbea0df)
aws_subnet.public[1]: Refreshing state... (ID: subnet-0650571f02ca09874)
aws_subnet.public[2]: Refreshing state... (ID: subnet-0b1d9f814924caf3a)
aws_network_acl.private: Refreshing state... (ID: acl-0d9228af5198d6c1b)
aws_route_table_association.private[0]: Refreshing state... (ID: rtbassoc-0abc933f2e7bafd3b)
aws_route_table_association.private[2]: Refreshing state... (ID: rtbassoc-0e5e9aaf396853842)
aws_route_table_association.private[1]: Refreshing state... (ID: rtbassoc-01bde2697974634f7)
aws_network_acl.public: Refreshing state... (ID: acl-076a5f6a612ceb6b2)
aws_route_table_association.public[0]: Refreshing state... (ID: rtbassoc-0e8c21cce90e68454)
aws_route_table_association.public[1]: Refreshing state... (ID: rtbassoc-01407ca0a592f2883)
aws_route_table_association.public[2]: Refreshing state... (ID: rtbassoc-0f2dee0e642fd871f)
aws_nat_gateway.default[0]: Refreshing state... (ID: nat-0a62767762aeee39b)
aws_nat_gateway.default[2]: Refreshing state... (ID: nat-0bc669d265703986d)
aws_nat_gateway.default[1]: Refreshing state... (ID: nat-0a48d82b2792fd7c1)
aws_route.default[0]: Refreshing state... (ID: r-rtb-0c58f6c7c8cbea0df1080289494)
aws_route.default[1]: Refreshing state... (ID: r-rtb-05fb5b614d7ac88b91080289494)
aws_route.default[2]: Refreshing state... (ID: r-rtb-01c2fceb552ed3b761080289494)

rm -rf Makefile *.tf .terraform
terraform init
Copying configuration from "git::https://github.com/cloudposse/terraform-root-modules.git//aws/backing-services?ref=tags/0.40.0"...
Initializing modules...
- module.aurora_mysql
  Getting source "git::https://github.com/cloudposse/terraform-aws-rds-cluster.git?ref=tags/0.8.0"
- module.postgres_replica
  Getting source "git::https://github.com/cloudposse/terraform-aws-rds-cluster-instance-group.git?ref=tags/0.1.0"
- module.aurora_postgres
  Getting source "git::https://github.com/cloudposse/terraform-aws-rds-cluster.git?ref=tags/0.8.0"
- module.elasticache_redis
  Getting source "git::https://github.com/cloudposse/terraform-aws-elasticache-redis.git?ref=tags/0.7.1"
- module.elasticsearch
  Getting source "git::https://github.com/cloudposse/terraform-aws-elasticsearch.git?ref=tags/0.1.5"
- module.kops_metadata
  Getting source "git::https://github.com/cloudposse/terraform-aws-kops-metadata.git?ref=tags/0.2.0"
- module.rds_replica
  Getting source "git::https://github.com/cloudposse/terraform-aws-rds-replica.git?ref=tags/0.1.0"
- module.rds
  Getting source "git::https://github.com/cloudposse/terraform-aws-rds.git?ref=tags/0.4.3"
- module.vpc
  Getting source "git::https://github.com/cloudposse/terraform-aws-vpc.git?ref=tags/0.3.3"
- module.subnets
  Getting source "git::https://github.com/cloudposse/terraform-aws-dynamic-subnets.git?ref=tags/0.3.4"
- module.rds_replica.label
  Getting source "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
- module.rds_replica.final_snapshot_label
  Getting source "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
- module.rds_replica.dns_host_name
  Getting source "git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.2.5"
- module.postgres_replica.label
  Getting source "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.5"
- module.postgres_replica.dns
  Getting source "git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.2.5"
- module.aurora_postgres.label
  Getting source "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.5"
- module.aurora_postgres.dns_master
  Getting source "git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.2.5"
- module.aurora_postgres.dns_replicas
  Getting source "git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.2.5"
- module.elasticache_redis.label
  Getting source "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.5.3"
- module.elasticache_redis.dns
  Getting source "git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.2.1"
- module.elasticsearch.label
  Getting source "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.5.3"
- module.elasticsearch.domain_hostname
  Getting source "git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.2.5"
- module.elasticsearch.kibana_hostname
  Getting source "git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.2.5"
- module.rds.label
  Getting source "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
- module.rds.final_snapshot_label
  Getting source "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
- module.rds.dns_host_name
  Getting source "git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.2.5"
- module.vpc.label
  Getting source "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
- module.subnets.private_label
  Getting source "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
- module.subnets.private_subnet_label
  Getting source "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
- module.subnets.public_subnet_label
  Getting source "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
- module.subnets.public_label
  Getting source "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
- module.aurora_mysql.label
  Getting source "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.5"
- module.aurora_mysql.dns_master
  Getting source "git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.2.5"
- module.aurora_mysql.dns_replicas
  Getting source "git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.2.5"

Initializing the backend...

Successfully configured the backend "s3"! Terraform will automatically
use this backend unless the backend configuration changes.

Initializing provider plugins...
- Checking for available provider plugins on https://releases.hashicorp.com...
- Downloading plugin for provider "random" (2.3.1)...
- Downloading plugin for provider "null" (2.1.2)...
- Downloading plugin for provider "aws" (2.70.0)...

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.

* provider.aws: version = "~> 2.70"
* provider.null: version = "~> 2.1"
* provider.random: version = "~> 2.3"

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.


2. project: kops dir: conf/kops workspace: default

Show Output
rm -rf Makefile *.tf .terraform
terraform init
Copying configuration from "git::https://github.com/cloudposse/terraform-root-modules.git//aws/kops?ref=tags/0.35.1"...
Initializing modules...
- module.kops_state_backend
  Getting source "git::https://github.com/cloudposse/terraform-aws-kops-state-backend.git?ref=tags/0.1.5"
- module.ssh_key_pair
  Getting source "git::https://github.com/cloudposse/terraform-aws-ssm-tls-ssh-key-pair.git?ref=tags/0.2.0"
- module.private_subnets
  Getting source "subnets"
- module.utility_subnets
  Getting source "subnets"
- module.ssh_key_pair.label
  Getting source "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
- module.kops_state_backend.domain
  Getting source "git::https://github.com/cloudposse/terraform-aws-route53-cluster-zone.git?ref=tags/0.2.5"
- module.kops_state_backend.s3_label
  Getting source "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
- module.kops_state_backend.domain.label
  Getting source "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"

Initializing the backend...

Successfully configured the backend "s3"! Terraform will automatically
use this backend unless the backend configuration changes.

Initializing provider plugins...
- Checking for available provider plugins on https://releases.hashicorp.com...
- Downloading plugin for provider "tls" (2.2.0)...
- Downloading plugin for provider "local" (1.4.0)...
- Downloading plugin for provider "template" (2.2.0)...
- Downloading plugin for provider "aws" (2.70.0)...
- Downloading plugin for provider "null" (2.1.2)...

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.

* provider.aws: version = "~> 2.70"
* provider.local: version = "~> 1.4"
* provider.null: version = "~> 2.1"
* provider.template: version = "~> 2.2"
* provider.tls: version = "~> 2.2"

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

+ aws_ssm_parameter.kops_availability_zones
    id:          <computed>
    arn:         <computed>
    description: "Kops availability zones in which cluster will be provisioned"
    key_id:      <computed>
    name:        "/kops/kops_availability_zones"
    overwrite:   "true"
    tier:        "Standard"
    type:        "String"
    value:       <sensitive>
    version:     <computed>

+ aws_ssm_parameter.kops_cluster_name
    id:          <computed>
    arn:         <computed>
    description: "Kops cluster name"
    key_id:      <computed>
    name:        "/kops/kops_cluster_name"
    overwrite:   "true"
    tier:        "Standard"
    type:        "String"
    value:       <sensitive>
    version:     <computed>

+ aws_ssm_parameter.kops_dns_zone
    id:          <computed>
    arn:         <computed>
    description: "Kops DNS zone name"
    key_id:      <computed>
    name:        "/kops/kops_dns_zone"
    overwrite:   "true"
    tier:        "Standard"
    type:        "String"
    value:       <sensitive>
    version:     <computed>

+ aws_ssm_parameter.kops_network_cidr
    id:          <computed>
    arn:         <computed>
    description: "CIDR block of the kops virtual network"
    key_id:      <computed>
    name:        "/kops/kops_network_cidr"
    overwrite:   "true"
    tier:        "Standard"
    type:        "String"
    value:       <sensitive>
    version:     <computed>

+ aws_ssm_parameter.kops_non_masquerade_cidr
    id:          <computed>
    arn:         <computed>
    description: "The CIDR range for Pod IPs"
    key_id:      <computed>
    name:        "/kops/kops_non_masquerade_cidr"
    overwrite:   "true"
    tier:        "Standard"
    type:        "String"
    value:       <sensitive>
    version:     <computed>

+ aws_ssm_parameter.kops_private_subnets
    id:          <computed>
    arn:         <computed>
    description: "Kops private subnet CIDRs"
    key_id:      <computed>
    name:        "/kops/kops_private_subnets"
    overwrite:   "true"
    tier:        "Standard"
    type:        "String"
    value:       <sensitive>
    version:     <computed>

+ aws_ssm_parameter.kops_state_store
    id:          <computed>
    arn:         <computed>
    description: "Kops state store S3 bucket name"
    key_id:      <computed>
    name:        "/kops/kops_state_store"
    overwrite:   "true"
    tier:        "Standard"
    type:        "String"
    value:       <sensitive>
    version:     <computed>

+ aws_ssm_parameter.kops_state_store_region
    id:          <computed>
    arn:         <computed>
    description: "Kops state store (S3 bucket) region"
    key_id:      <computed>
    name:        "/kops/kops_state_store_region"
    overwrite:   "true"
    tier:        "Standard"
    type:        "String"
    value:       <sensitive>
    version:     <computed>

+ aws_ssm_parameter.kops_utility_subnets
    id:          <computed>
    arn:         <computed>
    description: "Kops utility subnet CIDRs"
    key_id:      <computed>
    name:        "/kops/kops_utility_subnets"
    overwrite:   "true"
    tier:        "Standard"
    type:        "String"
    value:       <sensitive>
    version:     <computed>

- module.chamber_parameters.aws_ssm_parameter.default[0]

- module.chamber_parameters.aws_ssm_parameter.default[1]

- module.chamber_parameters.aws_ssm_parameter.default[2]

- module.chamber_parameters.aws_ssm_parameter.default[3]

- module.chamber_parameters.aws_ssm_parameter.default[4]

- module.chamber_parameters.aws_ssm_parameter.default[5]

- module.chamber_parameters.aws_ssm_parameter.default[6]

- module.chamber_parameters.aws_ssm_parameter.default[7]

- module.chamber_parameters.aws_ssm_parameter.default[8]

- module.chamber_parameters.aws_ssm_parameter.default[9]

- module.ssh_key_pair.aws_key_pair.generated

+ module.ssh_key_pair.aws_ssm_parameter.private_rsa_key
    id:             <computed>
    arn:            <computed>
    description:    "TLS Private Key"
    key_id:         "190bae21-0d98-44a5-82e4-86829a6e3677"
    name:           "/kops/kops_ssh_private_key"
    overwrite:      "true"
    tags.%:         "3"
    tags.Name:      "cpco-testing-kops-us-west-2"
    tags.Namespace: "cpco"
    tags.Stage:     "testing"
    tier:           "Standard"
    type:           "SecureString"
    value:          <sensitive>
    version:        <computed>

+ module.ssh_key_pair.aws_ssm_parameter.public_rsa_key
    id:             <computed>
    arn:            <computed>
    description:    "TLS Public Key (OpenSSH - RSA)"
    key_id:         <computed>
    name:           "/kops/kops_ssh_public_key"
    overwrite:      "true"
    tags.%:         "3"
    tags.Name:      "cpco-testing-kops-us-west-2"
    tags.Namespace: "cpco"
    tags.Stage:     "testing"
    tier:           "Standard"
    type:           "String"
    value:          <sensitive>
    version:        <computed>

- module.ssh_key_pair.null_resource.chmod

- module.ssh_key_pair.tls_private_key.default

+ module.ssh_key_pair.tls_private_key.default_rsa
    id:                         <computed>
    algorithm:                  "RSA"
    ecdsa_curve:                "P224"
    private_key_pem:            <computed>
    public_key_fingerprint_md5: <computed>
    public_key_openssh:         <computed>
    public_key_pem:             <computed>
    rsa_bits:                   "4096"

+ module.kops_state_backend.module.domain.aws_route53_record.ns
    id:                 <computed>
    allow_overwrite:    <computed>
    fqdn:               <computed>
    name:               "us-west-2.testing.cloudposse.co"
    records.#:          "4"
    records.3342986208: "ns-1764.awsdns-28.co.uk"
    records.3521270735: "ns-1273.awsdns-31.org"
    records.549095158:  "ns-577.awsdns-08.net"
    records.580290299:  "ns-469.awsdns-58.com"
    ttl:                "60"
    type:               "NS"
    zone_id:            "Z3SO0TKDDQ0RGG"

Plan: 13 to add, 0 to change, 13 to destroy.
  • ▶️ To apply this plan, comment:
    • atlantis apply -p kops
  • 🚮 To delete this plan click here
  • 🔁 To plan this project again, comment:
    • atlantis plan -p kops

3. project: kops-aws-platform dir: conf/kops-aws-platform workspace: default

Plan Error

exit status 2: running "make reset deps" in "/conf/atlantis/.atlantis/repos/cloudposse/testing.cloudposse.co/113/default/conf/kops-aws-platform": 
rm -rf Makefile *.tf .terraform
terraform init
Copying configuration from "git::https://github.com/cloudposse/terraform-root-modules.git//aws/kops-aws-platform?ref=tags/0.46.0"...

Error: Can't populate non-empty directory

The target directory . is not empty, so it cannot be initialized with the
-from-module=... option.

make: *** [Makefile.tasks:3: deps] Error 1



  • ⏩ To apply all unapplied plans from this pull request, comment:
    • atlantis apply

@Nuru Nuru marked this pull request as draft December 3, 2020 20:31
@@ -0,0 +1,10 @@
terraform {
# required_version = ">= 1.0.0"
Copy link
Member

Choose a reason for hiding this comment

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

why this is commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Commented out because I do not know what the minimum required version of Terraform is, but it is surely less than 1.0

Copy link
Member

@aknysh aknysh left a comment

Choose a reason for hiding this comment

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

please see comments

@Nuru Nuru merged commit 8825f73 into master Dec 11, 2021
@Nuru Nuru deleted the spotinst branch December 11, 2021 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants