How to import a custom AWS rule - import

I'm trying to import a rule that looks like this in AWS:
enter image description here
I tried a command like this but it fails:
terraform import aws_security_group_rule.ke_ingress_icmp sg-0af205c29967e5084_ingress_icmp_-1_-1_0.0.0.0/0
aws_security_group_rule.ke_ingress_icmp: Importing from ID "sg-0af205c29967e5084_ingress_icmp_-1_-1_0.0.0.0/0"...
aws_security_group_rule.ke_ingress_icmp: Import prepared!
Prepared aws_security_group_rule for import
aws_security_group_rule.ke_ingress_icmp: Refreshing state... [id=sg-0af205c29967e5084_ingress_icmp_-1_-1_0.0.0.0/0]
Error: Cannot import non-existent remote object
I'm not sure how to represent protocol="Destination Unreachable" and port range="fragmentation required, and DF flag set" in the import command. Does anyone have any ideas?

Related

pulumi import of AWS Elastic Cache cluster is failing with error "resource does not exist"

I have a few AWS Elastic Clusters and I am trying to import them to Pulumi. The issue is that pulumi import returned error for most of my clusters. Only a few of them were able to be detected by pulumi.
Here is the example
admin-gateway and infra-storage-thai-test-v2 are both in same aws account and same region (us-west-2). Pulumi was able to generate code for admin-gateway:
thaipham#N9GK65GXW1 quickstart % pulumi import aws:elasticache/cluster:Cluster admin-gateway admin-gateway
Previewing import (dev)
View Live: https://app.pulumi.com/thailowki/quickstart/dev/previews/2189eee2-316c-4e2d-a50f-ab03a68c4194
Type Name Plan
+ pulumi:pulumi:Stack quickstart-dev create
= └─ aws:elasticache:Cluster admin-gateway import
Resources:
+ 1 to create
= 1 to import
2 changes
Do you want to perform this import? details
Then for infra-storage-thai-test-v2
thaipham#N9GK65GXW1 quickstart % pulumi import aws:elasticache/cluster:Cluster infra-storage-thai-test-v2 infra-storage-thai-test-v2
Previewing import (dev)
View Live: https://app.pulumi.com/thailowki/quickstart/dev/previews/a5490dc5-985d-49d7-ad67-928e331dc742
Type Name Plan Info
+ pulumi:pulumi:Stack quickstart-dev create 1 error
= └─ aws:elasticache:Cluster infra-storage-thai-test-v2 import 1 error
Diagnostics:
pulumi:pulumi:Stack (quickstart-dev):
error: preview failed
aws:elasticache:Cluster (infra-storage-thai-test-v2):
error: Preview failed: resource 'infra-storage-thai-test-v2' does not exist
I tried to use --logflow enabled and still there were not good insights.
here is some of the log:
I0901 10:21:47.233425 22540 eventsink.go:59] [aws-sdk-go] DEBUG: Validate Response elasticache/DescribeCacheClusters failed, attempt 0/25, error CacheClusterNotFound: CacheCluster not found: infra-storage-thai-test-v2
I0901 10:21:47.233438 22540 eventsink.go:62] eventSink::Debug(<{%reset%}>[aws-sdk-go] DEBUG: Validate Response elasticache/DescribeCacheClusters failed, attempt 0/25, error CacheClusterNotFound: CacheCluster not found: infra-storage-thai-test-v2<{%reset%}>)
I0901 10:21:47.233675 22540 eventsink.go:59] status code: 404, request id:
Any help would be greatly appreciated.
PS: I'm using pulumi v3.39.1

Pytest does not connect to the database when I run the test selectively

guys, tell me please, what can be caused by such anomalous behavior pytest?
I run so pytest - all tests pass.
I run sample tests, either - pytest tests/gate/test_loan.py :: Tests :: test_pass. Of course, it breaks, it can be seen from the stack that it breaks due to the fact that it can not be attached to the database. The question is how the second type of test run affects the connection from the database.
I understood this behavior.
Problem was relatid with wrong import of db_session.
main.app1.db.py
db_session = scoped_session(sessionmaker())
tests.conftest.py
from app1.db import db_session
right import
tests.conftest.py
from main.app1.db import db_session

Pyspark running error

The Spark I connected to, is not built on my local computer but a remote one. Everytime when I connect to it http://xx.xxx.xxx.xxx:10000/, the error says:
[IPKernelApp] WARNING | Unknown error in handling PYTHONSTARTUP file /usr/local/spark/python/pyspark/shell.py:
18/03/07 08:52:53 WARN ObjectStore: Failed to get database global_temp, returning NoSuchObjectException
Anyways, I still keep trying to run it on Jupyter notebook:
from pyspark.conf import SparkConf
SparkSession.builder.config(conf=SparkConf())
dir(spark)
When I ran it yesterday, it shows directory. when I did it today, it says:
NameError: name 'spark' is not defined
Any suggestion is appreciated!
you re missing the spark variable
from pyspark.conf import SparkConf
spark=SparkSession.builder.config(conf=SparkConf())
dir(spark)

Angular2 Web Workers and importScripts

I've been trying to code an Angular2 component with web workers, but I'm having trouble importing code for the worker thread. Here's the start of my component's code:
import {Component} from 'angular2/web_worker/worker';
import {platform} from "angular2/core";
import {WORKER_APP_PLATFORM, WORKER_APP_APPLICATION} from 'angular2/platform/worker_app';
In loader.js, I call importScripts in the following way:
importScripts( "https://code.angularjs.org/tools/system.js",
"https://code.angularjs.org/2.0.0-beta.0/web_worker/worker.dev.js",
"https://code.angularjs.org/2.0.0-beta.0/angular2.min.js",
"../../../../node_modules/reflect-metadata/Reflect.js");
I've verified that loader.js executes, but when I run the application, I get errors stating that "angular2/web_worker/worker", "angular2/core", and "angular2/platform/worker_app" can't be found. Do I need to import different dependencies in loader.js?

Using react-router w/ brunch/babel

I'm attempting use react-router in my brunch/babel setup. In my app.js I have:
import React from "react"
import ReactDOM from "react-dom"
import { Router, Route, Link } from "react-router"
This however gives me:
Uncaught Error: Cannot find module "history/lib/createHashHistory" from "react-router/Router"
When looking at the referenced line I see:
var _historyLibCreateHashHistory = require('history/lib/createHashHistory');
When inspecting the app.js that's generated via brunch I see:
require.register('history/createBrowserHistory', function(exports,req,module) {
...
});
How do I go about fixing this so that createBrowserHistory gets imported properly?
The module history is listed as a peer dependency by react-router, which means that you need to install it yourself through the command npm install history --save.