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

Help trying to use "ecs_service" #382

Open
hugo-paredes opened this issue Aug 28, 2018 · 5 comments
Open

Help trying to use "ecs_service" #382

hugo-paredes opened this issue Aug 28, 2018 · 5 comments

Comments

@hugo-paredes
Copy link

Hi.
I'm trying to use the ecs_service resource to validate a service. My problem (or ignorance) is when I try to use its(:load_balancers) or its(:network_configuration). How do I use the its(:network_configuration) and check if the assign_public_id is "DISABLED"?
Right now I'm trying to do like this

its(:network_configuration) { should have_attributes(:assign_public_id => "DISABLED") }

but I get the following error

1) ecs_service 'sandbox-ecs-test-fixture-ecs-service' network_configuration should have attributes {:assign_public_id => "DISABLED"}
     Failure/Error: its(:network_configuration) { should have_attributes(:assign_public_id => "DISABLED") }
       expected #<struct Aws::ECS::Types::NetworkConfiguration awsvpc_configuration=#<struct Aws::ECS::Types::AwsVpcC..."subnet-asd123"], security_groups=["sg-zxc123"], assign_public_ip="DISABLED">> to respond to :assign_public_id with 0 arguments
     # ./tests/controls/tests.rb:35:in `block (2 levels) in <top (required)>'

Thanks.

@hugo-paredes
Copy link
Author

I've used the AWS ecs cli to retrieve the information for the specific service. I saw that the the data is returned like this:

"networkConfiguration": {
  "awsvpcConfiguration": {
    "subnets": [
      "subnet-1234asd",
      "subnet-2312asdas",
      "subnet-123abc"
    ],
    "securityGroups": [
      "sg-abc123"
    ],
    "assignPublicIp": "DISABLED"
  }
}

I've tried, to the best of my knowledge, to retrive the information, but I couldn't.

@hugo-paredes
Copy link
Author

So, I've tried to debug it by output the content (puts its(:network_configuration)) and I got this:

  network_configuration                                                           
    example at ./tests/controls/tests.rb:36 (PENDING: Not yet implemented)        
                                                                                  
Pending: (Failures listed here are expected and do not affect your suite's status)
                                                                                  
  1) ecs_service 'sandbox-ecs-test-fixture-ecs-service' network_configuration     
     # Not yet implemented                                                        
     # ./tests/controls/tests.rb:36                                               

Does it mean exactly what it reads? It's not yet implemented?

Cheers.
Hugo

@sandygvs
Copy link

sandygvs commented Nov 8, 2018

Hi @k1LoW

awspec Version : 1.9.0
ruby version: 2.4.4p296

Am running awspec for ecs service by referring https://github.com/k1LoW/awspec/blob/master/doc/resource_types.md#ecs_service where am facing below error,

ecs_service 'dev-1-organization' network_configuration should eq ["subnets=["subnet-xxxx, subnet-xxx"]", "security_groups=["sg-xxx"]", "assign_public_ip="DISABLED""]
Failure/Error: its(:network_configuration) { should eq ['subnets=["subnet-xxx, subnet-xxx"]', 'security_groups=["sg-xxx"]', 'assign_public_ip="DISABLED"'] }

expected: ["subnets=["subnet-xxx, subnet-xxx"]", "security_groups=["sg-xxx"]", "assign_public_ip="DISABLED""]
got: #<struct Aws::ECS::Types::NetworkConfiguration awsvpc_configuration=#<struct Aws::ECS::Types::AwsVpcC..."subnet-xxx"], security_groups=["sg-xxx"], assign_public_ip="DISABLED">>

(compared using ==)

Diff:
@@ -1,4 +1,2 @@
-["subnets=["subnet-xxx, subnet-xxx"]",

  • "security_groups=["sg-xxx"]",
  • "assign_public_ip="DISABLED""]
    +"#<struct Aws::ECS::Types::NetworkConfiguration awsvpc_configuration=#<struct Aws::ECS::Types::AwsVpcC..."subnet-xxx"], security_groups=["sg-xxx"], assign_public_ip="DISABLED">>"

C:/Users/abcd/Terraform + InSpec/SAM/awspec/spec/ecs.rb:xx:in `block (2 levels) in <top (required)>'

Below is the ecs.rb file,
describe ecs_service('dev-1-organization'), cluster: 'dev-1-microservice' do
its(:network_configuration) { should eq ('subnets=["subnet-xxx, subnet-xxx"]', 'security_groups=["sg-xxx"]', 'assign_public_ip="DISABLED"') }
end

Much appreciate your help on this...

Thanks & Regards,
Santhosh

@sandygvs
Copy link

Still am facing the same issue... Any help is much Appreciated.

Thanks much!!

@rubelw
Copy link

rubelw commented Feb 10, 2019

I am facing the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants